<CuriousErnestBro>
that works, thank you havenwood!
<CuriousErnestBro>
I'm sorry, I'm new to this command line stuff
<havenwood>
CuriousErnestBro: no prob! You'll probably want to add that export command to your ~/.zshenv file.
<CuriousErnestBro>
as I understand it, lunchy is like systemctl for linux
<CuriousErnestBro>
havenwood oh, I added it to ~/.zshrc
<CuriousErnestBro>
is that wrong?
<CuriousErnestBro>
I don't have a ~/.zshenv file, only zshrc and zsh_history
<havenwood>
CuriousErnestBro: That's fine.
<havenwood>
CuriousErnestBro: I put my environment variables in .zshenv, but I swear all shell conventions are just superstitions. :P
<havenwood>
CuriousErnestBro: There are subtle differences that seldom matter.
<CuriousErnestBro>
havenwood I got another question, doing `which ruby` gives: /usr/local/opt/ruby/bin/ruby But I also did `brew install ruby` and that's at /usr/local/Cellar/ruby/2.7.1_2/bin
<CuriousErnestBro>
they both have the same version
<havenwood>
CuriousErnestBro: You can see the order of the available Rubies in your PATH with: which -a ruby
<havenwood>
CuriousErnestBro: The first one will win.
<havenwood>
CuriousErnestBro: It's common, when you want multiple Rubies at once, to use a Ruby version switcher.
<CuriousErnestBro>
havenwood so the question is, can I safely delete the brew version, I installed it following a stack overflow post
<havenwood>
CuriousErnestBro: Yes, it's fine to install and uninstall the brew Ruby repeatedly.
<CuriousErnestBro>
I get this:/usr/local/opt/ruby/bin/ruby
<havenwood>
CuriousErnestBro: It can also harmoniously live alongside other Rubies with no problem.
<CuriousErnestBro>
/usr/local/opt/ruby/bin/ruby
<CuriousErnestBro>
/usr/bin/ruby
<CuriousErnestBro>
yes, the first 2 lines are exactly the same, which is weird..
<havenwood>
CuriousErnestBro: Folk often use chruby, rbenv, RVM, or asdf to switch Rubies on macOS.
<CuriousErnestBro>
havenwood huh now lunchy is gone :(
<havenwood>
CuriousErnestBro: The conventional wisdom is to just avoid using system Ruby for apps.
<CuriousErnestBro>
apparently this "symbolic linking" thing is doing some weird stuff
<havenwood>
CuriousErnestBro: How are you installing Ruby??
<havenwood>
CuriousErnestBro: You might consider just going straight to chruby. The brew Ruby actually works great once you setup your PATH, but it'll just be the latest version. If that works for you, you might not need a switcher like chruby.
<CuriousErnestBro>
yes, I'm just installing ruby to get access to the lunchy tool
<havenwood>
CuriousErnestBro: Or you can use chruby to setup PATH and other env vars for the brew Ruby.
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
hassox has joined #ruby
rmnull has quit [Quit: WeeChat 2.8]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
SuperLag has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
cliluw has quit [Ping timeout: 260 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
polishdub has joined #ruby
_whitelogger has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
mheld has quit [Quit: Connection closed for inactivity]
donofrio has quit [Remote host closed the connection]
rcvalle has joined #ruby
minall has joined #ruby
minall has quit [Client Quit]
zapata has joined #ruby
polishdub has quit [Quit: leaving]
sauvin has joined #ruby
hassox has quit [Remote host closed the connection]
greypack has quit [Ping timeout: 246 seconds]
greypack has joined #ruby
burgestrand has joined #ruby
greypack has quit [Ping timeout: 256 seconds]
greypack has joined #ruby
imode has quit [Ping timeout: 246 seconds]
chalkmonster has joined #ruby
hiroaki has quit [Ping timeout: 272 seconds]
greypack_1 has joined #ruby
greypack has quit [Ping timeout: 258 seconds]
Vashy has quit [Ping timeout: 252 seconds]
sagax has joined #ruby
schne1der has joined #ruby
schne1der has quit [Client Quit]
schne1der has joined #ruby
vondruch has joined #ruby
sergioro has quit [Quit: Lost terminal]
chouhoulis has quit [Remote host closed the connection]
Vashy has joined #ruby
greypack_1 has quit [Ping timeout: 272 seconds]
greypack has joined #ruby
rmnull has joined #ruby
rmnull has quit [Client Quit]
cliluw has joined #ruby
szqdsegrhrdgdrg has joined #ruby
<szqdsegrhrdgdrg>
hi
d3bug has quit [Quit: Connection closed for inactivity]
<jhass>
hi
cliluw has quit [Ping timeout: 240 seconds]
<szqdsegrhrdgdrg>
Is it necessary to destruct the session cookie after user is logout ?
Vashy has quit [Ping timeout: 252 seconds]
ldepandis has joined #ruby
<szqdsegrhrdgdrg>
I mean the session is destruct in the server, but the cookie is still in the user browser. Should I programmaticaly delete it ?
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
felix_221986 has joined #ruby
hiroaki has joined #ruby
Technodrome has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
Garb0 has joined #ruby
<jhass>
you should use some authentication framework like devise that deals with details like this for you :)
cisco has joined #ruby
<jhass>
(but yes, you should at least attempt to destroy the cookie=)
<szqdsegrhrdgdrg>
why ?
<jhass>
why to which point?
<szqdsegrhrdgdrg>
the session cookie is no longer valid, so why remove it ?
<jhass>
maybe your session invalidation has a bug in it, why keep it around and make it more likely to be stolen? Why let intermediaries keep using it to track/reidentifiy the user if you have no purpose for it whatsover anymore?
<jhass>
I think it's just basic hygenie, clean up what you don't need anymore
dionysus69 has joined #ruby
<szqdsegrhrdgdrg>
jhass ok thanks
Vashy has joined #ruby
Vashy has quit [Ping timeout: 252 seconds]
ur5us has joined #ruby
szqdsegrhrdgdrg has left #ruby [#ruby]
Vashy has joined #ruby
baojg has joined #ruby
chalkmonster has quit [Read error: Connection reset by peer]
schne1der has quit [Quit: schne1der]
chalkmonster has joined #ruby
TomyWork has joined #ruby
gitter1234 has joined #ruby
Garb0 has quit [Remote host closed the connection]
hassox has quit [Remote host closed the connection]
e2 has joined #ruby
<adam12>
Not sure this is even possible but has anybody ever seen a block rebound to another binding that might have access to refinements?
<jhass>
uh, shouldn't be too hard to try out?
TCZ has quit [Quit: Leaving]
<jhass>
might depend on the ruby version, refinements still saw touchups in up to 2.6
<adam12>
jhass: I've tried multiple routes but no joy.
<adam12>
jhass: I'm presuming it's not possible due to the lexical scoping of refinements but was hoping someone might have seen something on their travels :)
rmnull has quit [Ping timeout: 244 seconds]
Esa__ has joined #ruby
conta has joined #ruby
wymillerlinux has joined #ruby
baojg has quit [Remote host closed the connection]
<bovis>
In main, I'd like to define a date-start and date-end as variables, then using those variables in external files that contain json. Using 'require 'jsonfile'', I run into a NameError for date-start. What's the easiest way around this problem?
lxsameer has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
dionysus69 has joined #ruby
xco has joined #ruby
BTRE has joined #ruby
caterfxo has quit [Quit: leaving]
ChmEarl has joined #ruby
<Iambchop>
bovis: can you paste your actual code? https://dpaste.de and/or describe what you want your program to do
<jhass>
bovis: yes local variables are lexically scoped, that is to the file. Maybe you want to use CONSTANTS instead?
caterfxo has joined #ruby
imode has joined #ruby
imjoehaines has joined #ruby
kickr has joined #ruby
howdoi has joined #ruby
kickr has quit [Client Quit]
<bovis>
Iambchop: https://dpaste.org/ej49 More or less, the only thing I'm doing is moving Line 6 to a new file
<bovis>
That's a simplified version. I want to move the data because it's become so large.
<bovis>
jhass: I don't know if constants would be the right way to go. I'm ending up with a lot of variables I want to reuse across multiple files.
<bovis>
jhass Iambchop: I had thought about just pulling in raw data and assigning/reassigning as necessary. For instance, instead of {"item": { "start": datestart, "end": dateend}, I have {"item": { "start": "", "end": ""}, assign that hash in main, and then on a per-assignment basis, state what I want start and end to be, along with any other elements I know I'll want to change
jcalla has joined #ruby
rmnull has joined #ruby
<bovis>
jhass: I tried attr_reader and changing the variables in the external file to dates.datestart, but I ended up with the same NameError. Would that happen with a struct?
<jhass>
bovis: the struct is just a shorthand to defining a class. The key is the local_variables are lexically scoped to their file. They will never ever appear in another file. Only $global variables (don't use them, really) and Constants are globally scoped
<jhass>
so the simplest solution probably is turning all your configuration local variables into a constant. Slightly cleaner could be collecting them into some kind of class and then assigning an instance of that class to a constant
<jhass>
there's probably designs to do what you do to avoid either of that by introducing classes to represent entities and procsses in your program and then passing around instances of that etc
<jhass>
but that's beyond anything that can be reasonably described here, especially since it's highly specific to what you do exactly, which you have not shared
gray_-_wolf has quit [Quit: WeeChat 2.8]
<bovis>
jhass: Sorry to not be specific. There really isn't any more to the problem than the code in https://dpaste.org/ej49 . It's a matter of having variables referenced in one file but created in another. I think assigning a class to a constant is exactly what I need. This is a toy project; nothing that needs a highly specific fix or to be overengineered
<jhass>
sure, fair. Just listing the options :)
darkstardev13 has quit [Remote host closed the connection]
darkstardev13 has joined #ruby
<bovis>
jhass: Much appreciated
gueorgui_ is now known as gueorgui
rmnull has quit [Ping timeout: 260 seconds]
rakm has joined #ruby
<rakm>
hi there, i'm struggling to understand something. i'm running ruby 2.5.1 and doing require 'rubygems/package' and then using the `Gem::Package::TarReader` class in some code. This code has a bug that was fixed here: https://github.com/rubygems/rubygems/pull/2780. Is there a way to adopt this change *without* running `gem update --system` and without upgrading ruby itself?
<rakm>
I tried adding `gem 'rubygems-update', '~> 3.0.5'` in my Gemfile and bundling, but that doesn't seem to do the trick
<rakm>
i'm missing some high level understanding of how the `Gem` class and `rubygems-update` are related
<SuperLag>
cbcoredumps = Dir.glob('core.*').sort_by { |f| File.mtime(f) } <-- what is the |f| called? I'm trying to figure out what that is, so I can look it up in Ruby documentation. I get this much... declaring a var called "cbcoredumps" that is a list of core.* from the current directory
schne1der has quit [Ping timeout: 256 seconds]
burgestrand has joined #ruby
burgestrand has quit [Client Quit]
<jhass>
rakm: did you try putting a newer version of rubygems itself into your Gmefile?
<jhass>
ah nvm, for some reason I thought there's a gem packaging it up
<rakm>
@jhass yeah that's one of the things i'm confused about. does `rubygems-update` not contain rubygems itself? what exactly does `gem update --system` do, and what exctly does rubygems-update do?
<jhass>
I'm afraid you'll have to get another ruby, if not a newer one, one where you can update rubygems. One venue could be using a ruby version manager (RVM, rbenv, chruby/ruby-install) to install a site local ruby
<rakm>
so how would I know what version of rubygems is included in ruby?
<jhass>
gem -v
<rakm>
so i'd have to install it first to find out?
<jhass>
mmh, I guess it's documented somewhere or could be read from the source code at the release tag
<jhass>
but it doesn't matter, if you get a site local ruby you can just update rubygems within it
<jhass>
without touching your system
<rakm>
whoa, ok can you break that down for me? What is "site local ruby" do you just mean rbenv/rvm?
<jhass>
yes, I just mean RVM/rbenv/chruby(ruby-install)
<havenwood>
rakm: RubyGems is itself a gem but it doesn't ship itself as a gem package. The `gem update --system` command bootstraps an update or the rubygems-update gem provides the update_rubygems command.
<havenwood>
rakm: Ruby ships with a particular version of RubyGems, but it can be updated via either `gem update --system` or `update_rubygems` commands without updating Ruby itself.
<rakm>
hmm ok. so the context here is that i'm running some stuff in CI which is based on a docker image that has ruby 2.5.1. I *can* rbenv install an update, but that's slow. I can also use a newer image, but am trying to avoid that until i understand really what's going on
<SuperLag>
jhass: you rock
<havenwood>
rakm: Use the latest stable 2.5 in any case—so 2.5.8.
<havenwood>
rakm: 2.5.1 has known security issues.
<havenwood>
rakm: It'd probably be worth going ahead to 2.6.6 or better yet 2.7.1, but 2.5.8 is a no-brainer.
rmnull has joined #ruby
<havenwood>
Do it!
<rakm>
yeah for sure, that's the plan. but i'm more just wondering how this all fits together right now
<havenwood>
rakm: RubyGems is a gem that's part of the Ruby standard library. New versions of Ruby ship new versions of RubyGems. You can update RubyGems without updating Ruby, to an extent.
<rakm>
ok so next question is... when I `require 'rubygems/package`, how do I know what is actually getting resolved? e.g. if I run `gem update --system` vs `update_rubygems`, how do I know which rubygems code will actually be loaded?
rmnull has quit [Client Quit]
<havenwood>
rakm: If you want, you can download the latest RubyGems tarball, unpack it and run: ruby setup.rb
<havenwood>
rakm: Or the `gem update --system` or `update_rubygems` commands will also get you the latest.
<havenwood>
rakm: It'll update to latest supported. You don't know the version unless you choose it yourself, like: update_rubygems --version="3.1.3"
kinduff has quit [Read error: Connection reset by peer]
<jhass>
the commands a synonmym and will touch your ruby installation. Each ruby installation can only have on rubygems version installed (apparently)
<jhass>
*are synonym
kinduff has joined #ruby
Tempesta has quit [Ping timeout: 240 seconds]
<SuperLag>
jhass: I rest my case. :D
<rakm>
interesting... ok. going to try one thing... rbenv install 2.5.1, then track changed to ~/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0 before and after `gem update --system`. If I understand correctly the definition of `Gem::VERSION` constant in that folder will change before and after and $LOAD_PATHS should stay the same
<rakm>
(although kind of confusing why that path is `site_ruby/2.5.0` instead of 2.5.1
chalkmon1 has joined #ruby
<jhass>
in the paths it's the ABI version, not the interpreter version :)
<jhass>
so you can update your patchlevel without having to rebuild gems with native extensions
chalkmonster has quit [Ping timeout: 260 seconds]
<havenwood>
rakm: Update your ruby-build package and: rbenv install 2.5.8
<havenwood>
rakm: 2.5.1 is old. 2.5.8 will *just work*.
<havenwood>
rakm: The ABI for 2.5.8 is also 2.5.0.
<rakm>
oh what is ABI?
<rakm>
havenwood: thanks for the suggestion to ugprade ruby, but as I said, that option is more complicated at the moment (i'll get there)
<rakm>
hmm interesting so what happens is that `~/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb` contains the default Gem::VERSION constant at 2.7.6. when I run `gem update --system`, it adds a file at `~/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems.rb` (note that additonal site_ruby directory)
<rakm>
s/additional/nested
chalkmon1 has quit [Quit: WeeChat 2.8]
imjoehaines has quit [Quit: rirc v0.1.2]
chalkmonster has joined #ruby
imjoehaines has joined #ruby
cliluw has joined #ruby
renich has joined #ruby
burningserenity has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
cd has joined #ruby
cliluw has quit [Ping timeout: 260 seconds]
cliluw has joined #ruby
gix has joined #ruby
TomyWork has quit [Remote host closed the connection]
burningserenity has quit [Ping timeout: 240 seconds]
<jhass>
leitz: what happens in your transform_values! block if v is not an integer?
<jhass>
what's the return value of the block then?
chalkmonster has quit [Quit: WeeChat 2.8]
burningserenity has joined #ruby
* leitz
is testing
<havenwood>
leitz: That if statement returns `nil` not `v` in the second case.
<havenwood>
leitz: v.is_a?(Integer) ? v.to_s : v
davispuh has joined #ruby
<leitz>
havenwood, thanks! It's afternoon for me, and my brain has called it a day. :)
postmodern has joined #ruby
Tempesta has joined #ruby
CrazyEddy has joined #ruby
vondruch has quit [Ping timeout: 256 seconds]
Vashy has quit [Ping timeout: 252 seconds]
burningserenity has quit [Remote host closed the connection]
maths22 has joined #ruby
TvL2386 has quit [Ping timeout: 256 seconds]
xco has joined #ruby
<maths22>
I'm noticing a behavior change between ruby 2.5 and ruby 2.6 that doesn't appear intentional/called out on any release notes, but before I file a bug I want to make sure that I'm not missing something
<havenwood>
maths22: Gist a reproduction script?
<maths22>
On ruby 2.4/2.5, `Signal.trap("CLD") { puts "Child died" }; system("true")` exits without printing anything
<S0bait>
How do I differentiate between a value in an array that is nil or a value that does not exist outside of the size of an array?
<jhass>
use #fetch
dionysus69 has quit [Ping timeout: 264 seconds]
<havenwood>
S0bait: +1 #fetch or #dig if it's nested.
<jhass>
or just manually bounds check using #size
<jhass>
depends a bit on the usecase
<jhass>
maybe you can just #compact to know there's no valid nil values
<S0bait>
Amazing, thank you
<S0bait>
Fetch is perfect for my needs!
rakm has quit [Quit: Connection closed for inactivity]
wilhelm418 has quit [Ping timeout: 260 seconds]
S0bait has quit [Quit: Leaving.]
TCZ has joined #ruby
dnadev2 has joined #ruby
<KrzaQ>
is there a way to restart function execution retry-like, but without exceptions? If I get 401 (which is not an execption) I want to relogin and try again
TvL2386 has joined #ruby
minall has joined #ruby
<minall>
Hello Ruby community!, I
<minall>
I'm trying to install the json gem... But I can't find how on Ubuntu, can someone help me?
<havenwood>
Minall: json ships with the Ruby stdlib.
<minall>
For installing the pg gem, I had to install a developer pg package on Ubuntu, but I can't find anyone for json