havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
elphe has joined #ruby
elphe has quit [Ping timeout: 264 seconds]
_aeris_ has quit [Remote host closed the connection]
drincruz has joined #ruby
_aeris_ has joined #ruby
ChmEarl has quit [Quit: Leaving]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Axy has quit [Ping timeout: 258 seconds]
roshanavand__ has joined #ruby
mikhailnovikov has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
roshanavand_ has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 260 seconds]
skx86 has joined #ruby
alfiemax has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
xco has joined #ruby
gix has quit [Ping timeout: 272 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
ur5us has joined #ruby
oddp_ has quit [Ping timeout: 260 seconds]
elphe has joined #ruby
elphe has quit [Ping timeout: 260 seconds]
mossplix has quit [Remote host closed the connection]
<adam12> al2o3-cr: Seems not perfect. I did notice the same in pry as you.
mossplix has joined #ruby
mossplix has quit [Ping timeout: 260 seconds]
stryek has quit [Quit: Connection closed for inactivity]
elphe has joined #ruby
Axy has joined #ruby
Axy has quit [Changing host]
Axy has joined #ruby
thecoffemaker has quit [Ping timeout: 272 seconds]
bsdband4 has joined #ruby
bsdband4 has quit [Remote host closed the connection]
thecoffemaker has joined #ruby
Mia has quit [Ping timeout: 256 seconds]
bsdbandit-01 has quit [Ping timeout: 260 seconds]
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
bruce_lee has quit [Ping timeout: 260 seconds]
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
konsolebox has quit [Read error: Connection reset by peer]
arzWZM has quit [Ping timeout: 240 seconds]
arzWZM has joined #ruby
konsolebox has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
xco has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
jetchisel has quit [Ping timeout: 264 seconds]
akem has joined #ruby
tsrt^ has quit [Ping timeout: 240 seconds]
donofrio has quit [Remote host closed the connection]
CrazyEddy has quit [Ping timeout: 260 seconds]
konsolebox has quit [Read error: Connection reset by peer]
CrazyEddy has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Client Quit]
konsolebox has joined #ruby
alfiemax has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Remote host closed the connection]
arzWZM has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 256 seconds]
Axy has quit [Ping timeout: 240 seconds]
KramerC has quit [Quit: Leaving]
cthulchu_ has joined #ruby
<cthulchu_> folks, how would you call minitest?
KramerC has joined #ruby
<cthulchu_> I'm looking for something similar but in npm
<cthulchu_> wanna write this regression project in Node
alfiemax has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
skx86 has quit [Quit: Connection closed for inactivity]
alexherbo2 has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
schne1der has joined #ruby
alexherbo2 has quit [Ping timeout: 264 seconds]
skx86 has joined #ruby
BenDover has joined #ruby
lmat has quit [Ping timeout: 264 seconds]
lmat has joined #ruby
baojg has quit [Remote host closed the connection]
baojg_ has joined #ruby
baojg_ has quit [Remote host closed the connection]
baojg has joined #ruby
alexherbo2 has joined #ruby
alfiemax has quit [Remote host closed the connection]
mossplix has joined #ruby
cthulchu_ has quit [Remote host closed the connection]
alfiemax has joined #ruby
mossplix has quit [Ping timeout: 256 seconds]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
xco has joined #ruby
mossplix has joined #ruby
alfiemax has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 256 seconds]
shaman42 has quit [Ping timeout: 264 seconds]
arzWZM has joined #ruby
alfiemax has joined #ruby
kinduff has quit [Quit: gg]
apteryx is now known as Guest94585
Guest94585 has quit [Killed (cherryh.freenode.net (Nickname regained by services))]
apteryx has joined #ruby
elphe has joined #ruby
baojg has quit [Remote host closed the connection]
baojg_ has joined #ruby
shansen has quit [Quit: ZNC 1.7.4+deb0+bionic0 - https://znc.in]
elphe has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
havenwood has quit [Quit: ZNC 1.8.1 - https://znc.in]
TomyWork has joined #ruby
havenwood has joined #ruby
havenwood has quit [Changing host]
havenwood has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
baojg_ has quit [Remote host closed the connection]
baojg has joined #ruby
skx86 has quit [Quit: Connection closed for inactivity]
elphe has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
maidhc_ has joined #ruby
maidhc_ has quit [Ping timeout: 240 seconds]
mikhailnovikov has joined #ruby
mikhailnovikov has quit [Client Quit]
vondruch has quit [Quit: vondruch]
<al2o3-cr> adam12: i initially thought it might be pryrc interfering but i've temporarily suppressed both and the same behaviour happens.
vondruch has joined #ruby
mossplix has quit [Remote host closed the connection]
imode has quit [Ping timeout: 260 seconds]
oddp_ has joined #ruby
mossplix has joined #ruby
<al2o3-cr> adam12: binding.irb works flawlessly, binding.pry with next/step jumps to '/usr/lib/ruby/2.7.0/forwardable.rb:229' => 229: #{accessor} @ this line always. puzzled to say the least.
mossplix has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
AlwaysInTime has joined #ruby
dfucci has joined #ruby
ur5us has joined #ruby
ur5us has quit [Client Quit]
konsolebox has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
konsolebox has joined #ruby
ruurd has joined #ruby
mossplix has joined #ruby
dionysus69 has joined #ruby
Tempesta_ has quit [Quit: See ya!]
Tempesta has joined #ruby
baojg has quit [Remote host closed the connection]
dfucci_ has joined #ruby
baojg_ has joined #ruby
rkoller has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
rkoller has quit [Client Quit]
schne1der has quit [Ping timeout: 265 seconds]
dfucci_ has quit [Ping timeout: 240 seconds]
MrCrackPot has joined #ruby
hkais has joined #ruby
hkais has left #ruby [#ruby]
MrCrackPot has quit [Quit: Leaving]
twe4ked has quit [Ping timeout: 256 seconds]
sagax has quit [Read error: Connection reset by peer]
twe4ked has joined #ruby
mossplix has quit [Ping timeout: 246 seconds]
Besnik_b has joined #ruby
Besnik_b has quit [Client Quit]
dualfade has quit [Ping timeout: 264 seconds]
dualfade has joined #ruby
MrCrackPot has joined #ruby
baojg_ has quit [Remote host closed the connection]
TvL2386 has quit [Quit: leaving]
troulouliou_dev has joined #ruby
TvL2386 has joined #ruby
baojg has joined #ruby
Mia has quit [Read error: Connection reset by peer]
<TvL2386> hey all, I just found out that [nil].empty? is false and [nil].any? is false as well
<TvL2386> did not expect that
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
markoong has joined #ruby
<leftylink> what is there to say in response to that other than "yes, what you have just said is the case, and both things are expected" ?
<TvL2386> There's nothing to say, it wasn't a question. I was just really surprised and thought maybe someone in here reading it would learn something as well like I did.
<TvL2386> Maybe shouldn't have started with "hey all"
<TvL2386> I'm sorry
<yxhuvud> any? simply go through the enumerable and checks if any element is true. Which nil is not.
<leftylink> ah, good. I had to ask because a lot of the time no question will be stated, but the person actually had a question
<leftylink> but in this case since there was no question, all is good
<TvL2386> thx leftylink, my mistake, I should have been more clear
alfiemax has quit [Remote host closed the connection]
<leftylink> I was worried that my statement might have seemed too passive-aggressive. I think it would have been better if I had instead asked "indeed, are there any questions and/or can we explain this for you"
<TvL2386> I must admit that I took it as passive-aggressive yes :)
<leftylink> ah.
<TvL2386> But no worries :)
<leftylink> I'll learn from that and be clearer in the future
<TvL2386> Well, good to see my eye-opener, and wanting to share, did lead to something positive :p
lmat has quit [Ping timeout: 264 seconds]
Mia has quit [Read error: Connection reset by peer]
markong has joined #ruby
markoong has quit [Ping timeout: 258 seconds]
lmat has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
ur5us has quit [Ping timeout: 260 seconds]
<pwnd_nsfw> TvL2386 what if you have multiple nil items in an array?
<pwnd_nsfw> That's false as well
xco has joined #ruby
<pwnd_nsfw> TvL2386 I guess 'cause any without a block checks to see if there's any truthy elements in it
<pwnd_nsfw> of which nil is not
<pwnd_nsfw> word
<TvL2386> pwnd_nsfw: yes you are correct. I just mistakenly always thought any? was the same as !empty?
<pwnd_nsfw> That's what I thought when you brought up the idea
<TvL2386> :)
<pwnd_nsfw> yxhuvud had said it already :x
<TvL2386> yep, it's totally clear now. any? is very powerful, I should use it (correctly) more
<pwnd_nsfw> well
<pwnd_nsfw> any? { |elem| elem.nil? } is correct
<pwnd_nsfw> :p
<TvL2386> lol
<TvL2386> but it's not the same as any? { |elem| !!elem }
<pwnd_nsfw> Not at all, for sure
<TvL2386> I made no sense, nm :)
<TvL2386> [nil].any?(NilClass)
<TvL2386> that also works!
<pwnd_nsfw> any?(&:nil?)
<TvL2386> yep
<leftylink> I haven't used patterned any? (or all?, none?, one?) yet, that I can remember. I thought "this is cool!" when it was introduced in 2.5, just hadn't gotten a chance yet
exmortus has quit [Ping timeout: 260 seconds]
<pwnd_nsfw> have you just not written any ruby since? lol
<pwnd_nsfw> I keep forgetting a lot of the convenience is there
<leftylink> even though I used any and all many times, I never had an occasion to pass them patterns
<pwnd_nsfw> ah, understood
ursuta has joined #ruby
ursuta has quit [Max SendQ exceeded]
<leftylink> oh... actually, searching through some recent code, I've missed soem easy opportunities to do so...
<TvL2386> doing `grep -r 'any?' app in my rails root... Same here, It's actually only used to test if an Enumerable has any values... And that's where I went wrong. I thought any? was !empty?
<leftylink> I have a few instances of any? { |x| range.cover?(x) } which I should instead write as any?(range)
darkstardevx has joined #ruby
<TvL2386> nice :)
<leftylink> so uh I guess I just forgot that that exists
bsdbandit-01 has joined #ruby
schne1der has joined #ruby
<TvL2386> I'm now looking at this rails code @user.errors.any? and knowing what any? does now, I don't like it anymore
donofrio has joined #ruby
drincruz has joined #ruby
<TvL2386> I shouldn't complain. Of course it's not an Array :S
<TvL2386> talking about cool methods not being used: how about :tap ?
cgfbee has quit [Remote host closed the connection]
wildtrees has joined #ruby
<leftylink> I sometimes feel "insecure" in how I use it, by which I mean that I worry that the code will be judged to be unclear. often I use it to replace something like `x = figure_it_out; side_effect; x` with `figure_it_out.tap { side_effect }`
<leftylink> though I can't recall many instances where I put that insecurity to the test
<leftylink> and see whether people actually think it's unclear
<TvL2386> Yeah I understand
cgfbee has joined #ruby
<TvL2386> I'm doing something here that I'm also not to sure about. My method needs to return an Array but has many if statements which may add items to the array. Weird business logic. So to not forget about returning an Array, I just wrapped the entire method body in [].tap { |items| .... }
<TvL2386> it works, not very pretty though
alfiemax has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
code_zombie has joined #ruby
<leftylink> for that sometimes I would do it like
<leftylink> &>> [(1 if true), (2 if false), (3 if true)].compact
<rubydoc> # => [1, 3] (https://carc.in/#/r/9f9v)
<leftylink> shrug
<leftylink> I suppose this is not good if the conditions get too long though
<leftylink> I'm happy to put each element on its own line, but if the conditions also require multiple lines I'm not sure I can possibly make that look good
<TvL2386> wouldn't work for my case, but that's interesting code though
baojg has quit [Remote host closed the connection]
baojg_ has joined #ruby
<pwnd_nsfw> ruby is great lol
<rapha> hi all
Garb0 has joined #ruby
roshanavand__ has quit [Ping timeout: 240 seconds]
jhill has quit []
drincruz has joined #ruby
jhill has joined #ruby
ec has quit []
ec has joined #ruby
impermanence has joined #ruby
alfiemax has quit [Remote host closed the connection]
Garb0 has quit [Remote host closed the connection]
<rapha> hmm
<rapha> can ruby Marshal _any_ object, no matter how complex?
strmpnk has quit []
strmpnk has joined #ruby
<leah2> >> Marshal.dump(STDIN)
<leah2> &>> Marshal.dump(STDIN)
<rubydoc> stderr: -e:4:in `dump': can't dump IO (TypeError)... check link for more (https://carc.in/#/r/9fal)
englishm has quit []
englishm has joined #ruby
xco has quit [Read error: Connection reset by peer]
ctOS has quit []
ctOS has joined #ruby
TCZ has joined #ruby
<rapha> hmmm
<rapha> okay
<rapha> :P
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Mia has quit [Read error: Connection reset by peer]
wildtrees_ has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
wildtrees has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
baojg_ has quit [Remote host closed the connection]
baojg has joined #ruby
micah has joined #ruby
<micah> hi all, i'm fairly newb to ruby, i created this simple script that I'm confused why it doesn't work: https://gist.github.com/micah/09a6198c2ac9f6c29bbe3faf1de2d9bc
<micah> it does run, but the second embedded case finds a device that doesn't occur in the case
<micah> it finds one matching "Vendor"=>"8086", "Device"=>"1533", which makes no sense
<micah> maybe /^153a|^1096/ doesn't mean "^153a" OR "^1096" ?
<adam12> micah: You want it to match ^153a or ^1096, but it matched 1533?
<adam12> micah: How are you determining what is matching? from the puts on line 39?
mossplix has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
elphe has quit [Ping timeout: 240 seconds]
<micah> adam12: ah, i think i see the issue, the 'slot' variable is not changing, its just the last one determined each time
<micah> i need to iterate over each slot, i thought that devices[slot][splitted[0].chop] = splitted[1].chomp would make it so the devices hash was keyed on the slot, and then devices.each_key do |a| would iterate over each of those slots
TomyWork has quit [Remote host closed the connection]
<micah> yeah, ok, i see it now, thanks for rubber ducking :D
<adam12> :)
<al2o3-cr> adam12: awesome! i really like this simple debugger, i'm glad you mentioned it up yesterday :)
<adam12> micah: if you're accepting improvement suggestions, I think I might have two at least.
TomyWork has joined #ruby
xkraty has joined #ruby
xkraty has left #ruby [#ruby]
xkraty has joined #ruby
elphe has joined #ruby
TCZ has quit [Quit: Leaving]
Genadi has joined #ruby
<micah> adam12: sure, i'm interested! this is what I have now, it works, except that it adds an empty "" to the array: https://gist.github.com/micah/3eca3203444bd2156dd24fd1db0539fb
xkraty has left #ruby [#ruby]
Mia has quit [Read error: Connection reset by peer]
xco has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
skx86 has joined #ruby
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
dionysus70 is now known as dionysus69
Genadi has quit [Remote host closed the connection]
<micah> adam12: this is the latest, seems to work, so any improvements, i'm interested: https://dpaste.org/gYne
sagax has joined #ruby
pwnd_nsfw has quit [Remote host closed the connection]
pwnd_nsfw has joined #ruby
Esa__ has joined #ruby
schne1der has quit [Ping timeout: 256 seconds]
<adam12> micah: My first suggestion is to eagerly skip loops instead of using an if statement that covers the entire loop.
<adam12> micah: So where you if not line =~ /^$/ then a huge block, I'd go `next if line =~ /^$/` then get rid of the if/end part. If it's an empty line, move on. If not, evaluate rest of the block.
<micah> adam12: get rid of which if/end part?
<micah> you mean like this:
<adam12> micah: Yea :)
<adam12> micah: My second suggestion would be to split on ":\t", and give names to the return values. attribute, value = line.split(":\t", 2)
<adam12> micah: Then anywhere you use splitted[0], it's attribute, and where you use splitted[1], it's value. No chopping necessary (tho you might need to chomp newlines).
<adam12> micah: you could even chomp early, before splitting. attribute, value = line.chomp.split(":\t", 2)
<micah> if I get you right, you mean like this: https://dpaste.org/Z19O ? Or are you saying I can remove some more chomps?
<adam12> micah: you can get rid of all chomps except the one on the split line, if you wanted.
<adam12> micah: now of course, attribute is going to be "Slot" not "Slot:" so you can do a regular if. `if attribute == "Slot"`
<micah> right
<adam12> micah: you shouldn't need value[1] either, unless you want the first character of a String.
<micah> adam12: oh, you mean just replace value[1] with value
<adam12> micah: Right. attribute and value are usable as-is. No chomping, no chopping, no subarray needed. Just use it as it was the real value you cared about.
<micah> this is definitely much cleaner
manveru has quit []
manveru has joined #ruby
mossplix has quit [Remote host closed the connection]
<adam12> micah: where you call `#select {}[0]`, you can just use `find` or `detect` here. It will return the first value (or nil). `find` and `detect` are the same (one is an alias for the other) so you can use whichever one reads nicer to you.
vondruch has quit [Quit: vondruch]
cthu| has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> micah: Dir includes the Enumerable module, so you can even drop `entries` and just call `find` or `detect` after your call to `glob`.
<micah> adam12: do you mean I can just replace 'select' with 'find' and remove the [0]? so it is: device = Dir.entries("/sys/bus/pci/devices/#{a}/net").find {|f| !File.directory? f} + "," + device
<adam12> Oh, nevermind, you call entries with a glob.
<adam12> micah: Yep, that looks right.
arzWZM has quit [Ping timeout: 256 seconds]
arzWZM has joined #ruby
mossplix has joined #ruby
kozowu has quit []
kozowu has joined #ruby
CrazyEddy has quit [Ping timeout: 246 seconds]
impermanence has quit [Quit: Connection closed]
parallels has joined #ruby
CustosLimen has quit []
MrCrackPot has quit [Quit: Leaving]
CustosLimen has joined #ruby
vondruch has joined #ruby
Mia has quit [Ping timeout: 240 seconds]
parallels has quit [Ping timeout: 256 seconds]
alex_ has joined #ruby
TCZ has joined #ruby
orbyt_ has joined #ruby
duckpupp- has joined #ruby
duckpuppy has quit [Ping timeout: 244 seconds]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
lmat has quit [Ping timeout: 240 seconds]
alexherbo2 has quit [Ping timeout: 265 seconds]
alex_ has quit [Quit: leaving]
ChmEarl has joined #ruby
lmat has joined #ruby
mossplix has quit [Remote host closed the connection]
_aeris_ has quit [Ping timeout: 240 seconds]
_aeris_ has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
lmat has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
lmat has joined #ruby
xco has joined #ruby
TomyWork has quit [Remote host closed the connection]
TCZ has quit [Quit: Leaving]
al2o3-cr has quit [Quit: WeeChat 2.8]
al2o3-cr has joined #ruby
alexherbo2 has quit [Ping timeout: 240 seconds]
gray_-_wolf has joined #ruby
chalkmonster has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
lmat has quit [Ping timeout: 256 seconds]
lmat has joined #ruby
cd has joined #ruby
mossplix has joined #ruby
postmodern has quit [Quit: Leaving]
ellcs has joined #ruby
venmx has quit [Quit: leaving]
<micah> adam12: hum, it seems that now I dont have a key 'Vendor'
<micah> i think its because it is Vendor:\t
<micah> it looks like \nClass:\t0300\nVendor:\t1a03\nDevice:\t2000\nSVendor:\t15d9\nS
<micah> oh strange, when I look at devices its cut off: {"0000:00:00.0"=>{"Clas"=>"0600", "Vendo"=>"8086", "Devic"=>"0c08", "SVendo"=>"15d9", "SDevic"=>"0811", "Re"=>"06"},
<micah> ah I think i had an additional chop to get rid of
alexherbo2 has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
Lewix has quit []
Lewix has joined #ruby
AlwaysInTime has quit [Ping timeout: 240 seconds]
konsolebox has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gavlee has quit [Remote host closed the connection]
gavlee has joined #ruby
bocaneri has quit [Remote host closed the connection]
AlwaysInTime has joined #ruby
greypack has quit [Read error: Connection reset by peer]
greypack_1 has joined #ruby
gavlee has quit [Remote host closed the connection]
gavlee has joined #ruby
AlwaysInTime has quit [Ping timeout: 256 seconds]
gavlee has quit [Max SendQ exceeded]
gavlee has joined #ruby
xco has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
drincruz has quit [Ping timeout: 256 seconds]
bsdbandit-01 has joined #ruby
<apteryx> hello! Shouldn't the Time class obey SOURCE_DATE_EPOCH, for reproducible builds?
<apteryx> e.g., if the SOURCE_DATE_EPOCH environment variable is set, Time.now would return whatever static value was set to SOURCE_DATE_EPOCH.
afisher has quit []
afisher has joined #ruby
<apteryx> the problem I'm seeing is that this date changes between builds: https://github.com/lsegal/yard/blob/main/yard.gemspec#L14
bsdband2 has joined #ruby
baojg has quit [Remote host closed the connection]
bsdbandit-01 has quit [Ping timeout: 240 seconds]
arzWZM has quit [Quit: Leaving]
baojg has joined #ruby
<adam12> apteryx: seems like it should work. What Ruby version?
<apteryx> ah, the rubygem library bundled with Ruby 2.6.5 is too old I think
<apteryx> rubygems*
<apteryx> it's at 3.0.3, and the SOURCE_DATE_EPOCH stuff appeared at 3.2.0 IIUC (https://github.com/rubygems/rubygems/commit/d830d53f59)
AlwaysInTime has joined #ruby
dputtick has quit []
dputtick has joined #ruby
<apteryx> even Ruby 2.7.1 is too old for it
arturyx has joined #ruby
arturyx has quit [Client Quit]
<adam12> heh
gajus has quit []
gajus has joined #ruby
<apteryx> ah, no, 2.7.1 has it: https://github.com/ruby/ruby/blob/v2_7_1/lib/rubygems.rb#L1239. It's just the way github associates tags with a commit that I don't get.
dfucci has joined #ruby
dviola has quit [Quit: WeeChat 2.8]
dfucci has quit [Ping timeout: 256 seconds]
<al2o3-cr> &>> require 'rubygems/package'; ENV['SOURCE_DATE_EPOCH'] = "499161600"; Gem::Specification.new('test', Math::PI) { |s| Gem::Package.new s.file_name }.date
<rubydoc> # => 1985-10-26 00:00:00 UTC (https://carc.in/#/r/9fb4)
dfucci has joined #ruby
<al2o3-cr> back to the future!
<al2o3-cr> i forgot the time i know...
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oddp_ has quit [Quit: quit]
xco has joined #ruby
<al2o3-cr> apteryx: could run into some real problems if the Time class obeyed that :P
r3my has quit []
r3my has joined #ruby
dionysus69 has quit [Quit: dionysus69]
elphe has quit [Ping timeout: 240 seconds]
mossplix_ has joined #ruby
mossplix has quit [Ping timeout: 246 seconds]
mossplix_ has quit [Ping timeout: 256 seconds]
AlwaysInTime has quit [Quit: Leaving]
arturyx has joined #ruby
arturyx has quit [Client Quit]
mossplix has joined #ruby
gix has joined #ruby
<apteryx> al2o3-cr: I see! So it works as expected already.
<al2o3-cr> apteryx: yes.
<apteryx> al2o3-cr: would there be a more common idiom for capturing the date, instead of doing https://github.com/lsegal/yard/blob/main/yard.gemspec#L14?
<apteryx> that would work with SOURCE_DATE_EPOCH (or is it simply unecessary?)
TCZ has joined #ruby
<al2o3-cr> apteryx: if the env var is set it will use it.
<al2o3-cr> SOURCE_DATE_EPOCH is always 0
<apteryx> wait, it didn't seem to work for that case in my previous experiments
* apteryx launches two fresh builds of YARD
<al2o3-cr> rubygems strictly uses SOURCE_DATE_EPOCH for that purpose.
bsdband2 has quit [Ping timeout: 272 seconds]
bsdband14 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
<al2o3-cr> since 2.4 i believe
TCZ has quit [Quit: Leaving]
<al2o3-cr> &ri source_date_epoch
<al2o3-cr> i don't know why i thought that wouldn't work
oddp has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
<adam12> For some reason I was thinking that Time was modified to support that ENV var. I must of been seeing things.
<adam12> Seems silly for it to be tho, in hindsight.
lxsameer has quit [Quit: WeeChat 2.8]
bsdband14 has quit [Quit: -a- Connection Timed Out]
<apteryx> al2o3-cr: what I'm seeing is that the package built gets the date of today
<apteryx> then if I build tomorrow it'll get the date of tomorrow. It's not reproducible.
elphe has joined #ruby
akem has quit [Quit: Leaving]
<al2o3-cr> apteryx: i've just shown that it's reproducible.
<apteryx> you are reading the date of the Gem::Specification object, not setting it though
<apteryx> I'll hack in Pry try to prove my point
<adam12> Is it because there _is_ a date set in that gemspec? I've never used the property in any personal gems.
bsdbandit-01 has joined #ruby
<al2o3-cr> adam12: it can't be @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
elphe has quit [Ping timeout: 260 seconds]
<adam12> I feel like spec.date is a private attribute and the yard gemspec is wrong.
<adam12> al2o3-cr: You have a link for that? My searching isn't bring up anything.
cnsvc has joined #ruby
konsolebox has joined #ruby
<al2o3-cr> $ Gem::Specification#date in pry if you've got pry-doc installed
<al2o3-cr> ^ adam12
<adam12> al2o3-cr: Thanks.
<apteryx> so, s being my Gem::Specification object: ENV['SOURCE_DATE_EPOCH'] = "0"; s.date -> nil; require 'time'; s.date = Time.now.strftime('%Y-%m-%d'); s.date => 2020-07-17 00:00:00 UTC;
<al2o3-cr> adam12: welcome
sh7d has quit [Ping timeout: 246 seconds]
mnathani has joined #ruby
<apteryx> this value is what gets written to file
<apteryx> in [...]specifications/yard-0.9.25.gemspec
<apteryx> so the YARD gemspec is flawed, from a reproducibility view point
<al2o3-cr> apteryx: s.date -> nil that should be 1970-01-01 00:00:00
<al2o3-cr> apteryx: i'm seeing the correct results
<apteryx> right, I mistyped that, I do get => 1970-01-01 00:00:00 UTC
<apteryx> on your side?
<apteryx> with which Ruby version?
<al2o3-cr> &>> RUBY_VERSION
<rubydoc> # => "2.7.0" (https://carc.in/#/r/9fb9)
<al2o3-cr> &>> RUBY_VERSION.succ
<rubydoc> # => "2.7.1" (https://carc.in/#/r/9fba)
<apteryx> even my ruby 2.7.1 has the behavior I described
<apteryx> s.rubygems_version = "3.0.3". What does yours say?
<al2o3-cr> apteryx: if you reassign s.date = Time.now.strf... that is not going to work.
<al2o3-cr> &>> s = Gem::Specification.new; ENV['SOURCE_DATE_EPOCH'] = "78237623"; s.date.strftime('%F')
<rubydoc> # => "1972-06-24" (https://carc.in/#/r/9fbb)
<apteryx> al2o3-cr: right, it seems to work as a read property
dfucci has quit [Ping timeout: 264 seconds]
<apteryx> but it can be overridden, like what happens in the case of the YARD gemspec file
<al2o3-cr> apteryx: did you read the link i gave you?
<al2o3-cr> apteryx: yes, it can be overridden, indeed.
sh7d has joined #ruby
<apteryx> OK, so we are in perfect agreement that the YARD gemspec file I showed you is flawed, then?
<al2o3-cr> apteryx: i'd agree, yes.
<apteryx> adam12: good link! I'll point YARD to it in the issue I'm about to open. Thank you.
<al2o3-cr> apteryx: i didn't see this: so the YARD gemspec is flawed, from a reproducibility view point
<al2o3-cr> apteryx: my bad.
<apteryx> al2o3-cr: no problem. I wasn't sure if I was being understood, eh ;-).
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr> apteryx: perfectly, and i should start reading the convo thouroughly :P
elphe has joined #ruby
<al2o3-cr> apteryx: it's friday night bro, get a beer! :)
elphe has quit [Ping timeout: 240 seconds]
kevinsjoberg has quit []
<apteryx> al2o3-cr: haha, thanks for the reminder!
kevinsjoberg has joined #ruby
lxsameer has joined #ruby
<apteryx> for the record, I've created an issue against YARD here: https://github.com/lsegal/yard/issues/1343
baojg has quit [Remote host closed the connection]
mossplix has quit [Remote host closed the connection]
uplime is now known as [
mossplix has joined #ruby
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
al2o3-cr has quit [Quit: WeeChat 2.8]
bsdbandit-01 has quit [Ping timeout: 256 seconds]
baojg has joined #ruby
drincruz has joined #ruby
bsdband12 has joined #ruby
al2o3-cr has joined #ruby
orbyt_ has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
TCZ has joined #ruby
akem has joined #ruby
greypack_1 has quit [Quit: All your IRC are belong to ZNC]
nate48423 has quit [Remote host closed the connection]
BenDover has quit [Remote host closed the connection]
sagax has quit [Quit: Konversation terminated!]
sagax has joined #ruby
mossplix has quit [Remote host closed the connection]
bvdw has quit [Quit: The Lounge - https://thelounge.chat]
coniptor has quit [Ping timeout: 240 seconds]
konsolebox has quit [Read error: Connection reset by peer]
ellcs has quit [Ping timeout: 240 seconds]
coniptor has joined #ruby
konsolebox has joined #ruby
greypack has joined #ruby
baojg has quit [Remote host closed the connection]
greypack has quit [Client Quit]
TCZ has quit [Quit: Leaving]
baojg has joined #ruby
greypack has joined #ruby
greypack has quit [Client Quit]
greypack has joined #ruby
markoong has joined #ruby
markong has quit [Ping timeout: 240 seconds]
lmat has quit [Ping timeout: 240 seconds]
TheVetDev has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc has quit [Ping timeout: 240 seconds]
konsolebox has quit [Read error: Connection reset by peer]
lmat has joined #ruby
Mia has quit [Read error: Connection reset by peer]
dviola has joined #ruby
cnsvc has joined #ruby
Mia has joined #ruby
gray_-_wolf has quit [Ping timeout: 260 seconds]
jetchisel has joined #ruby
konsolebox has joined #ruby
wymillerlinux has joined #ruby
wildtrees_ has quit [Remote host closed the connection]
ur5us has joined #ruby
wildtrees_ has joined #ruby
SeepingN has joined #ruby
wildtrees_ has quit [Max SendQ exceeded]
imode has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 256 seconds]
ChmEarl has quit [Quit: Leaving]
orbyt_ has joined #ruby
wymillerlinux has quit [Read error: Connection reset by peer]
drincruz has quit [Ping timeout: 260 seconds]
xMopx is now known as XmopX
oneeggeach has joined #ruby
Esa__ has quit []
mnathani has quit []
cnsvc has quit [Remote host closed the connection]
cnsvc has joined #ruby
alexherbo2 has quit [Ping timeout: 240 seconds]