<leftylink>
okay, that should make abundantly clear that it's nil
<weaksauc_>
that's answering the wrong question though
<weaksauc_>
it depends on what a is
<weaksauc_>
pandabot rb [].all? {}
<weaksauc_>
pandabot: rb [].all? {}
<weaksauc_>
# => true
<weaksauc_>
[1].all? {} # => false
<leftylink>
I thought the question was only about what an empty block evaluates to. the behaviour of #all? was not in question. did I misunderstand the question?
<leftylink>
(which is very possible, since I'm not a native speaker, so I apologise for any misunderstandings that result)
<johnjaye>
i discovered the question while testing all? and none?
<weaksauc_>
i guess it is the same answer just in a different way
<johnjaye>
i didn't realize {} was valid
<leftylink>
just as we can have functions with empty bodies, we can have blocks with empty bodies
<johnjaye>
rb [].all?
<johnjaye>
pandabot: rb [].all?
<weaksauc_>
there was a post about python and the issue of which should be returned if there are no entries in a list
<johnjaye>
weaksauc_: ruby ignores the block completely for empty objects by the way
c10l has joined #ruby
<weaksauc_>
wouldn't surprise me
<leftylink>
well that makes sense, right? if the behavior is to pass each element to the block, and there is no element to pass, there is no valid way to call the block
<johnjaye>
as i understand it. it checks for empty block. then for an argument. only then does it process the block
<leftylink>
it doesn't need to "check for empty block"
<leftylink>
an empty block is handled just like any other block - by calling it
<johnjaye>
sorry. i meant an empty object
<johnjaye>
anyway thanks. i was confused that { |x| } was valid syntactically as well as {}
<weaksauc_>
well it's c leftylink so it's a little more explicit and yes it checks the length before doing it
<johnjaye>
if you try to give it a block and an argument it warns you it's ignoring the block
<leftylink>
this is not meant to be taken as a negative statement about anyone's school, only an acknowledgement that I know that I am a product of my environment, and so is what I find odd and not odd
<ox1eef_>
Worth noting as well that an empty array can't invoke its block since there is nothing to invoke it with.
<ox1eef_>
So it goes back to what leftylink said.
<leftylink>
maybe I'm just too used to thinking of it in terms of the types. like if all? has type (a -> Bool) -> [a] -> Bool, then if you have no a, then what could we possibly call the (a -> Bool) with?
<ox1eef_>
Very little in Ruby is just syntax. That's Range%.
<ox1eef_>
Range#% *
<johnjaye>
hmm.
<johnjaye>
is there a large number of ruby 2.x installs still around
<johnjaye>
things that are strictly 3.x only might be a bit too risky to rely on
<ox1eef_>
I wouldn't worry about that. You can add required_ruby_version to your gemspec if needs be. It is better to be able to use new features than be stuck with the old.
<leftylink>
and luckily for this concern, since 2.7 reached its end of life in March of this year (we see this is true at https://www.ruby-lang.org/en/downloads/branches/), if anything is still using anything earlier than 3.0, it's a security liability and in a lot of places I've seen that's a problem so they won't do it
<leftylink>
so for places where the security is regulated they will certainly be at 3.0 or later
<ox1eef_>
This page has stats going back a year that chronicles 2.X, 3.X, etc usage: https://stats.rubygems.org/
teclator has quit [Ping timeout: 245 seconds]
<ox1eef_>
Looks either broken or abandoned. Stops in 22'.
<leftylink>
oh is that why no data shows up for me unless I select 12m?
<leftylink>
the graph is just blank if I select any other option
<ox1eef_>
Yep. There's an empty array returned for anything under 12m.
<ox1eef_>
Too bad. That's useful data.
<johnjaye>
ah it says ruby 2.2 to 2.7 was a lot more breaking changes than 2.7 to 3
<johnjaye>
interesting
<johnjaye>
also it's not as big of a problem as python2->3 either
Hammdist has quit [Quit: Client closed]
Hammdist has joined #ruby
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
swaggboi has joined #ruby
mags has quit [Ping timeout: 255 seconds]
redruM has quit [Ping timeout: 248 seconds]
_ht has quit [Quit: _ht]
grenierm has quit [Ping timeout: 246 seconds]
Hammdist has quit [Quit: Client closed]
konsolebox has joined #ruby
yisef has joined #ruby
c10l has joined #ruby
c10l has quit [Client Quit]
c10l has joined #ruby
otisolsen70 has joined #ruby
teclator has joined #ruby
yisef has quit [Ping timeout: 246 seconds]
yisef has joined #ruby
fercell has quit [Read error: Connection reset by peer]
fercell has joined #ruby
TomyWork has joined #ruby
willfish has joined #ruby
Hammdist has joined #ruby
xmachina has quit [Quit: WeeChat 4.0.4]
<konsolebox>
Dir.home might need to be shellescaped there.
konsolebox has quit [Quit: Quit]
konsolebox has joined #ruby
brokkoli_origin has quit [Quit: (Leaving)]
leon__ has joined #ruby
brokkoli_origin has joined #ruby
clemens3 has quit [Quit: WeeChat 2.7]
clemens3 has joined #ruby
hightower4 has joined #ruby
hightower3 has quit [Ping timeout: 248 seconds]
xmachina has joined #ruby
Vonter has quit [Ping timeout: 245 seconds]
Vonter has joined #ruby
donofrio has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
xmachina has quit [Quit: WeeChat 4.0.4]
u0_a115 has joined #ruby
jess has joined #ruby
hightower3 has joined #ruby
yisef has quit [Remote host closed the connection]
wakaflaka is now known as myappie
hightower4 has quit [Ping timeout: 245 seconds]
u0_a1151 has joined #ruby
u0_a115 has quit [Ping timeout: 245 seconds]
ufi has joined #ruby
u0_a1151 has quit [Ping timeout: 246 seconds]
u0_a1151 has joined #ruby
c10l has quit [Quit: See ya! o/]
u0_a1152 has joined #ruby
u0_a1151 has quit [Ping timeout: 255 seconds]
dalan038228 has quit [Quit: dalan038228]
dalan038228 has joined #ruby
u0_a1152 has quit [Ping timeout: 255 seconds]
ufi has quit [Quit: Leaving]
desnudopenguino has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
u0_a1152 has joined #ruby
taupiqueur_shiny has joined #ruby
konsolebox has quit [Ping timeout: 246 seconds]
u0_a1152 has quit [Ping timeout: 246 seconds]
Tempesta has quit [Quit: AdiIRC is updating to v4.4]
RDMengineer has quit [Read error: Connection reset by peer]
Nixkernal has quit [Client Quit]
RDMengineer has joined #ruby
Vonter has joined #ruby
u0_a1152 has joined #ruby
konsolebox_ has joined #ruby
konsolebox has quit [Ping timeout: 255 seconds]
u0_a1152 has quit [Ping timeout: 246 seconds]
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 240 seconds]
graywolf has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
yosef` has quit [Ping timeout: 246 seconds]
taupiqueur_shiny has joined #ruby
u0_a1152 has joined #ruby
konsolebox_ has quit [Quit: Leaving]
u0_a1152 has quit [Ping timeout: 255 seconds]
konsolebox has joined #ruby
u0_a1152 has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
u0_a1152 has quit [Ping timeout: 246 seconds]
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 244 seconds]
taupiqueur_shiny has joined #ruby
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 255 seconds]
u0_a1152 has joined #ruby
Pixi has quit [Ping timeout: 248 seconds]
u0_a1152 has quit [Ping timeout: 245 seconds]
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 246 seconds]
eddof13 has joined #ruby
Vonter has quit [Ping timeout: 258 seconds]
Vonter has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
Vonter has quit [Ping timeout: 245 seconds]
Vonter has joined #ruby
desnudopenguino has joined #ruby
<adam12>
johnjaye: Matz (Ruby BDFL) specifically wanted to avoid a Python 2 -> 3 scenario.
<adam12>
johnjaye: In fairness, Ruby had one of those already, going from 1.8 to 1.9.
<johnjaye>
it says in 1.9 strings didn't support each.
Vonter has quit [Ping timeout: 248 seconds]
yosef` has joined #ruby
c10l has joined #ruby
Vonter has joined #ruby
be1m0nt has quit [Quit: WeeChat 3.8]
yosef` has quit [Ping timeout: 246 seconds]
u0_a1152 has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
<ox1eef_>
In 1.8 each could be used on a string to iterate over it char by char. These days you would use str.chars.each { } instead.
<ox1eef_>
Byte by byte would be more accurate, I think.
Pixi has joined #ruby
u0_a1152 has quit [Ping timeout: 246 seconds]
u0_a1152 has joined #ruby
taupiqueur_shiny has joined #ruby
_ht has joined #ruby
polishdub has joined #ruby
TomyWork has quit [Remote host closed the connection]
u0_a1152 has quit [Ping timeout: 250 seconds]
ixti has joined #ruby
caedmon has joined #ruby
Hammdist has quit [Quit: Client closed]
taupiqueur_shiny has quit [Remote host closed the connection]
<johnjaye>
another oddity. by looking at the source code I can see Array.map and Array.collect are synonyms
<johnjaye>
but the documentation from help doesn't mention this at all
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
taupiqueur_shiny has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
Hammdist has joined #ruby
taupiqueur_shiny has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
rvalue has quit [Ping timeout: 246 seconds]
neshpion has joined #ruby
rvalue has joined #ruby
ufi has joined #ruby
Vonter has quit [Ping timeout: 245 seconds]
ufi has quit [Client Quit]
<adam12>
johnjaye: It's in there in my version of Ruby (twice actually, maybe a bug?)
<adam12>
Array#collect is an alias for Array#map.
<adam12>
(This method is an alias for Array#collect.)
<ox1eef_>
Mine too. Btw, I recommend this notation: "Array#map" for instance methods and "Array::new" (or Array.new) for class methods. It has been used in Ruby for ions, and is generally understood.
willfish has quit [Ping timeout: 246 seconds]
otisolsen70_ has joined #ruby
otisolsen70 has quit [Ping timeout: 248 seconds]
u0_a1152 has joined #ruby
Tempesta has quit [*.net *.split]
Tempesta has joined #ruby
<johnjaye>
it says "see also"
<johnjaye>
maybe the debian help install is just borked somehow
taupiqueur_shiny has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
otisolsen70_ has quit [Quit: Leaving]
otisolsen70 has joined #ruby
<ox1eef_>
Last line: Array#collect is an alias for Array#map.
gr33n7007h has quit [Ping timeout: 245 seconds]
ule has joined #ruby
<ule>
Hi there, do you know how can I convert a Ruby BigDecimal to float preserving its scale? (In this case I want 8):
gr33n7007h has joined #ruby
<ule>
BigDecimal("92474213.83647799").to_f
<ule>
=> 92474213.836478
<ule>
What can I do to get a Float exactly as I see in the string part? with .83647799 ?
gr33n7007h has quit [Ping timeout: 255 seconds]
rvalue has quit [Read error: Connection reset by peer]
<leftylink>
there is, of course, no float in existence that exactly represents the value 92474213.83647799, so the part of the question about "preserving its scale" is unanswerable
konsolebox has quit [Quit: Quit]
gr33n7007h has joined #ruby
<leftylink>
this is why I switched to using rationals instead of foats in all my dealings with numbers
u0_a1152 has quit [Ping timeout: 250 seconds]
polishdub has quit [Ping timeout: 245 seconds]
redruM has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
<ule>
leftylink: how do you store the rationals instead float?
otisolsen70 has quit [Quit: Leaving]
<ule>
adam12: I need to pass that to an API and the vendor requires a number instead of String
ixti has quit [Ping timeout: 255 seconds]
hightower3 has joined #ruby
<adam12>
ule: Float's are inheritently inaccurate and not incredibly precise. I am not sure you'll be able to get what you want.
c10l has joined #ruby
<adam12>
ule: I'd tell the vendor to accept a String if it requires accuracy. Or ask them why they chose a Float.
<ule>
adam12: whats what I want to do as well lol
<adam12>
ule: lol. really tho, you're being asked to work with a pile of crap :\
hightower2 has quit [Ping timeout: 246 seconds]
<adam12>
What kind of number is it, out of curiosity? lat/lng?
<adam12>
Actually, that's likely too big for lat/lng.
<ule>
It is cryptocurency things
<adam12>
Ugh. Naturally.
<adam12>
I bet they'll add them all up and get errors.
<adam12>
It's the Office Space worm in the real world.
<ule>
The thing is, the vendor uses C# on their systems, so I expect they handle all this better than my crappy Ruby
<petru>
Doesn't ruby have something like BigDecimal?
<ule>
it is, and thats what I'm using, the issue is that how can I pass BigDecimal via API? We can't, it needs to be either float, boolean, string, etc
<petru>
Oh, I see
<petru>
Probably string would be best
<redruM>
How could I prevent puts from echoing variable content in a new line?
<ule>
Yeah, I'll try to move forward in that idea
<adam12>
redruM: print
_ht has quit [Quit: _ht]
<redruM>
adam12: Yeah, I've tried that but after the variable the rest of the content is on the next line.
<adam12>
redruM: example code
<redruM>
adam12: Here in irc?
<adam12>
redruM: if it's more than a few lines, paste it to gist.github.com or similar.
<redruM>
adam12: print "Pulling Iosevka v#{release_version} fonts from the Github repository release..."
<adam12>
redruM: Maybe new line in output? try `#{release_version.chomp}`
<adam12>
or add `.chomp` to end of `release_version = ` assignment line.
<redruM>
adam12: That was it, thank you!
<adam12>
(2nd version is better but do either for now to eliminate new line)
<adam12>
Nice.
taupiqueur_shiny has quit [Remote host closed the connection]
eddof13 has joined #ruby
taupiqueur_shiny has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1!crespire@user/crespire))]
crespire has joined #ruby
crespire1 has quit [Ping timeout: 245 seconds]
gr33n7007h has quit [Read error: Connection reset by peer]
u0_a1152 has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
infinityfye has quit [Quit: Leaving]
johnjaye has quit [Ping timeout: 248 seconds]
johnjaye has joined #ruby
<johnjaye>
i'm having trouble following this command for the ruby debugger
<johnjaye>
i don't seem to have rdbg anywhere but i can require 'debug'. but it says info is not a recognized command
<johnjaye>
ok i can set breakpoint with 'b' command
<johnjaye>
hmm
teclator has quit [Ping timeout: 248 seconds]
<johnjaye>
the instructions here say to use binding.break but that gives an error that break is not defined. https://github.com/ruby/debug
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
eddof13 has joined #ruby
willfish has quit [Ping timeout: 246 seconds]
<weaksauc_>
you might be running an older version of it?
<leftylink>
that's really funny. debug is outright broken in my install of Ruby (as in, require 'debug' results in NoMethodError), so obviously nobody ever thought to test that it works
<leftylink>
yes, a NoMethodError, not a LoadError
teclator has joined #ruby
<leftylink>
I can of course solve the NoMethodError by defining the nonexistent thing, but come on.
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
thelounge18 has quit [Remote host closed the connection]
mahlon has quit [Quit: PotatoTech]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mahlon has joined #ruby
<johnjaye>
well i have 2.7 on my system sure. but i didn't think debug was that old
<johnjaye>
let me try that local install of ruby that someone recommended earlier
<johnjaye>
maybe i can somehow require debug or something from there
<johnjaye>
well at least i can set breakpoints and continue
<johnjaye>
so there's that
neshpion has quit [Quit: neshpion]
<adam12>
johnjaye: debug has shipped with Ruby for a decade or more, it's just that the original debug had some issues.
<adam12>
You can always try to install the gem manually/in your Gemfile to get latest version.
<johnjaye>
it said it updated to debug 1.8
<johnjaye>
but i still don't have 'info' which the github readme said i should
<johnjaye>
i'm not even sure what is the variable to check the loaded version of a geM?
<johnjaye>
i'm running it with ruby -rdebug file.rb by the way
<johnjaye>
ah ok now i do have the info command using the local 3.3
<johnjaye>
so some kind of changes must have happened to debug between when ruby 2.7 was built and packaged and the present
<johnjaye>
however ruby -rdebug <filename> no longer activates the debugger i have to use bin/rdbg to do that