<leftylink>
I wonder if I ask a stupid qusetion and it is seen as insulting like "of course I thought of that, you insult me by even suggesting that I might not have considered that"
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leftylink>
so I notice in that task newegg: :environment, there are a few functions being defined, but nothing is going to call those functions. maybe it is just because I don't konw rake and rake is going to call one of the functions automatically. that's why it's a stupid question
siaw23 has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
kotrcka has joined #ruby
silverdust has joined #ruby
<cloud69>
idk. but this rake task from another of my apps works, although its json
<leftylink>
well, if it is not known whether rake will automatically call any of the functions that have at that point been defined (and although I don't know rake, it would be a big surprise to me if it did), then it seems that the safest course of action would then to be call one of them.
<cloud69>
excellent, ill get right on it! =)
silverdust has quit [Ping timeout: 256 seconds]
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zacts has quit [Quit: leaving]
kotrcka has quit [Remote host closed the connection]
akem has joined #ruby
tcrypt has joined #ruby
openstruct has quit [Ping timeout: 260 seconds]
orbyt_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rudd0 has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
<nakilon>
I wonder if moment.js can parse the Time#to_s output
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
cthulchu_ has quit [Ping timeout: 260 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
woodruffw has quit [Ping timeout: 260 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
woodruffw has joined #ruby
woodruffw has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 260 seconds]
ChmEarl has quit [Quit: Leaving]
phenom has quit [Ping timeout: 246 seconds]
phenom has joined #ruby
Mrgoose9 has joined #ruby
arahael has left #ruby ["WeeChat 2.7.1"]
Mrgoose9 is now known as Mrgoose
tsujp has quit [Ping timeout: 264 seconds]
tsujp has joined #ruby
bamdad has quit [Ping timeout: 240 seconds]
Mrgoose0 has joined #ruby
baojg has quit [Remote host closed the connection]
Mrgoose has quit [Ping timeout: 240 seconds]
Mrgoose0 is now known as Mrgoose
baojg has joined #ruby
axe has quit [Ping timeout: 256 seconds]
cd has quit [Quit: cd]
emptyflask has quit [Ping timeout: 256 seconds]
arcaos has quit [Quit: Leaving]
bocaneri has joined #ruby
camilasan has quit [Ping timeout: 264 seconds]
camilasan has joined #ruby
Axy has joined #ruby
Mia has quit [Ping timeout: 260 seconds]
cloud69 has quit [Quit: Connection closed for inactivity]
silverdust has joined #ruby
vondruch has joined #ruby
camilasan has quit [Ping timeout: 260 seconds]
burgestrand has joined #ruby
vondruch has quit [Client Quit]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
cloud69 has joined #ruby
Retropikzel has joined #ruby
Glumetu has joined #ruby
vondruch has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
plant_enjoyer has joined #ruby
Axy has quit [Ping timeout: 272 seconds]
fippy has quit [Quit: Leaving]
Axy has joined #ruby
Axy has quit [Changing host]
Axy has joined #ruby
Mia has quit [Ping timeout: 264 seconds]
akem_ has quit [Remote host closed the connection]
braincrash has joined #ruby
Mia has joined #ruby
Axy has quit [Ping timeout: 264 seconds]
ur5us_ has joined #ruby
apoc has quit [Ping timeout: 256 seconds]
VicMackey has joined #ruby
mjacob has quit [Remote host closed the connection]
braincrash has quit [Ping timeout: 272 seconds]
bamdad has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
apoc has joined #ruby
dionysus69 has joined #ruby
ruurd has quit [Quit: bye folks]
siaw23 has joined #ruby
Axy has joined #ruby
Axy has joined #ruby
Mia has quit [Read error: Connection reset by peer]
howdoi has quit [Quit: Connection closed for inactivity]
braincrash has joined #ruby
fippy has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Axy has quit [Ping timeout: 260 seconds]
ur5us_ has quit [Ping timeout: 260 seconds]
clinth has quit [Ping timeout: 272 seconds]
ec has quit [Ping timeout: 264 seconds]
jhill has quit [Ping timeout: 264 seconds]
afisher has quit [Ping timeout: 244 seconds]
englishm has quit [Read error: Connection reset by peer]
Lewix has quit [Read error: Connection reset by peer]
CustosLimen has quit [Read error: Connection reset by peer]
Lewix has joined #ruby
manveru has quit [Ping timeout: 272 seconds]
r3my has quit [Read error: Connection reset by peer]
kozowu has quit [Ping timeout: 260 seconds]
CustosLimen has joined #ruby
r3my has joined #ruby
ec has joined #ruby
jhill has joined #ruby
clinth has joined #ruby
englishm has joined #ruby
afisher has joined #ruby
kevinsjoberg has quit [Ping timeout: 272 seconds]
manveru has joined #ruby
kozowu has joined #ruby
kevinsjoberg has joined #ruby
Mia has quit [Read error: No route to host]
Mia has joined #ruby
Mia has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 258 seconds]
charrit69 has joined #ruby
<leftylink>
hmm, just wanted to express my appreciation that `9.times.map { |x| ->y { x + y } }.map { |f| f[0] }` works as advertised
<leftylink>
&>> 9.times.map { |x| ->y { x + y } }.map { |f| f[0] }
<leftylink>
you don't get that in all languages.. try `fs = [lambda x: x + y for y in range(10)]; [f(0) for f in fs]` in another certain language, for example
Axy has joined #ruby
Mia has quit [Read error: Connection reset by peer]
openstruct has joined #ruby
infinityfye has joined #ruby
openstruct has quit [Ping timeout: 272 seconds]
Axy has quit [Ping timeout: 260 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
bsdbandit-01 has joined #ruby
Milos has quit [Ping timeout: 260 seconds]
<leftylink>
now they're going to think I was specifically insulting the other language
<leftylink>
and they'll use this against me when I run for political office
<leftylink>
it was just the example that was most available to me at the time and easiest to test. please don't read too far into it
TCZ has joined #ruby
greengriminal has joined #ruby
Milos has joined #ruby
bsdband38 has joined #ruby
<leftylink>
maybe they would think it less unfair if I also gave an example in a different language. then it wouldn't be one particular language that I was picking on
<leftylink>
which is why I have now prepared this one
<leftylink>
package main; import "fmt"; func main() { fs := make([]func(int) int, 10); for i := 0; i < 10; i++ { fs[i] = func(x int) int{ return x + i } }; for _, f := range fs { fmt.Print(f(0)) } }
imode has quit [Ping timeout: 240 seconds]
bsdbandit-01 has quit [Ping timeout: 260 seconds]
<leftylink>
at some point I changed the 9 to a 10, but that obviously is not the important part of the problem
Mia has joined #ruby
bsdband38 has quit [Read error: Connection reset by peer]
bsdbandit-01 has joined #ruby
Glumetu has quit [Quit: Glumetu]
Glumetu has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
maleghast has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
vondruch has joined #ruby
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
braincrash has quit [Ping timeout: 265 seconds]
October has joined #ruby
bambanx has joined #ruby
vondruch has quit [Ping timeout: 264 seconds]
vondruch has joined #ruby
VicMackey has quit [Ping timeout: 258 seconds]
cloud69 has quit [Quit: Connection closed for inactivity]
fercell has joined #ruby
<leah2>
why does bundle update tell me i have merge conflicts in the .lock file? it regenerates it anyway no
bsdbandit-01 has quit [Read error: Connection reset by peer]
charrit69 has quit [Ping timeout: 260 seconds]
bmurt has joined #ruby
Rudd0 has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
cloud69 has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
dionysus69 has joined #ruby
stryek has joined #ruby
CommunistWolf is now known as slime-mold
slime-mold is now known as CommunistWolf
October has quit [Quit: leaving]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
axe has joined #ruby
dionysus70 has joined #ruby
<adam12>
leah2: It uses it as a base line.
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
howdoi has joined #ruby
charrit69 has joined #ruby
burgestrand has quit [Quit: burgestrand]
plant_enjoyer has quit [Quit: Leaving]
nevans has joined #ruby
elcontrastador has joined #ruby
charrit69 has quit [Ping timeout: 240 seconds]
charrit69 has joined #ruby
<leah2>
are you saying rm Gemfile.lock && bundle install results in something different than bundle update ?
tcrypt has quit [Read error: Connection reset by peer]
MadLamb has joined #ruby
dionysus70 has quit [Ping timeout: 272 seconds]
<MadLamb>
How can I get a json from a ActiveRecord model while mapping to a different structure? Model.find(id).map is giving me "undefined method map".
<adam12>
leah2: Yes there's a good chance of that.
ChmEarl has joined #ruby
<adam12>
MadLamb: Model.find(id) returns a single instance, and #map is generally called on an Enumerable collection.
<adam12>
MadLamb: if just calling `to_json` doesn't work for you, you might need to build your own Hash then call to_json on that.
<adam12>
MadLamb: I don't do Rails anymore so maybe someone has a more "Railsly" way of doing it.
<MadLamb>
adam12, hmm. In the end I need a json with a different structure
burgestrand has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<MadLamb>
adam12, calling map is not really a requirement
Emmanuel_Chanel has quit [Ping timeout: 256 seconds]
<burgestrand>
Huh, yeah, no mention of why it's little endian https://bugs.ruby-lang.org/issues/12447 — ah well, what's surprising to me is obvious to somebody else :)
<proc>
got a strange but where the command "bundler" works fine, but the command "bundle" shows a command not found error. was working before, haven't changed anything
<proc>
using rbenv (ran their health check script, seems to say all is okay)
<proc>
any ideas?
<nakilon>
this colorful irb of 2.7 is buggy
<nakilon>
it eats the last character on the line in macOS Terminal
chouhoulis has joined #ruby
lanky_leguan has quit [Quit: pro quo]
burgestrand has quit [Quit: burgestrand]
<proc>
ah fixed, the rbenv rehash was stuck, apparently
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charrit69 has quit [Quit: Konversation terminated!]
baojg has quit [Remote host closed the connection]
orbyt_ has joined #ruby
baojg has joined #ruby
adaedra has joined #ruby
<adaedra>
hi
<jhass>
hey, long time no see again :)
<adaedra>
indeed
TCZ has quit [Quit: Leaving]
<jhass>
how's it going?
<adaedra>
it's going
<jhass>
better than not!
TomyWork has joined #ruby
<adaedra>
indeed
<adaedra>
what about you?
<jhass>
not bad, switching jobs end of year :)
zacts has joined #ruby
<jhass>
no more android, all ruby <3
<adaedra>
ooh
<adaedra>
hope it goes well for you
<jhass>
me too :D
<adaedra>
Looking for one myself, but Corona is making things hard
<jhass>
maybe someone here has some hints :) I can recommend you to anybody fwiw :D
<adaedra>
that's very nice of you
mjacob has joined #ruby
chamunks has quit [Quit: Don't worry I'm not gone yet.]
gix has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
Eiam has joined #ruby
<mjacob>
is there a library to define "data classes" in a way that doesn't require inheriting from some class (including a module is okay), supports making the objects "immutable", and automatically makes the objects hashable?
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
other than immutable, Struct strikes off that list pretty well
<jhass>
so if you were to call .freeze on the new objects manually or by overriding initialize, it's also immutable
<mjacob>
jhass: i forgot one requirement: it should not default missing parameters to nil
rubydoc has quit [Ping timeout: 256 seconds]
<jhass>
mmh, then I'm out :D
phaul has quit [Ping timeout: 246 seconds]
<adam12>
Could probably build something with adamantium and equalizer gems, but in reality I'd _personally_ just use dry-struct.
<jhass>
^
<mjacob>
with Struct i also have the problem that there seems to be no way to make it work in a subclass of another class
burgestrand has joined #ruby
<jhass>
or I mean handroll your own Struct/dry-struct like thing, it's not that complicated
burgestrand has quit [Client Quit]
phaul has joined #ruby
<mjacob>
adam12: dry-struct looks mostly good, but there seems to be no way to use it without subclassing something
<adam12>
mjacob: Right; it's probably the only thing on your list that it doesn't meet.
rubydoc has joined #ruby
<adam12>
mjacob: There's others if you look. I think Tom Dalling has one called ValueSemantics.
tcrypt has joined #ruby
<adam12>
mjacob: What's the opposition of inheritance? Trying to prefer composition of some sort?
chamunks has joined #ruby
<mjacob>
adam12: a minor annoyance is the extra class in the inheritance hierachy. a bigger issue is that having to inherit makes it impossible to use it with something that already has to inherit from something
silverdust has quit [Ping timeout: 272 seconds]
<mjacob>
adam12: ValueSemantics seems very close to what i want, thank y ou
<adam12>
mjacob: yw
TomyWork has quit [Quit: Leaving]
Eiam has quit [Read error: Connection reset by peer]
Eiam has joined #ruby
maleghast has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Read error: Connection reset by peer]
zacts has quit [Quit: leaving]
greengriminal has quit [Quit: Leaving]
kristian_on_linu has joined #ruby
bocaneri has quit [Remote host closed the connection]
emptyflask has quit [Ping timeout: 256 seconds]
emptyflask has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has joined #ruby
imode has joined #ruby
TCZ has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 256 seconds]
rubydoc has quit [Ping timeout: 256 seconds]
phaul has joined #ruby
rubydoc has joined #ruby
rippa has joined #ruby
<riceandbeans>
is rescue nil functionally the same as just rescue
baojg has quit [Remote host closed the connection]
<jhass>
just rescue is a syntax error, no?
<adam12>
riceandbeans: you're comparing a rescue modifier vs a rescue block?
baojg has joined #ruby
<adam12>
riceandbeans: ie. something rescue nil vs begin; rescue; end
<havenwood>
riceandbeans: Do you actually care if #meth returns `nil` versus `false`?
<riceandbeans>
I just think some of this stuff looks really weird.
<riceandbeans>
I'm just looking at another team's code and making sad faces
<havenwood>
riceandbeans: !!bar&.meth
<havenwood>
Exceptions should be exceptional cases. They're not nice for flow control.
<adam12>
riceandbeans: true/false as return values in a ternary are often unnecessary, since you can just negate the conditional if necessary (or return the conditional if not necessaray).
<adam12>
No mental gymnastics required.
<havenwood>
riceandbeans: Which just makes it: bar&.meth
<adam12>
The only question is whether bar can be nil. My guess is either that's the case or bar.meth is flakey and they'd rather just eat errors silently.
<riceandbeans>
That sounds unfortunate
<riceandbeans>
But why bar&.meth instead of bar.meth.nil?
<adam12>
riceandbeans: This is the problem with the rescue modifier. There's no indication why it's there. Does meth fail? is bar sometimes nil?
<adam12>
riceandbeans: In theory, bar.meth.nil? is fine, but nil.meth.nil? is NoMethodError.
<adam12>
so bar&.meth.nil? get's you that nil safety.
vondruch has joined #ruby
<adam12>
That said, I'd rather guard on bar being nil somewhere else maybe, but you work with what you have.
<riceandbeans>
Yeah I'd rather deal with meth's response there and bar's problems where bar is created
<riceandbeans>
What would be the most Ruby way to say, if foo == bar || foo == baz
silverdust has quit [Ping timeout: 265 seconds]
<leftylink>
I believe if foo == bar || foo == baz is the most Ruby way to say it. the alternative soem would consider is [bar, baz].include?(foo), but this doesn't seem useful unless there are more elements in that array
<nakilon>
does Ruby 3.0 provide any better form of: .find{ |_| not _.empty? }
TCZ has quit [Quit: Leaving]
<balo>
nakilon: .find(&:any?) ?
<leftylink>
if we are guaranteed the list doesn't contain a nil or a false, we could already do find(&:any?), but I don't like it because I don't like it when people assume that #any? is the opposite of #empty?
<leftylink>
oh... beaten to the punch
<leftylink>
dang
<havenwood>
nakilon: balo's suggestion is good for any modern Ruby
rubydoc has joined #ruby
<balo>
[nil].any? => false , just like [nil].empty?
<balo>
ahh, okay, got it now
<balo>
yeah, leftylink is right, could be tricky
<leftylink>
probably the way to go here is to refine an #nonempty? onto an array, or refine find_not onto enumerable
<havenwood>
Then again, are you really wanting to check if there are nils in a collection?
<havenwood>
Probably something more substantive. Probably.
<nakilon>
why not
<havenwood>
nakilon: You can. Just most often aren't.
<nakilon>
empty collection and collection with nils are definitely different things
<nakilon>
idk where you take this "most often" from )
<leftylink>
there's also lazy.reject(&:empty?).first, but how unfortunate that we have to add lazy and first just to get this
baojg has quit [Remote host closed the connection]
<nakilon>
ah, I see your point, the .empty? on nil would cause exception
<havenwood>
nakilon: The "most often" is from it most often being the case that there aren't Arrays of nils and falses when checking for emptiness.
<havenwood>
There are rarely, but not usually.
<leftylink>
oh right, the video I wan't isn't searchable by normal methods... I was going to reference the "correct! nil! wat?" video
baojg has joined #ruby
phaul has joined #ruby
<nakilon>
any? will just do more work
<nakilon>
I don't want to check the content on falseness, I want to ask the array whether it's empty or not
<havenwood>
nakilon: find { !_1.empty? }
<nakilon>
omg
<havenwood>
nakilon: ;)
<havenwood>
!_1 looks like a coffee cup
<havenwood>
or something
<havenwood>
a train depot?
<nakilon>
now imagine code with { |_| and { !_1 everywhere
<nakilon>
like a pain for someone with weak eyes
<leftylink>
it's too bad. making _ unassignable would deal with some problems, but then irb would have to do some unusual things
<leftylink>
I would have liked to make _ unassignable-to, really, but not my choice to make
rubydoc has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 256 seconds]
<havenwood>
nakilon: syntax highlighting to the rescue
<nakilon>
idk how _1, _2, _3 can be considered fine in the same time with _ to be not
<leftylink>
ideally they should all have been unassignable-to as well
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leftylink>
again another time where it's too bad I don't get to make the decisions
phaul has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
rubydoc has joined #ruby
<havenwood>
just use ‗
<havenwood>
&>> ‗1 = :phew
<leftylink>
maybe it's time to make my new language
<havenwood>
leftylink: Just make a "precompiler" for Ruby.
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
rubydoc has joined #ruby
Iarfen has quit [Remote host closed the connection]
<cloud69>
At line 40 of my Newegg scraper: https://pastebin.com/FQUdwiA6 - how come `products_list << page` doesn't write anything to `products_list` despite `page` not being empty?
<cloud69>
Wait nevermind.
phaul has joined #ruby
<cloud69>
pretty cool scraper tho amiright? :)
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]