jhass changed the topic of #ruby to: Welcome new users migrating from #ruby-lang! || Rules & more: http://ruby-community.com || Ruby 2.2.2; 2.1.6; 2.0.0-p645: https://ruby-lang.org || Paste >3 lines of text on https://gist.github.com || log @ http://irclog.whitequark.org/ruby/
Respek has quit [Read error: Connection reset by peer]
WillAmes has joined #ruby
towski_ has quit [Remote host closed the connection]
marciotex has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea> [7.bin, 7.bin(false), 7.bin(true)] => ['111', '0b111', '0B111']
<Ox0dea> Is good API?
RegulationD has quit [Remote host closed the connection]
<drbrain> Ox0dea: I don't think so, I don't know what false or true mean
<drbrain> that both false and true cause the binary marker to appear is confusing
<drbrain> Ox0dea: I think using keyword arguments would be better
swills has joined #ruby
<drbrain> marker: :upcase or marker: :downcase
<Ox0dea> There aren't many core methods which take keyword arguments.
<drbrain> I don't know why that would stop you
<Ox0dea> Consistency, if nothing else.
shevy has quit [Ping timeout: 252 seconds]
NeverDie has joined #ruby
<drbrain> open, system, Process.spawn all do
rbennacer has joined #ruby
<drbrain> Integer#upto
rbennacer has quit [Remote host closed the connection]
x1337807x has joined #ruby
bentanweihao has quit [Remote host closed the connection]
<drbrain> and that's without looking at the documentation
<Ox0dea> Which version of Ruby gives Integer#upto a keyword argument?
sevenseacat has joined #ruby
doctorly has joined #ruby
<drbrain> if you want to base it off of "what core methods do" then "use true/false/nil for three-state logic" is something none of them do
<drbrain> 2.2 does
datanoise has quit [Ping timeout: 276 seconds]
NeverDie_ has quit [Ping timeout: 246 seconds]
spider-mario has quit [Remote host closed the connection]
<dfockler> Ox0dea: just read the method call out of syntax and see if you can tell what it's doing
<Ox0dea> >> [RUBY_VERSION, Integer.instance_method(:upto).arity]
<ruboto> Ox0dea # => ["2.2.0", 1] (https://eval.in/386506)
<dfockler> 7.bin(true), doesn't indicate what the true is doing
<drbrain> Ox0dea: sorry, it's step, not upto
bkxd has joined #ruby
pietr0 has quit [Ping timeout: 256 seconds]
<Ox0dea> `7.bin(prefix: :uppercase)` is almost humorously verbose.
<dfockler> 7.bin.prefix isn't that bad
<drbrain>
<Ox0dea> What should String#prefix do in other contexts?
bronson has quit [Remote host closed the connection]
<dfockler> maybe the bin method doesn't return a string
cytoskeletor has joined #ruby
<dfockler> because it has state
fabrice31 has joined #ruby
<drbrain> when I'm unfamiliar with what a method does, the more verbose its calling structure is the more likely I can guess what it does without spending 5 minutes looking up its API
shinnya has quit [Ping timeout: 248 seconds]
<Ox0dea> dfockler: That '111'.bin => 7 would seem to suggest that 7.bin should => '111'.
devdazed has joined #ruby
<Ox0dea> But '0b111'.bin also => 7, and being able to round-trip seems like a Good Thing.
<dfockler> >> '0b01001'.upcase
<ruboto> dfockler # => "0B01001" (https://eval.in/386507)
<dfockler> so if you are returning a string then you don't need to worry if it's uppercase or not
<Ox0dea> I should perhaps have specified that I intend to submit a proposal that Numeric#bin/#hex/#oct be added to core.
<Ox0dea> I'd like the methods to do "the Ruby thing" as much as possible.
tvw has quit []
<baweaver> Honestly I prefer humorously verbose to Perl / Haskell
<drbrain> Ox0dea: it's probably easier to get the addition of prefix: for #to_s accepted than three new methods
fabrice31 has quit [Ping timeout: 276 seconds]
<dfockler> >> 9.to_s(2)
<ruboto> dfockler # => "1001" (https://eval.in/386509)
<baweaver> xs, ys, $?, $!
shevy has joined #ruby
<dfockler> 9.to_s(2) <- That doesn't make a whole lot sense
<baweaver> alo shevy
choke has joined #ruby
cytoskeletor has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dorei> dfockler: why not?
<dorei> >>"1001".to_i(2)
<ruboto> dorei # => 9 (https://eval.in/386510)
drewo has quit [Quit: WeeChat 1.2]
malconis has joined #ruby
<dfockler> because it's a string instead of a number
malconis has quit [Remote host closed the connection]
dfockler has quit [Remote host closed the connection]
arooni-mobile has quit [Ping timeout: 256 seconds]
cade has joined #ruby
dented42 has joined #ruby
<baweaver> yeah, radix is a bit more vague on strings
malconis has joined #ruby
cade is now known as cantu4
choke has quit [Client Quit]
choke has joined #ruby
<baweaver> I'd prefer 9.bin.to_s
<drbrain> use Integer instead of to_i unless you know your input is a valid number
rushed has joined #ruby
<drbrain> or, I suppose, know -> is supposed to be
<dorei> changing a radix doesnt change the number, only its representation, in this case it's string representation
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<baweaver> cantu4: group_by is a thing
robustus has quit [Ping timeout: 255 seconds]
<doctorly> I am trying to figure out how to get a scroll bar on a nested slot in green shoes, but every time I try to add one, it is added to the parent slot. Does anyone know why? Or does anyone have an example app I can examine?
bkxd has quit [Ping timeout: 265 seconds]
<jfarmer> baweaver What would 9.bin return?
<baweaver> see above
<Ox0dea> For what it's worth, Big/Fixnum#to_s and String#to_i have perfectly logical and consistent APIs.
gambl0re has quit [Ping timeout: 250 seconds]
<drbrain> I don't think I need even A fingers to count the number of times I've needed to use even to_i with a base in the last year
<cantu4> baweaver: ok but how would I use it here?
<baweaver> you have response[:choice]
_blizzy_ has joined #ruby
<jfarmer> baweaver I did; unless it's _wayyy_ up there.
<Ox0dea> drbrain: Adding an optional prefix to #to_s for the sake of only three radixes doesn't seem reasonable.
<baweaver> that
<baweaver> which you're checking its value
<baweaver> also, detect is find is one result
<baweaver> This looks like Rails though
<drbrain> Ox0dea: you'll see the argument of "who will use this?" for the addition of bin/hex/oct, so you will need to establish that people need to use it often
robustus has joined #ruby
balazs has joined #ruby
<drbrain> ↑ so you know how to best present your propsal
<Ox0dea> Sure, that makes sense.
<zenspider> I to_s(16) often enough... but only because I'm lazy
<Ox0dea> zenspider: And would you rather hex? :)
<zenspider> but to_i(base)? almost never
<cantu4> baweaver: could you do some example code? Not fully understanding
rubie has joined #ruby
<zenspider> Ox0dea: not really.
<zenspider> he says, mistyping 0x0dea again and again
mikecmpbll has quit [Quit: i've nodded off.]
d5sx43 has joined #ruby
<baweaver> cantu4: What you'd want to do is something like: responses.map { |r| r[:choice] }.group_by(&:itself).map { |k,v| [k, v.size] }.to_h
<baweaver> well, that first map is unnecessary
<zenspider> don't know why you're arguing for #hex when your own username is broken
<baweaver> only if you want to get those out for later.
<cantu4> baweaver: where would this replace?
<baweaver> really you need to post sample data
Decker has joined #ruby
datanoise has joined #ruby
<baweaver> otherwise it's impossible to tell
<baweaver> put it in a gist and link to it
d5sx43 has quit [Client Quit]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<baweaver> I have a feeling there's a lot more wrong with that than I can see from that code.
<baweaver> just post what responses looks like, that should do.
balazs has quit [Remote host closed the connection]
commondream has joined #ruby
RobertBirnie has quit [Ping timeout: 246 seconds]
<cantu4> baweaver: http://imgur.com/y3iZhIw this is what it produces
<baweaver> something's not adding up here
<Ox0dea> After some cursory research, it does seem that Fixnum#bin/#hex/#oct are a little too niche for inclusion into core.
rubie has quit [Ping timeout: 265 seconds]
<baweaver> you sure that's what responses returns?
<cantu4> baweaver: What it does it take the difference between the latest polls on Pollster, then uses a T-Distribution to find the odds of a person winning
<cantu4> Yes, I just ran it
<Ox0dea> >> ['1'.hex, '1'.oct, ('1'.bin rescue 'bad')]
<ruboto> Ox0dea # => [1, 1, "bad"] (https://eval.in/386512)
<Ox0dea> That feels worth addressing, though.
<cantu4> baweaver: I want to change the names I have inputted like rubio[:value], into whatever the user chooses
ItSANg___ has joined #ruby
Yiota has joined #ruby
<baweaver> you ran the entire program and gave me the result of that, I meant the results variable, sorry.
<baweaver> responses
<baweaver> lordy...
<baweaver> typing is hard today.
blackmesa has joined #ruby
commondream has quit [Ping timeout: 252 seconds]
ItSANgo_ has quit [Ping timeout: 264 seconds]
datanoise has quit [Ping timeout: 272 seconds]
<cantu4> baweaver: You want me to run just the responses?
<baweaver> yeah, comment out everything else and just get that data.
<zenspider> an image??
<doctorly> promet: no problem, you usually want to put environment variables in the bashrc
<baweaver> also, gist.github.com
drewvanstone has quit [Ping timeout: 264 seconds]
<doctorly> sorry wrong chan
<cantu4> baweaver: that section alone doesn't produce anything
<baweaver> You have to use a p there
<baweaver> p responses
<baweaver> otherwise it doesn't output anything
<cantu4> baweaver, wehre do I put it?
<baweaver> cantu4: Have you ever tried a REPL?
<cantu4> baweaver: don't think so
rubie has joined #ruby
blackmes1 has quit [Ping timeout: 246 seconds]
<baweaver> where do you think you should put it?
<baweaver> type in irb in your console
<baweaver> require those libraries
<baweaver> and try playing with the data like that
<zenspider> cantu4: "where do I put it" suggests that you aren't even thinking about this problem or the suggestions given. THINK about this problems and then YOU suggest to US where it should go
<baweaver> Read Eval Print Loop, lets you execute code as you will
lordkryss has quit [Quit: Connection closed for inactivity]
<zenspider> we'll let you know if it is incorrect, but you have to meet us half way
freerobby has quit [Quit: Leaving.]
oo_ has joined #ruby
<cantu4> baweaver: http://imgur.com/Zo60rE6
joaomdmoura has quit [Quit: Connection closed for inactivity]
<baweaver> I'm going to ignore imgur
<baweaver> put the code in gist.github.com
<zenspider> images?? again? wtf
<baweaver> otherwise I have to type it all to do anything with it
<baweaver> thanks
doctorly has quit [Ping timeout: 252 seconds]
<baweaver> Give me a sec
<baweaver> in the mean time, try out irb in your terminal
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<baweaver> type in: responses = (what you put in that gist)
<baweaver> and play with that data
havenwood has quit [Ping timeout: 276 seconds]
lolmaus has quit [Ping timeout: 256 seconds]
Decker has quit []
<baweaver> now, you have two values you need, choice and value
amclain has joined #ruby
cytoskeletor has joined #ruby
tlarevo has joined #ruby
<baweaver> that looks an awful lot like a key value pair
<baweaver> and you need to dynamically get names to compare
<baweaver> What happens if you make choice and value into a hash of choice and value?
<baweaver> You can prompt the user after you get that data to provide a choice from the keys of that hash
<baweaver> then run comparisons by retrieving the values
droidburgundy has joined #ruby
nfk has quit [Quit: yawn]
uptownhr has quit [Quit: uptownhr]
DroidBur_ has joined #ruby
mices has quit []
<baweaver> I don't intend to give you a straight answer, you're going to have to think through this cantu4
DroidBur_ is now known as DroidBurgundy_
serivichi has quit [Ping timeout: 244 seconds]
ledestin has joined #ruby
droidburgundy has quit [Disconnected by services]
freerobby has joined #ruby
DroidBurgundy_ is now known as DroidBurgundy
<baweaver> >> [{a: 'foo', b: 1}, {a: 'bar', b: 21}, {a: 'baz', b: 13}]
<ruboto> baweaver # => [{:a=>"foo", :b=>1}, {:a=>"bar", :b=>21}, {:a=>"baz", :b=>13}] (https://eval.in/386515)
Igorshp has joined #ruby
<baweaver> So how do we go from that, to this:
<baweaver> >> {'foo' => 1, 'bar' => 21, 'baz' => 13}
<ruboto> baweaver # => {"foo"=>1, "bar"=>21, "baz"=>13} (https://eval.in/386516)
<baweaver> You figure that out and you have the answer pretty well set
<baweaver> hint: It has to do with map and to_h
<baweaver> >> [:a, 1].to_h
<ruboto> baweaver # => wrong element type Symbol at 0 (expected array) (TypeError) ...check link for more (https://eval.in/386517)
Yzguy has joined #ruby
<baweaver> >> [[:a, 1]].to_h
<ruboto> baweaver # => {:a=>1} (https://eval.in/386518)
<baweaver> picky thing
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
enebo has quit [Quit: enebo]
Ropeney has joined #ruby
cantu4 has quit [Quit: Leaving]
<baweaver> Anyways, I persisted that to the SO question as Lemur
<baweaver> I'll be back on some time later tonight.
Igorshp has quit [Ping timeout: 272 seconds]
havenwood has joined #ruby
workmad3 has joined #ruby
Lucky_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
netmask has joined #ruby
netmask has quit [Remote host closed the connection]
balazs has joined #ruby
RobertBirnie has joined #ruby
baweaver has quit [Remote host closed the connection]
yh has quit [Ping timeout: 246 seconds]
charliesome has joined #ruby
uninitialized has joined #ruby
robbyoconnor has joined #ruby
lala has quit [Quit: Connection closed for inactivity]
robbyoconnor has quit [Changing host]
robbyoconnor has joined #ruby
sarmiena_ has quit [Quit: sarmiena_]
workmad3 has quit [Ping timeout: 265 seconds]
RegulationD has joined #ruby
cndiv has quit []
netmask has joined #ruby
jpfuentes2 has quit [Ping timeout: 256 seconds]
balazs has quit [Ping timeout: 265 seconds]
transiency has quit [Remote host closed the connection]
NeverDie has joined #ruby
no_face has joined #ruby
laurentide has joined #ruby
mary5030 has quit [Remote host closed the connection]
oo_ has quit [Remote host closed the connection]
dorei has quit []
balazs has joined #ruby
<no_face> Ruby confirmed for SJW stronghold. The fall of Opal marks the beginning of the end.
<sevenseacat> err, what?
santana has joined #ruby
RegulationD has quit [Ping timeout: 255 seconds]
<no_face> What, are you not aware of the SJW movement?
<sevenseacat> it seems like an irrelevant discussion for this channel.
jackjackdripper has quit [Quit: Leaving.]
meatchicken has joined #ruby
<no_face> Opal is a popular ruby project, so it's hardly irrelevant
lolmaus has joined #ruby
<sevenseacat> I'll have to disagree with you there. on the irrelevancy part, at least.
nahtnam has joined #ruby
<sevenseacat> and people that throw around the term 'SJW' like an insult, well
<no_face> Well then, Opal is about to lose its two top contributors in order to appease the SJW movement, namely, a fat man wearing a pink wig.
yfeldblum has joined #ruby
balazs has quit [Remote host closed the connection]
<sevenseacat> !Mute no_face
<havenwood> no_face: Be nice or you're not welcome here.
bronson has joined #ruby
dopie has joined #ruby
<sevenseacat> timeout.
<zenspider> no_face: not here
pengin has quit [Remote host closed the connection]
<no_face> Oh no, the SJWs are turning against me because I am against the concept of thought police
Soda has quit [Remote host closed the connection]
<havenwood> !ban no_face !T 1h "Be nice."
no_face was kicked from #ruby by ChanServ [Banned: "Be nice."]
santana has quit [Ping timeout: 250 seconds]
Papierkorb_ has quit [Quit: ArchLinux completes an endless loop faster than any other distro!]
slawrenc_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jpfuentes2 has joined #ruby
bronson has quit [Ping timeout: 246 seconds]
<sevenseacat> oh, my mute didnt work. oh well.
EasyCo has joined #ruby
<al2o3-cr> capital m
oo_ has joined #ruby
tlarevo has quit [Remote host closed the connection]
Booyah has joined #ruby
dcarmich has quit [Quit: Textual IRC Client: www.textualapp.com]
ghostpl has joined #ruby
<Booyah> I love you all
Booyah has left #ruby [#ruby]
arturaz has joined #ruby
ghostpl has quit [Ping timeout: 256 seconds]
blaines has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
as_ has joined #ruby
Rollabunna has quit [Remote host closed the connection]
casadei has joined #ruby
netmask_ has joined #ruby
uninitialized has quit [Ping timeout: 252 seconds]
slackbotgz1 has joined #ruby
scripore has quit [Quit: Leaving]
netmask has quit [Read error: Connection reset by peer]
netmask has joined #ruby
freerobby has quit [Quit: Leaving.]
netmask has quit [Remote host closed the connection]
serivichi has joined #ruby
FernandoBasso has quit [Quit: WeeChat 1.2]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
wallerdev_ has quit [Quit: wallerdev_]
as_ has quit [Quit: Leaving]
deric_skibotn has quit [Ping timeout: 264 seconds]
masterprime has joined #ruby
netmask_ has quit [Ping timeout: 250 seconds]
dopie has quit [Quit: This computer has gone to sleep]
datanoise has joined #ruby
netmask has joined #ruby
slackbotgz has quit [Ping timeout: 256 seconds]
lennae has joined #ruby
<masterprime> Hola. Here's the deal. I am not trying to learn ruby. I am trying to get a bot written in ruby to run on my subreddit. https://github.com/jensechu/twitchit <- this bot. The install instructions have an expectation of knowledge. Knowledge I do not have. Where do I run these commands? Specifically "bundle install"
scripore has joined #ruby
<Aeyrix> Terminal.
_blizzy_ has quit [Ping timeout: 248 seconds]
freerobby has joined #ruby
GitGud has quit [Read error: Connection reset by peer]
<masterprime> like command prompt with ruby?
<Aeyrix> > command prompt
<Aeyrix> uh oh
<sevenseacat> the same place you ran git clone and cd
<Aeyrix> If you're on Windows, this isn't going to work for you.
<BrianBoyko> I did it!!!!
HotCoder has joined #ruby
Deele has joined #ruby
<masterprime> Is it actually not going to work for me or is it just a pain in the ass? I've got linux on my laptop but I kinda need this to run all the time.
<Aeyrix> You need a server, then.
<Aeyrix> That's what they're for.
yh has joined #ruby
serivichi has quit [Ping timeout: 272 seconds]
datanoise has quit [Ping timeout: 256 seconds]
blackmesa has quit [Quit: WeeChat 1.2]
Encapsulation has quit [Changing host]
Encapsulation has joined #ruby
<masterprime> I've got a crappy webhost. Would that work?
<Aeyrix> Do you have command line access?
wallerdev_ has joined #ruby
<masterprime> yeah.
<Aeyrix> I mean for the web host.
<masterprime> I know. I have shell access.
<Aeyrix> Then yes, it'll work, so long as you can run `ruby`.
<Aeyrix> And the version is 2.x.
<Aeyrix> `ruby --version`.
yh has quit [Ping timeout: 264 seconds]
Agoldfish has quit [Quit: G'Bye]
lampshades has joined #ruby
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Pupeno has joined #ruby
j_mcnally has joined #ruby
HotCoder has quit [Quit: My name is your name]
GitGud has joined #ruby
Pupeno_ has quit [Ping timeout: 256 seconds]
ItSANg___ has quit [Read error: Connection reset by peer]
ItSANgo_ has joined #ruby
stardiviner has joined #ruby
husanu has quit [Remote host closed the connection]
husanu has joined #ruby
x1337807x has joined #ruby
djbkd has joined #ruby
netmask has quit [Remote host closed the connection]
Yzguy has quit [Read error: Connection reset by peer]
tuelz has quit [Quit: WeeChat 1.1.1]
netmask has joined #ruby
GPrime has joined #ruby
DoubleMalt has joined #ruby
finisherr has joined #ruby
finisherr has quit [Client Quit]
<BrianBoyko> Hey, if jhass comes by, tell him I got my thing working!
lennae has quit [Ping timeout: 255 seconds]
Rollabunna has joined #ruby
djbkd has quit [Ping timeout: 256 seconds]
lala has joined #ruby
havenwood has joined #ruby
lennae has joined #ruby
ItSANgo_ has quit [Ping timeout: 272 seconds]
nateberkopec has quit [Quit: Leaving...]
charliesome has quit [Quit: zzz]
wallerdev_ has quit [Ping timeout: 244 seconds]
ItSANgo_ has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Rollabunna has quit [Ping timeout: 248 seconds]
masterprime has quit [Quit: ChatZilla 0.9.91.1 [Firefox 38.0.5/20150525141253]]
fabrice31 has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Yiota has joined #ruby
mattbillock has quit [Remote host closed the connection]
_djbkd has quit [Remote host closed the connection]
Soda has joined #ruby
fabrice31 has quit [Ping timeout: 272 seconds]
hsps__ has joined #ruby
jtdoncas has joined #ruby
DroidBurgundy has quit [Remote host closed the connection]
hsps_ has quit [Ping timeout: 264 seconds]
dfockler has joined #ruby
masterprime has joined #ruby
_blizzy_ has joined #ruby
<masterprime> Okay. Finally got putty and my keys working. I don't do this often so it can be a pain. I'm on ruby 1.8.7. Is there a command to get the latest stable version?
<Ox0dea> ?windows
<ruboto> I don't know anything about windows
soxet has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
adamjleonar has joined #ruby
dfockler has quit [Ping timeout: 264 seconds]
DroidBurgundy has joined #ruby
DroidBurgundy has quit [Client Quit]
bkxd has quit [Ping timeout: 252 seconds]
adamjleonard has quit [Ping timeout: 272 seconds]
mary5030 has joined #ruby
axisys has joined #ruby
djbkd has joined #ruby
bkxd has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
baxx has quit [Ping timeout: 255 seconds]
findaway has joined #ruby
enroxorz has joined #ruby
mary5030 has quit [Ping timeout: 248 seconds]
phutchins has quit [Ping timeout: 252 seconds]
PlasmaStar has quit [Ping timeout: 256 seconds]
jpfuentes2 has joined #ruby
haraoka has joined #ruby
datanoise has joined #ruby
avahey has quit [Quit: Connection closed for inactivity]
PlasmaStar has joined #ruby
cytoskeletor has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
masterprime has quit [Quit: ChatZilla 0.9.91.1 [Firefox 38.0.5/20150525141253]]
thomas is now known as oldmantom
balazs has joined #ruby
blahwoop has joined #ruby
ramfjord has quit [Ping timeout: 246 seconds]
marciotex has joined #ruby
nofxxxx has quit [Ping timeout: 252 seconds]
commondream has joined #ruby
Casty has joined #ruby
swgillespie has joined #ruby
Rickmasta has joined #ruby
Lucky_ has joined #ruby
adamjleonar is now known as adamjleonard
Lucky_ has quit [Client Quit]
commondream has quit [Ping timeout: 252 seconds]
rubie has quit [Remote host closed the connection]
Lucky_ has joined #ruby
nofxx has joined #ruby
nofxx has joined #ruby
Igorshp has joined #ruby
centrx has quit [Quit: Shutting down, Please wait...]
jtdoncas has quit [Ping timeout: 244 seconds]
erts has joined #ruby
Igorshp has quit [Ping timeout: 264 seconds]
workmad3 has joined #ruby
Rollabunna has joined #ruby
Eiam has joined #ruby
davorb has quit []
workmad3 has quit [Ping timeout: 250 seconds]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
balazs has quit [Remote host closed the connection]
Rollabunna has quit [Ping timeout: 248 seconds]
darkf has joined #ruby
netmask has quit [Remote host closed the connection]
balazs has joined #ruby
charliesome has joined #ruby
aphprentice_ has joined #ruby
ra4king1 has joined #ruby
chris2 has quit [Ping timeout: 246 seconds]
ra4king1 has quit [Remote host closed the connection]
netmask has joined #ruby
Casty has quit [Quit: Textual IRC Client: www.textualapp.com]
Eiam has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
scx_ has joined #ruby
<BrianBoyko> god help me, I'm in a "just one more commit" cycle... and I haven't eaten for 12 hours.
enroxorz has quit [Quit: Page closed]
Yiota has joined #ruby
lennae has quit [Ping timeout: 265 seconds]
scx has quit [Ping timeout: 256 seconds]
arescorpio has quit [Quit: Leaving.]
RegulationD has joined #ruby
netmask has quit [Remote host closed the connection]
braincrash has quit [Quit: bye bye]
netmask has joined #ruby
creakybones has quit [Ping timeout: 276 seconds]
rbennacer has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
icosa has joined #ruby
acovrig has joined #ruby
ghostpl has joined #ruby
<acovrig> given: “up time: 01:31:54, idle time: 06:01:03, sleep time: 00:00:00 “.match(//) what would I use for a regexp to get “01:31:54”? /(?:up time: )([0-9]{2}:[0-9]{2}:[0-9]{2})/
RegulationD has quit [Ping timeout: 252 seconds]
<acovrig> nevermind, got that, now what about the 06:01:03 part?
blahwoop has quit [Remote host closed the connection]
<sevenseacat> same thing?
rbennacer has quit [Ping timeout: 264 seconds]
<acovrig> sevenseacat: then I would just get the 01:31:54.
<nofxx> acovrig, up, iddle, sleep = txt.scan(/\d{2}: ..
<crowell> acovrig: or the lazy way .split(" ")[5].chomp(',')
<nofxx> would be easier , no?
braincrash has joined #ruby
<nofxx> unless you expect they to change order*
<sevenseacat> well running the \d{2}:\d{2}:\d{2} regex will get you three matches - you want the first and second, no?
ghostpl has quit [Ping timeout: 246 seconds]
<Ox0dea> acovrig: up, idle, sleep = str.scan(/\d\d:\d\d:\d\d/)
<acovrig> sevenseacat: yes, can I do .match()[1]?
<sevenseacat> what Ox0dea said, prety much
<Ox0dea> sevenseacat: Pretty much?
tkuchiki has joined #ruby
blue_deref has quit [Quit: bbn]
<sevenseacat> i dont like the \d\d notation :P
<Ox0dea> I'm a golfer at heart.
tkuchiki_ has joined #ruby
<sevenseacat> makes sense
Rickmasta has joined #ruby
netmask has quit [Remote host closed the connection]
<acovrig> it might change order, I would like to match “up time “<time>, and not ‘capture’ the “up time “, it seems like I can do (?:<string to match, but not capture>), is that not right?
<EasyCo> Hey team, I'm parsing an ugly date like so:
<EasyCo> >> Date.parse("08.08.15").strftime("%d/%m/%y")
<ruboto> EasyCo # => uninitialized constant Date (NameError) ...check link for more (https://eval.in/386543)
<EasyCo> >> require 'Date'; Date.parse("08.08.15").strftime("%d/%m/%y")
<ruboto> EasyCo # => cannot load such file -- Date (LoadError) ...check link for more (https://eval.in/386544)
<zenspider> case sensitive
<havenwood> EasyCo: #=> "15/08/08"
<EasyCo> Hah, yah, exactly, thanks.
<EasyCo> Anyways, the date is actually 08/08/2015
pontiki has joined #ruby
Channel6 has joined #ruby
<EasyCo> Anyway around that issue other then manually parsing the date using regex?
64MAC6DSJ has joined #ruby
<Ox0dea> EasyCo: Date.strptime takes a second argument specifying the format to expect.
GitGud has quit [Ping timeout: 265 seconds]
coffee__cup has joined #ruby
<EasyCo> Ox0dea: Thanks, I did not know that. I just noticed that the data I'm parsing has no standard date input so it's all over the shop... So strptime wont work, cool nonetheless. Cheers.
djbkd has quit [Quit: My people need me...]
konsolebox has joined #ruby
commondream has joined #ruby
netmask has joined #ruby
iamninja has quit [Read error: Connection reset by peer]
<Ox0dea> EasyCo: I have known the torment of heuristical date parsing.
iamninja has joined #ruby
nahtnam has quit [Quit: Connection closed for inactivity]
<EasyCo> Ox0dea: Yep, ~50 Google spreadsheets averaging a few thousand rows each with no normalized data to be parsed and exported into a specific system format. Fun Fun.
oo_ has quit [Remote host closed the connection]
tlarevo has joined #ruby
<Ox0dea> EasyCo: Are you using Kiba?
oo_ has joined #ruby
<EasyCo> Ox0dea: Nah, jus rolled my own
charliesome has quit [Quit: zzz]
<Ox0dea> EasyCo: There's just something about homemade wheels, eh? :)
gix has quit [Ping timeout: 248 seconds]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
balazs has quit [Remote host closed the connection]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
msnyon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gix has joined #ruby
<EasyCo> Ox0dea: Yep, 166 lines of gorgeous regex and loops!
<Ox0dea> acovrig: If you're not opposed to matching against the string several times, the two-argument form of String#[] is pretty convenient.
<Ox0dea> >> 'foobar'[/foo(bar)/, 1]
<ruboto> Ox0dea # => "bar" (https://eval.in/386545)
<acovrig> Ox0dea: I’m currently using “up time: 01:31:54, idle time: 06:01:03, sleep time: 00:00:00 ”.match(/(?:up time: )(\d{2}:\d{2}:\d{2})/).to_s.sub(/up time: /,'')
<Ox0dea> Gross.
<Ox0dea> %w[up idle sleep].map { |t| str[/#{t} time: (\d\d:\d\d:\d\d)/, 1] }
arup_r has joined #ruby
tlarevo has quit [Remote host closed the connection]
rubie has joined #ruby
tlarevo has joined #ruby
lennae has joined #ruby
Rickmasta has joined #ruby
<acovrig> %w is the string I’m working with?
<Ox0dea> No, that's `str`.
<Ox0dea> %w creates an array of "words".
<Ox0dea> >> %w[foo bar baz]
<ruboto> Ox0dea # => ["foo", "bar", "baz"] (https://eval.in/386546)
<al2o3-cr> /\d{2}:\d{2}:\d{2}/ # will match up time if that is you only want
<Ox0dea> He mentioned earlier that he'd also like to capture the idle time.
Rollabunna has joined #ruby
<al2o3-cr> ah, must of missed that
idafyaid has joined #ruby
marciotex has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oldmantom is now known as thomas
rubie has quit [Ping timeout: 265 seconds]
coffee__cup has quit [Quit: Leaving]
<acovrig> Ox0dea: handy, thanks
datanoise has quit [Ping timeout: 246 seconds]
gkra_ has joined #ruby
Rollabunna has quit [Ping timeout: 248 seconds]
<Ox0dea> acovrig: Sure thing.
<Ox0dea> There's admittedly a lot going on in that, so feel free to ask for clarification.
gkra_ has quit [Changing host]
gkra_ has joined #ruby
fabrice31 has joined #ruby
64MAC6DSJ is now known as baweaver
gkra has quit [Ping timeout: 246 seconds]
<Ox0dea> >> str = 'up time: 01:31:54, idle time: 06:01:03, sleep time: 00:00:00'; Hash[str.scan(/(\w+) time: (\d\d:\d\d:\d\d)/)]
<ruboto> Ox0dea # => {"up"=>"01:31:54", "idle"=>"06:01:03", "sleep"=>"00:00:00"} (https://eval.in/386556)
keen___________1 has joined #ruby
<acovrig> O.o what is this beautiful magic :D
gianlucadv has joined #ruby
<Aeyrix> Regex.
commondream has quit [Remote host closed the connection]
commondream has joined #ruby
jam___ has joined #ruby
keen___________0 has quit [Ping timeout: 252 seconds]
fabrice31 has quit [Ping timeout: 272 seconds]
isxek has joined #ruby
husanu has quit [Remote host closed the connection]
husanu has joined #ruby
alehlopeh has joined #ruby
dcarmich has joined #ruby
Yiota has joined #ruby
<baweaver> beauty is in the eyes of the beholder
* baweaver glares at RFC Email Regex
arooni-mobile has joined #ruby
commondream has quit [Ping timeout: 248 seconds]
netmask has quit []
bitcycle has joined #ruby
duderonomy has joined #ruby
bitcycle has quit [Quit: WeeChat 1.1.1]
husanu has quit [Remote host closed the connection]
<havenwood> >> 'up time: 01:31:54, idle time: 06:01:03, sleep time: 00:00:00'.split(', ').map { |s| s.split ' time: ' }.to_h
husanu has joined #ruby
<ruboto> havenwood # => {"up"=>"01:31:54", "idle"=>"06:01:03", "sleep"=>"00:00:00"} (https://eval.in/386560)
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenwood> *requisite non-regexp solution
* baweaver golf claps
<acovrig> thanks all, many ways to complete a task shows differnet methods of thinking; I’m off to bed, it’s midnight here.
<sevenseacat> havenwood: nice.
alehlopeh has quit [Remote host closed the connection]
acovrig has quit [Quit: acovrig]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
roger_rabbit has joined #ruby
hsps__ has quit [Ping timeout: 252 seconds]
alehlopeh has joined #ruby
findaway has quit [Quit: findaway]
frem has quit [Quit: Connection closed for inactivity]
<Radar> baweaver: My favourite part of the email RFC is where it allows comments in email addresses
* baweaver weeps silently
<Radar> \o/
<sevenseacat> nice.
RobertBirnie has joined #ruby
bitcycle has joined #ruby
braincra- has joined #ruby
RobertBirnie has quit [Max SendQ exceeded]
<bitcycle> Hey all. Is there a way to tell Net::ssh to not use .ssh/config?
djbkd has joined #ruby
alehlopeh has quit [Remote host closed the connection]
derylbear has joined #ruby
RobertBirnie has joined #ruby
<derylbear> whats the best IDE for Ruby?
<bitcycle> vim
<baweaver> oh hey
braincrash has quit [Ping timeout: 244 seconds]
<baweaver> none
<sevenseacat> oh hello again
<derylbear> vim is better than sublime?
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bitcycle> yes
<baweaver> yes
<sevenseacat> probably.
icebourg has joined #ruby
<derylbear> ok, ty
derylbear has left #ruby [#ruby]
<baweaver> Go forth and code young one!
<baweaver> whoops, dc'd again
<baweaver> and now we wait for the inevitable "What do you mean there's no mouse support!?!?!" replies
<bitcycle> Hey all. Is there a way to tell Net::ssh to not use .ssh/config?
<sevenseacat> "does vim have autocomplete?"
<baweaver> Tim Pope says yes to all the things
<Ox0dea> bitcycle: There is a configuration option named :config, which you'll want to set to false.
<wmoxam> O_o
<baweaver> Ox0dea: I swear you're like a fountain of strange wisdoms
<Ox0dea> I just... use Ruby a lot?
<baweaver> well, granted that one wasn't out there like the BF interpreter
arooni-mobile has quit [Ping timeout: 248 seconds]
baweaver_ has joined #ruby
grzywacz has joined #ruby
joshbamboo2 has joined #ruby
axilla has quit [Ping timeout: 264 seconds]
bitcycle has quit [Read error: Connection reset by peer]
txdv has quit [Ping timeout: 265 seconds]
txdv_ has joined #ruby
olistik has joined #ruby
djellemah has quit [Ping timeout: 265 seconds]
arooni-mobile has joined #ruby
aryaching has joined #ruby
baweaver_ has quit [Ping timeout: 248 seconds]
j_mcnally has quit [Quit: Textual IRC Client: www.textualapp.com]
Igorshp has joined #ruby
shadoi has joined #ruby
bitcycle has joined #ruby
shadoi has quit [Client Quit]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
joshbamboo1 has quit [Ping timeout: 265 seconds]
bitcycle has quit [Client Quit]
dg-ratio1 has joined #ruby
unsymbol_ has joined #ruby
<Ox0dea> I would hesitate to consider programming without alphanumerics to be even remotely wise, but the compliment is appreciated nevertheless.
speakingcode has joined #ruby
Janusz1_ has joined #ruby
Cust0sLim3n has joined #ruby
jsaak_ has joined #ruby
<Ox0dea> That said, I do quite like that the whole thing hinges on being able to acquire a 1 with $$/$$.
kobain has quit [Quit: KVIrc 4.1.3 Equilibrium http://www.kvirc.net/]
olistik has quit [Ping timeout: 255 seconds]
Igorshp has quit [Ping timeout: 276 seconds]
Oka has joined #ruby
workmad3 has joined #ruby
Jarboe has quit []
unsymbol has quit [Ping timeout: 265 seconds]
CustosLimen has quit [Ping timeout: 265 seconds]
Kharma has quit [Ping timeout: 265 seconds]
Kharma has joined #ruby
jsaak has quit [Ping timeout: 265 seconds]
Janusz1 has quit [Ping timeout: 265 seconds]
lkba has quit [Ping timeout: 265 seconds]
lkba has joined #ruby
mrsolow has joined #ruby
scottstamp has quit [Ping timeout: 265 seconds]
Kharma has joined #ruby
hectortrope has quit [Ping timeout: 265 seconds]
mrsolow has quit [Ping timeout: 265 seconds]
Kharma has quit [Changing host]
mrsolow has quit [Changing host]
mrsolow has joined #ruby
Rollabunna has joined #ruby
djellemah has joined #ruby
scottstamp has joined #ruby
icebourg has quit []
stardiviner has quit [Ping timeout: 265 seconds]
hectortrope has joined #ruby
stardiviner has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
Rollabunna has quit [Ping timeout: 246 seconds]
hanmac has quit [Ping timeout: 256 seconds]
skade has joined #ruby
nahtnam has joined #ruby
Rickmasta has joined #ruby
datanoise has joined #ruby
slawrence00 has quit [Read error: Connection reset by peer]
<shevy> Ox0dea are you still sore that regex only treats $1 up to $9 in a special way?
<Ox0dea> shevy: Remember it turned out that those are treated specially only insofar as they are artificially appended to the array returned by Kernel::global_variables?
<shevy> yeah you angrily showed the code here
datanoise has quit [Ping timeout: 252 seconds]
<Ox0dea> I still don't understand why that's done.
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
RegulationD has joined #ruby
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gianlucadv has quit [Ping timeout: 264 seconds]
temp has joined #ruby
yardenbar has quit [Quit: Leaving]
dg-ratio1 has quit [Ping timeout: 256 seconds]
temp has quit [Client Quit]
ghostpl has joined #ruby
chris2 has joined #ruby
hanmac has joined #ruby
<shevy> read the comment!
<shevy> :D
x1337807x has joined #ruby
RegulationD has quit [Ping timeout: 265 seconds]
<Ox0dea> > Returns an array of the names of global variables.
<Ox0dea> Nowhere does it say "and also pretends that $1-9 aren't magic".
micmus has quit [Quit: Leaving]
freerobby has quit [Quit: Leaving.]
ghostpl has quit [Ping timeout: 250 seconds]
kriskropd has quit [Ping timeout: 256 seconds]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Oka has quit []
<Ox0dea> To be clear, I'm not really opposed to their being in there, but the rationale is certainly lost on me.
<Ox0dea> Also, why doesn't English define aliases for them if they're so special?
scripore has quit [Quit: This computer has gone to sleep]
al2o3-cr has quit [Ping timeout: 256 seconds]
msnyon has joined #ruby
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
arup_r has quit [Quit: ChatZilla 0.9.91.1 [Firefox 38.0.1/2015051400]]
msnyon has quit [Ping timeout: 252 seconds]
jfarmer has quit [Quit: Textual IRC Client: www.textualapp.com]
rubie has joined #ruby
davedev24_ has quit [Ping timeout: 248 seconds]
alehlopeh has joined #ruby
jenrzzz has joined #ruby
railsraider has joined #ruby
podman has quit [Quit: Connection closed for inactivity]
SOLDIERz has joined #ruby
rubie has quit [Ping timeout: 265 seconds]
kriskropd has joined #ruby
alehlopeh has quit [Remote host closed the connection]
x1337807x has joined #ruby
ndrei has joined #ruby
<flughafen> morning
CloCkWeRX has quit [Quit: Leaving.]
CloCkWeRX1 has joined #ruby
railsraider has quit [Quit: railsraider]
psy_ has quit [Ping timeout: 256 seconds]
al2o3-cr has joined #ruby
Channel6 has quit [Quit: Leaving]
djbkd_ has joined #ruby
moshee has joined #ruby
husanu has quit [Remote host closed the connection]
arooni-mobile has quit [Ping timeout: 248 seconds]
choke has joined #ruby
husanu has joined #ruby
lxsameer has joined #ruby
lxsameer has joined #ruby
Rollabunna has joined #ruby
Xeago has joined #ruby
CloCkWeRX1 has left #ruby [#ruby]
djbkd_ has quit [Ping timeout: 244 seconds]
lampshades has quit [Remote host closed the connection]
fabrice31 has joined #ruby
khebbie has joined #ruby
Xeago has quit [Ping timeout: 246 seconds]
Rollabunna has quit [Ping timeout: 248 seconds]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aganov has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
adamjleonard has quit [Quit: Leaving...]
tlarevo has quit []
fabrice31 has quit [Ping timeout: 272 seconds]
sandstrom has joined #ruby
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yayfoxes_ has quit [Quit: WeeChat 1.0.1]
sfarley has joined #ruby
haraoka has quit [Ping timeout: 256 seconds]
Brando753 has quit [Ping timeout: 250 seconds]
Or1on has quit [Ping timeout: 246 seconds]
tagrudev has joined #ruby
Igorshp has joined #ruby
Brando753 has joined #ruby
GPrime has quit [Quit: Textual IRC Client: www.textualapp.com]
sfarley has quit [Remote host closed the connection]
Igorshp has quit [Ping timeout: 244 seconds]
DoubleMalt has quit [Ping timeout: 252 seconds]
Prawnzy| has joined #ruby
sarmiena_ has joined #ruby
Xeago has joined #ruby
quazimodo has quit [Remote host closed the connection]
timonv has quit [Ping timeout: 248 seconds]
commondream has joined #ruby
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jam___ has quit [Quit: Connection closed for inactivity]
lavros has joined #ruby
sfarley has joined #ruby
funburn has joined #ruby
psy_ has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
acke has joined #ruby
swgillespie has joined #ruby
bluOxigen has joined #ruby
oo_ has quit [Remote host closed the connection]
commondream has quit [Ping timeout: 265 seconds]
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dented42 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
psy_ has quit [Client Quit]
oo_ has joined #ruby
dented42 has joined #ruby
dented42 has quit [Client Quit]
Prawnzy| has quit [Read error: Connection reset by peer]
psy_ has joined #ruby
andikr has joined #ruby
psy_ has quit [Max SendQ exceeded]
Prawnzy| has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
psy_ has joined #ruby
railsraider has joined #ruby
AlphaAtom has joined #ruby
KnownSyntax has quit []
_ht has joined #ruby
unshadow has quit [Quit: leaving]
bayed has quit [Quit: Connection closed for inactivity]
air_ has joined #ruby
ndrei has quit [Ping timeout: 264 seconds]
fedexo has joined #ruby
pontiki has quit [Quit: <poit>]
sinkensabe has joined #ruby
KnownSyntax has joined #ruby
KnownSyntax has quit [Changing host]
KnownSyntax has joined #ruby
Cust0sLim3n has quit [Ping timeout: 244 seconds]
chinmay_dd has joined #ruby
roolo has joined #ruby
workmad3 has joined #ruby
aryaching has quit [Ping timeout: 264 seconds]
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ta has quit [Remote host closed the connection]
SOLDIERz has joined #ruby
Rollabunna has joined #ruby
ramfjord has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
Rollabunna has quit [Ping timeout: 248 seconds]
nhhagen has joined #ruby
Guest38 has joined #ruby
<zenspider> Ox0dea: they're treated specially because they reset on scope boundaries
<flughafen> slow morning here
ndrei has joined #ruby
Cust0sLim3n has joined #ruby
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
Xeago has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 264 seconds]
<Radar> flughafen: Do you speak German? I have a translation question I need to ask a German speaker and saw you're here :)
<sevenseacat> given the name
<Radar> If anyone is: what is the German equivalent of i.e.?
bkxd has quit [Ping timeout: 256 seconds]
<Ox0dea> zenspider: Aye, I'm fine with that, but why artifically include them in global_variables? https://github.com/ruby/ruby/blob/trunk/variable.c#L908-L912
<Radar> d.h.?
* sevenseacat is suddenly very interested in this speck of dust
<Radar> my hero
jenrzzz has joined #ruby
<baweaver> das ist
<baweaver> ah
dg-ratio1 has joined #ruby
<Ox0dea> I suspect idiomatic German doesn't actually use d.i., though.
<baweaver> I know enough german to stay out of trouble
<Ox0dea> Idiomatic English doesn't translate the Latin, anyhow.
<baweaver> my brother knows enough to get into it
<Ox0dea> I know just enough German to have gotten a giggle out of seeing the name Madchen in the credits.
<sevenseacat> my cats have picked up enough German to know what hahnchen is.
yfeldblum has quit [Ping timeout: 248 seconds]
<flughafen> sevenseacat: meowen sie deutsch?
railsraider has quit [Ping timeout: 248 seconds]
<Ox0dea> zenspider: Do you reckon their inclusion was done in observation of the principle of least surprise?
railsraider has joined #ruby
nhhagen has quit [Remote host closed the connection]
JayJay has joined #ruby
RegulationD has joined #ruby
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Aeyrix> Ox0dea: were you surprised?
<JayJay> Hey there!
<sevenseacat> they learnt chicken and would come running for food whenever it was mentioned. then they learnt hahnchen. smart fuckers.
Beoran_ has quit [Ping timeout: 256 seconds]
<JayJay> Anyone into Opal?
<flughafen> sevenseacat: how many cats do youu have
<Ox0dea> >> ('a' * 10)[/#{'(a)' * 10}/]; g = global_variables; [$10, g.include?(:$9), g.include?(:$10)]
<ruboto> Ox0dea # => ["a", true, false] (https://eval.in/386586)
<sevenseacat> two.
<Ox0dea> Aeyrix: I think that's at least a little surprising.
<Aeyrix> Ox0dea: Then probably not principle of least surprise. :P
<Ox0dea> I believe you've mistaken the point I meant to make.
<Aeyrix> probably
<Aeyrix> i'm more concerned about these doritos tbh
nhhagen has joined #ruby
<Ox0dea> In that snippet, $10 exists, is a global variable, and has a value, and yet it does not show up in Kernel::global_variables, whereas $9 does.
wallerdev has quit [Quit: wallerdev]
<Ox0dea> This only because $1-9 are artifically added to the array returned by the aforementioned method.
<Ox0dea> *artificially
ghostpl has joined #ruby
fabrice31 has joined #ruby
* flughafen still hasn't gotten his package from dhl. they're still on strike and it's been in my city for 2.5 weeks
RegulationD has quit [Ping timeout: 255 seconds]
<Aeyrix> go and get it yourself
sarkyniin has quit [Remote host closed the connection]
<zenspider> Ox0dea: because they start with "$" and are therefore globals?
<flughafen> weather has been bad, but i'll go today . i only have a motorcycle
erts has quit [Quit: erts]
<flughafen> if it stays nice
<zenspider> I don't see why it is "artifically included"
bkxd has joined #ruby
nhhagen has quit [Read error: Connection reset by peer]
<zenspider> JayJay: not here
ndrei has quit [Ping timeout: 276 seconds]
<Ox0dea> I just don't see why $10 should be treated any differently than $9.
Guest38 has quit [Quit: Textual IRC Client: www.textualapp.com]
datanoise has joined #ruby
Xeago has joined #ruby
amclain has quit [Quit: Leaving]
<flughafen> Ox0dea: what does [/#{'(a)' * 10}] do?
ghostpl has quit [Ping timeout: 272 seconds]
<zenspider> builds a big dumb regexp just like the string before it
<flughafen> hey Radar , are there any drones flying over me?
ndrei has joined #ruby
<zenspider> could be (.) too
<Radar> flughafen: yeah sorry about those but we feel like you're a threat to national security
<Radar> oops that was meant to be in PM too bad now I gues
<zenspider> I'm kinda surprised that $10 is populated
eGGshke has joined #ruby
<zenspider> huh. it is in 1.8 too
<zenspider> so it isn't an onigaruma thing
<flughafen> Radar: !!!
casadei has quit [Remote host closed the connection]
<_mh_> apparently it populates up to $50 at least
<zenspider> ah.. interesting: 1.8 outputs: ["j", false, false]
eGGshke has quit [Client Quit]
<_mh_> hmm...
<_mh_> even $1000 can be populated this way. I suppose it's making a shorthand for access on the last match there?
BrianBoyko has quit [Quit: Leaving]
<zenspider> oh. strings vs symbols
troulouliou_dev has joined #ruby
wallerdev has joined #ruby
jacaballero has joined #ruby
<Ox0dea> >> ''[/#{'()' * 32767}/]; $32767
<ruboto> Ox0dea # => "" (https://eval.in/386592)
gauke has joined #ruby
Xeago has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
Beoran_ has joined #ruby
<_mh_> Ox0dea: Seems there's not really a limit, but they are not treated completely as globals?
<Ox0dea> The limit is 32767.
<_mh_> ok.
<Ox0dea> >> /#{'()' * 32768}/
<ruboto> Ox0dea, I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
eGGsha has joined #ruby
<_mh_> Ox0dea: the error is a 'too many capture groups' though.
<Ox0dea> Right.
<zenspider> so, apparently, they're always accessable
<zenspider> >> ''[/(.)/]; $100
<ruboto> zenspider # => nil (https://eval.in/386594)
<Ox0dea> All global variables are always "accessible".
DoubleMalt has joined #ruby
<zenspider> even with -w it doesn't warn that it isn't defined
JayJay has quit [Quit: Page closed]
Cust0sLim3n has quit [Ping timeout: 255 seconds]
<Ox0dea> Every global variable "exists", after a fashion, but it would certainly be unwise to include them all in Kernel::global_variables' output.
sfarley has quit [Remote host closed the connection]
<zenspider> % ruby -we 'p $woot'
<zenspider> -e:1: warning: global variable `$woot' not initialized
<Ox0dea> $1-9 are just as magical as $10 and beyond, but it was decided that they should appear in the output of that method, and I'd really like to know why.
yardenbar has joined #ruby
<zenspider> Ox0dea: probably an oversight. Send in a patch
jacaballero has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea> zenspider: In fact, nobu refactored the code that adds them six years ago.
<zenspider> I don't find this nearly as interesting as you do. If you want it fixed, fix it.
<Ox0dea> I am much more interested in the "why".
<zenspider> $0 always needs to be there. $1 and up should probably only be there based on values in $~.to_a
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sepp2k has joined #ruby
<zenspider> asking "why" in cases like this is a waste of time
wallerdev has quit [Quit: wallerdev]
Prawnzy| has quit [Quit: Bye]
djbkd has quit [Quit: My people need me...]
fedexo has quit [Ping timeout: 248 seconds]
wallerdev has joined #ruby
rdark has joined #ruby
rdark has quit [Client Quit]
rdark has joined #ruby
AlphaAtom has joined #ruby
eGGsha has joined #ruby
workmad3 has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
oo_ has quit [Remote host closed the connection]
unshadow has joined #ruby
n008f4g_ has joined #ruby
zeroDivisible has quit [Ping timeout: 255 seconds]
funburn has quit [Quit: funburn]
rushed has left #ruby [#ruby]
ramfjord has quit [Ping timeout: 246 seconds]
workmad3 has quit [Ping timeout: 264 seconds]
bronson has joined #ruby
<ljarvis> mornin'
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Bertg has joined #ruby
<maloik> hiya
<flughafen> yo ljarvis
oo_ has joined #ruby
datanoise has quit [Ping timeout: 256 seconds]
Rollabunna has joined #ruby
bronson has quit [Ping timeout: 244 seconds]
oo_ has quit [Remote host closed the connection]
Iskarlar has joined #ruby
oo_ has joined #ruby
wallerdev has quit [Quit: wallerdev]
dg-ratio1 has quit [Quit: WeeChat 1.2]
jenrzzz has quit [Ping timeout: 248 seconds]
Obfuscate has quit [Ping timeout: 272 seconds]
gkra_ has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
tlarevo has joined #ruby
Rollabunna has quit [Ping timeout: 264 seconds]
alex88 has joined #ruby
TinkerTyper has quit [Ping timeout: 265 seconds]
TinkerTyper has joined #ruby
stan has joined #ruby
saadq has joined #ruby
skade has joined #ruby
Sypheren has quit [Ping timeout: 248 seconds]
olistik has joined #ruby
sandstrom has joined #ruby
wildroman2 has joined #ruby
bkxd has quit [Ping timeout: 264 seconds]
doublemalt_ has joined #ruby
<saadq> Out of curiosity, do you guys use a text editor or an IDE for Ruby?
DoubleMalt has quit [Ping timeout: 264 seconds]
pwnz0r has joined #ruby
<ljarvis> saadq: I use vim
gkra has joined #ruby
troulouliou_dev has quit [Ping timeout: 272 seconds]
<saadq> I've been using Vintage mode on Sublime Text, I've been thinking about switching over to vim
<sevenseacat> i use sublime text.
Obfuscate has joined #ruby
<flughafen> sevenseacat: vim
<sevenseacat> what did you call me
<ljarvis> lol
<flughafen> oops, hahaha
<zenspider> emacs, bitches
<flughafen> zenspider uses bsd and hasn't showered in 3 years
<flughafen> ;)
<zenspider> true facts
<zenspider> dust baths don't count, right?
<flughafen> not really. ask sevenseacat
<flughafen> she likes dust
<sevenseacat> heh
<sevenseacat> I've tried atom, but don't see a reason to switch to it.
* flughafen likes vim
wallerdev has joined #ruby
<flughafen> but i do use eclipse for java stuff at work.
<zenspider> I'm switching to the new visual studio editor
dfockler has joined #ruby
wildroman2 has quit []
* flughafen will definitely switch to neovim
<zenspider> try spacemacs
<flughafen> zenspider: is it like emacs in spaced?
<flughafen> space*
<zenspider> apparently a lot of vimmers like it
<zenspider> it's emacs w/ a strong vim influence, I guess
dfockler has quit [Ping timeout: 256 seconds]
white_bear has joined #ruby
lele has quit [Ping timeout: 250 seconds]
dumdedum has joined #ruby
saadq has quit [Remote host closed the connection]
antgel has joined #ruby
eGGsha has quit [Quit: Textual IRC Client: www.textualapp.com]
joonty has joined #ruby
ghostpl_ has joined #ruby
eGGsha has joined #ruby
isxek has quit [Ping timeout: 246 seconds]
doublemalt_ has quit [Ping timeout: 250 seconds]
troulouliou_dev has joined #ruby
tlarevo has quit [Remote host closed the connection]
allenn has joined #ruby
joonty has quit [Client Quit]
prinsen has quit [Ping timeout: 248 seconds]
wildroman2 has joined #ruby
n008f4g_ has quit [Ping timeout: 264 seconds]
elia has joined #ruby
ta has joined #ruby
roolo has quit [Remote host closed the connection]
wallerdev has quit [Quit: wallerdev]
Xeago has joined #ruby
Macaveli has joined #ruby
bkxd has joined #ruby
yfeldblum has joined #ruby
anisha has joined #ruby
Scroff has joined #ruby
haudoing has joined #ruby
Scroff has quit [Read error: Connection reset by peer]
air_ has quit [Ping timeout: 246 seconds]
lolmaus has quit [Quit: Konversation terminated!]
Scroff has joined #ruby
doublemalt_ has joined #ruby
Xeago has quit [Ping timeout: 272 seconds]
Hounddog has joined #ruby
zeroDivisible has joined #ruby
bayed has joined #ruby
Renich has joined #ruby
BrianBoyko has joined #ruby
<haudoing> hello everybody I have a noob question...
<haudoing> what is this syntax mean?
troulouliou_dev has quit [Ping timeout: 265 seconds]
<adaedra> which one?
wallerdev has joined #ruby
<haudoing> can u check out the gist?
Jackneill has joined #ruby
<sevenseacat> theres a lot of syntax in that code
<ddv> haudoing: just a method that received and yields a block
jenrzzz has quit [Ping timeout: 276 seconds]
<ddv> receives*
<haudoing> I know do and end is like curly
[k- has joined #ruby
<haudoing> ok.. so it's like a method?
<adaedra> careful, because curly braces can mean two things: block and hash
andikr has quit [Remote host closed the connection]
bucaran has joined #ruby
<haudoing> I thought we use "def" to define a method
<adaedra> the code between do end is a block, that is passed as argument to service
k3asd` has joined #ruby
troulouliou_dev has joined #ruby
c0m0 has joined #ruby
<adaedra> it's not exactly a method
<ddv> haudoing: look up implementation
<bucaran> hi folks, I am thinking of creating a "learning ruby from javascript" guide since I cant find a decent one, but maybe I havent looked hard enough
<bucaran> do you know any?
vikaton has quit [Quit: Connection closed for inactivity]
Lucky_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bucaran> most guides have too many definitions and misc information, I am looking for a comprenhensive "here is ruby and then here is js" with pertinent notes and thats it, but i cant find anything decent
BrianBoyko has quit [Quit: Leaving]
<sevenseacat> bucaran: just comparing the syntax? because theyre two different beasts in ideology
<sevenseacat> lots of it doesnt translate
<bucaran> @sevenseacat: those details can be explained via sidenotes IMO
<sevenseacat> you want to explain object oriented programming via sidenotes?
<bucaran> can totally skip that
<sevenseacat> o.o
<sevenseacat> but... you want to learn ruby, dont you?
<bucaran> hold, no need to explain that bc the target for the guide is folks that already know js well
<bucaran> so we can make some safe assumptions, if i dont define any scope then ill end up writing a book lol
<sevenseacat> right, so now you need to teach them object oriented programming
x44x45x41x4E has joined #ruby
oo_ has quit [Remote host closed the connection]
canton7 is now known as canton
canton is now known as canton7
<bucaran> well, we have classes in es6 that are really wrappers for javascript prototypical inheritance model, but classes nevertheless, it does not have to be 100% perfect
<bucaran> they support basic polyphormism via extend
mikecmpbll has joined #ruby
<bucaran> this would be mostly for syntax and idiomatic ruby
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
GitGud has joined #ruby
<bucaran> OO concepts that apply in ruby that do not apply in js (like what? may I ask) we can safely leave for later, I just want to get started
Rollabunna has joined #ruby
<bucaran> flughagen: Thanks!
wallerdev has quit [Quit: wallerdev]
joonty has joined #ruby
<flughafen> bucaran: there is tab autocomplete
<bucaran> flughafen: Got it! :)
<bucaran> irrsi?
<flughafen> bucaran: most all of them?
<bucaran> flughafen: :) hehe k
wallerdev has joined #ruby
<bucaran> indeed
<adaedra> IRC clients that do not do tab-complete are not worthy.
yh has joined #ruby
<bucaran> worthy of what?
<adaedra> worthy.
<flughafen> they aren't worthy of being worthy
<bucaran> at all?
<bucaran> too strict
scx_ is now known as scx
<bucaran> havent looked too hard into irrsi customization options, but is it possible to change the UI colors? like e.g, the time stamp would be nicer if gray
<[k-> I thought it's irssi
wallerdev has quit [Client Quit]
<ytti> bucaran, there are probably 100s of themes in irssi homepages
oo_ has joined #ruby
<bucaran> thanks
Zai00 has joined #ruby
ghostpl_ has quit [Remote host closed the connection]
Scrofff has joined #ruby
Rollabunna has quit [Ping timeout: 248 seconds]
yfeldblum has quit [Ping timeout: 248 seconds]
Scroff has quit [Read error: Connection reset by peer]
<flughafen> bucaran: use weechat
prinsen has joined #ruby
<bucaran> I was looking for a quick, one liner to make the stamp gray right away, but Ill get me some nice themes
TheHodge has joined #ruby
<adaedra> And here we go
Macaveli has quit [Quit: Textual IRC Client: www.textualapp.com]
eGGsha has joined #ruby
tlarevo has joined #ruby
Renich has quit [Ping timeout: 252 seconds]
tlarevo has quit [Remote host closed the connection]
<zenspider> ddv: you don't know that yields the block
<bucaran> test
<zenspider> only that the service call receives one
User458764 has joined #ruby
Renich has joined #ruby
senayar has joined #ruby
<bucaran> ytti: themes are working, but the time stamp color does not change, damn software
ghostpl has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
yfeldblum has joined #ruby
<yorickpeterse> morning
oo_ has quit [Remote host closed the connection]
<[k-> morning
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chridal has quit [Ping timeout: 250 seconds]
danielpclark has quit [Ping timeout: 276 seconds]
Siyfion has joined #ruby
ahmetkapikiran has joined #ruby
chridal has joined #ruby
bkxd has quit [Ping timeout: 264 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
postmodern has quit [Quit: Leaving]
marr has joined #ruby
bkxd has joined #ruby
<bucaran> > puts "hi"
EasyCo has quit [Quit: Connection closed for inactivity]
ahmetkapikiran has quit [Ping timeout: 252 seconds]
<bucaran> how can I type ruby code from here? is there like a bot or something roaming these channel?
ahmetkapikiran has joined #ruby
<flughafen> bucaran: it's in your console and it's called irb
car has joined #ruby
symm- has quit [Ping timeout: 264 seconds]
User458764 has joined #ruby
Igorshp has joined #ruby
pagios has joined #ruby
<bucaran> flughafen: some channels do have a bot that let you do this
<ljarvis> bucaran: you can use ruboto (the channel bot) by prepending >> -- however, that's just for demonstration purposes, you should use irb as flughafen says
<bucaran> flughafen: just asking if there is one in _this_ channel
<[k-> ?experiment
<ruboto> Please use your local irb or pry (see ?pry) to experiment, ruboto's eval functionality is for demonstration purposes only.
<pagios> hi guys, can i do something like currentConfig = [ "`ip route | awk '/default/ { print $3 }'`" ] , embed the result of a command directlyu in a array element?
<ljarvis> pagios: did you try it?
<pagios> i am checking if it is good practice
<ljarvis> if it works, it's fine
<bucaran> ljarvis: thanks
oo_ has joined #ruby
<pagios> it works, thanks
<ljarvis> pagios: you should use snake_case variable names though
<bucaran> bear w me, im a ruby newbie, so what is this "namespace" method/function in rails?
<bucaran> namespace :symbol do stuff end
<ljarvis> bucaran: pardon?
<adaedra> ?rails
<ruboto> Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<bucaran> wrong channel?
<ljarvis> bucaran: namespace is just a method, but yes for rails questions you should check out the other channel
<bucaran> well, I wonder if this is really a rails question tho
<ljarvis> the non-rails part I just answered
<bucaran> it's a method, K
<bucaran> thx
Igorshp has quit [Ping timeout: 252 seconds]
danielpclark has joined #ruby
pwnz0r has quit [Remote host closed the connection]
quimrstorres has joined #ruby
oo_ has quit [Ping timeout: 246 seconds]
lele has joined #ruby
al2o3-cr has joined #ruby
quimrstorres has quit [Remote host closed the connection]
lkba has quit [Ping timeout: 265 seconds]
andikr has joined #ruby
joneshf-laptop has quit [Ping timeout: 272 seconds]
<pagios> whats a quick way of creating an array of object like javascript: array = [ {name: 'X' ,age:'Y' } , {name: 'A' , age: 'B' } ] ?
<ljarvis> pagios: did you try the same thing in Ruby?
<pagios> lol no
<ljarvis> :/
<ljarvis> i guess you should probably *try* before you ask for help, as willing as we all are
<pagios> currentConfig = [ gateway: "`ip route | awk '/default/ { print $3 }'`" ]
<adaedra> you don't need "" around your command, `` is sufficient
<pagios> any difference between :gw or gw: /
<ljarvis> in a hash key? no
<ljarvis> >> { :foo => "bar" } == { foo: "bar" }
<ruboto> ljarvis # => true (https://eval.in/386665)
bluOxigen has quit [Ping timeout: 248 seconds]
oo_ has joined #ruby
<[k-> yay hash rockets!
<[k-> people use hash rockets for compatibility with 1.8
<[k-> so you should keep that in mind
<flughafen> i will forever be a hashrocketer
<[k-> 18>> {a:_""}
<ruboto> [k- # => /tmp/execpad-7c7e45f0272e/source-7c7e45f0272e:2: syntax error, unexpected tSYMBEG, expecting kDO or ...check link for more (https://eval.in/386666)
quimrstorres has joined #ruby
<adaedra> or because you want to have something else than a symbol as key
<[k-> 18>> {a:""}
<ruboto> [k- # => /tmp/execpad-f547fcf0357a/source-f547fcf0357a:2: syntax error, unexpected tSYMBEG, expecting kDO or ...check link for more (https://eval.in/386667)
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<[k-> turdurr
<[k-> the a: syntax doesn't work in 1.8
michael_mbp has quit [Excess Flood]
al2o3-cr has quit [Read error: Connection reset by peer]
<adaedra> or because the => syntax is more explicit (I use it in .join in Sequel, :fk => :id is more explicit)
michael_mbp has joined #ruby
<adaedra> (imo)
rubie has joined #ruby
<ljarvis> adaedra: than fk: :id?
<adaedra> yeah, there's the idea of the first pointing to the other one
<ljarvis> heh
<[k-> I prefer the a: syntax
<[k-> "": doesn't work as you expect, does it
abuzze has joined #ruby
olblak has joined #ruby
txdv_ is now known as txdv
<yorickpeterse> It does in 2.2
patrick_star has quit [Ping timeout: 244 seconds]
rubie has quit [Ping timeout: 265 seconds]
<ljarvis> not really, unless you actually expect it to be a symbol
<[k-> no, it just turns into a symbol (2.2.0p0)
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<adaedra> looks right to me
<yorickpeterse> >> def foo(a: 10); a; end; foo('a': 20)
<ruboto> yorickpeterse # => 20 (https://eval.in/386668)
<yorickpeterse> works fine
<GitGud> yes it does
al2o3-cr has joined #ruby
<ljarvis> that's an awful example. If someone new tried { "foo": "bar" } I *bet* they would expect it to be the same as { "foo" => "bar" }
A205B064 has quit [Ping timeout: 255 seconds]
<jesterfraud> it isn't? D:
<ljarvis> see
<ljarvis> imo they should have just not added it
<pagios> >> config = { gateway: "test" } config.gateway
<ruboto> pagios # => /tmp/execpad-7de3e8af7c7e/source-7de3e8af7c7e:2: syntax error, unexpected tIDENTIFIER, expecting key ...check link for more (https://eval.in/386669)
Xeago has joined #ruby
<yorickpeterse> ljarvis: well, blame Ruby for that
<ljarvis> yorickpeterse: I do :D
<yorickpeterse> blame it for not having proper kwargs and instead mapping it to hashes
<ljarvis> heh
atomical_ has joined #ruby
maxshelley has joined #ruby
<[k-> pagios, missing ;
<pagios> >> config = { gateway: "test" } ; config.gateway
platzhirsch has joined #ruby
<ruboto> pagios # => undefined method `gateway' for {:gateway=>"test"}:Hash (NoMethodError) ...check link for more (https://eval.in/386670)
<[k-> :p only in javascript
<pagios> ^ ljarvis :D
lordkryss has joined #ruby
<ljarvis> pagios: what?
<yorickpeterse> pagios: ehm, Ruby doesn't work like that
<pagios> it doesnt work like javascript
<ljarvis> ...
<ljarvis> I never said it did
<adaedra> ♪ >> require 'ostruct'; o = OpenStruct.new(gateway: "test"); o.gateway
<yorickpeterse> be grateful it doesn't work like Javascript
atomical has quit [Ping timeout: 248 seconds]
<adaedra> >> require 'ostruct'; o = OpenStruct.new(gateway: "test"); o.gateway
<ruboto> adaedra # => "test" (https://eval.in/386672)
<yorickpeterse> we'd have a terrible language _and_ a terrible stdlib
<[k-> ostruct is slow
<[k-> slow slow slow
<[k-> JavaScript has stdlib?
<adaedra> Go optimise it them
Xeago has quit [Ping timeout: 264 seconds]
<pagios> equiv in ruby?
withnale_ has joined #ruby
<ljarvis> pagios: do you have a book or something you're learning Ruby from?
atomical has joined #ruby
<yorickpeterse> adaedra: you have no idea how openstruct works right?
<ljarvis> this is very basic stuff
<[k-> I'm not going to maintain ostruct
<ljarvis> the speed is the least bad thing about openstruct
<adaedra> yorickpeterse: no really, I only use it
<adaedra> and not often enough to really care
oo_ has quit [Remote host closed the connection]
<[k-> plus, I don't have optimising knowledge
tomjoro has joined #ruby
<[k-> or the knowledge of the use case of ostruct
<yorickpeterse> ^ that is one of the reasons it sucks perf wise
<[k-> no wonder its slow
<adaedra> wouldn't a method_missing mapping to a hash be better?
<[k-> at least it's not method_missint
<[k-> no!
<adaedra> ok
<ljarvis> then you add overhead for *every* call
<adaedra> ah yes
<yorickpeterse> method_missing is slow
atomical_ has quit [Ping timeout: 248 seconds]
<flughafen> yay! got my package.
<adaedra> everything is slow
oo_ has joined #ruby
<ljarvis> it's true
<[k-> that's our world :/
eGGsha has joined #ruby
senayar has quit [Remote host closed the connection]
<jesterfraud> slow is relative
<yorickpeterse> https://eval.in/386674 example
yh has quit [Ping timeout: 264 seconds]
troulouliou_dev has quit [Remote host closed the connection]
ahmetkapikiran has quit [Quit: ahmetkapikiran]
<[k-> of what
blackmesa has joined #ruby
<yorickpeterse> err wait, I don't think I got that entirely right
yh has joined #ruby
<pagios> ljarvis: i know how to do it via Class decleration, any easier way|?
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<yorickpeterse> That "only" invalidates class/constant caches IIRC
senayar has joined #ruby
senayar has joined #ruby
Rollabunna has joined #ruby
<[k-> def an_instance.==
patrick_star has joined #ruby
<yorickpeterse> pagios: what are you trying to do?
<yorickpeterse> Ruby is not Javascript, you're not supposed to create random objects and define methods on them directly
<pagios> yo61: store an object with different properties and then access these properties :)
<yorickpeterse> That's common in a prototype based language such as JS/self, but not Ruby
<yorickpeterse> For Ruby you use classes, or Struct if you have to
<[k-> >> Class A; end; a = A.new; def a.== *args; true; end; a == Hash
<ruboto> [k- # => /tmp/execpad-362b91361538/source-362b91361538:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/386688)
<yorickpeterse> hey what the, seems OpenStruct on 2.2 doesn't flush global method caches anymore
<yorickpeterse> unless I'm doing dumb things
CustosLimen has joined #ruby
<yorickpeterse> either way it defines methods dynamically, so that's going to hurt in some shape or form
<[k-> Class A; end; a = A.new; def a.== *args; true; end; a == Hash;
skade has quit [Ping timeout: 264 seconds]
workmad3 has joined #ruby
<[k-> pls wait while I try this out
<ljarvis> pagios: you can use a Hash just like you've been doing
havenwood has quit [Ping timeout: 252 seconds]
terlar has joined #ruby
skade has joined #ruby
<[k-> it works!
<tomjoro> That's a common thing to do when passing options to a method.. but in new ruby you could also used named parameters which is cleaner
Rollabunna has quit [Ping timeout: 244 seconds]
roolo has joined #ruby
<yorickpeterse> [k-: eh yeah, you can define singleton methods on any objects
<yorickpeterse> * object
<[k-> you can actually monkey patch hash to accept .call
<[k-> >> class Hash; alias_method :call, :[]; end; a = {a: "b"}; a.(:a)
<ruboto> [k- # => "b" (https://eval.in/386711)
<[k-> turdurrrr
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jesterfraud> [k-, but why would you do that anyway?
<[k-> it is less elegant than [] tho
<jesterfraud> hashes are hashes, and you use them as such
<[k-> to make it resemble JavaScript ;-;
<adaedra> don;t
<adaedra> don't
<jesterfraud> that's a reason not to :P
<adaedra> js is js, ruby is ruby
<[k-> I'm obviously not going to use that
bronson has joined #ruby
ndrei has quit [Ping timeout: 264 seconds]
<[k-> I'm not sure what pagios wants ;-;
<pagios> hash hash
<pagios> works for me
<pagios> :D
skade has quit [Quit: Computer has gone to sleep.]
qiukun has joined #ruby
<[k-> OK :D
Xeago has joined #ruby
<qiukun> hi i’d like to find something like ipython for ruby
<qiukun> there are iruby
<[k-> what is this ipython
<qiukun> ipython notebook
ndrei has joined #ruby
<flughafen> [k-: it's like irb or the python interperter console but good
<qiukun> however iruby could use sth like %time
<[k-> why not submit a pull request!
skade has joined #ruby
<_mh_> IO.popen and co seems to set $? after the spawned child terminated. Is there any less ugly way to get the exitcode of a terminated child process?
<[k-> the Ruby community will <3 u
fantazo has joined #ruby
<qiukun> well, my coding power isnt that strong yet
<qiukun> <3
<[k-> the iruby team will review your code and suggest changes as long as you state that you aren't that good in ruby
multi_io has quit [Read error: Connection reset by peer]
<[k-> at least I hope so
Xeago has quit [Remote host closed the connection]
<_mh_> an iruby sounds very interesting.
bronson has quit [Ping timeout: 264 seconds]
<[k-> mh: require English ;-;
<bnagy> _mh_: check out Open3
sandstrom has quit [Quit: My computer has gone to sleep.]
<bnagy> there are a bunch of useful capture methods, depending on what else you want to know about the execution
_blizzy_ has quit [Ping timeout: 248 seconds]
<[k-> it looks cool
<bnagy> afaik you can't get a straight up code, though, you get a crappy Process::Status thing
<_mh_> Process::Status is fine... just $? is driving me nuts
<bnagy> I know, I hates it. :(
<_mh_> esp. as I can't get any document telling me how long this var survives :(
<[k-> you could just define a method that fetches it, although that would be costly
<bnagy> _mh_: until something else sets it
<bnagy> which I'm sure is hilarious if you're threading
multi_io has joined #ruby
<_mh_> yeah, likely :(
Xeago has joined #ruby
<_mh_> [k-: I would be curious as to how you would manually fetch it. the API doc doesn't yield anything I recognized.
<bnagy> I haven't looked at src for capture2 etc...
fabrice31 has quit [Remote host closed the connection]
sandstrom has joined #ruby
<bnagy> oh it just threads out itself and gets the return value from the Thread
<bnagy> that should actually be safe \o/
<_mh_> well... at least something.
fabrice31 has joined #ruby
<[k-> don't know, didnt use processes in my life
Xeago has quit [Remote host closed the connection]
Renich has quit [Quit: leaving]
<_mh_> Hmm... Process#waitpid2 using the pid of the io...
<_mh_> bnagy: that seems a usable approach, still ugly as hell, but better as $?
<bnagy> what are you trying to do?
<_mh_> bnagy: I just want to wait for a command to terminate and read it's exit code.
<bnagy> 17:22 < bnagy> _mh_: check out Open3
<_mh_> open3's another gem... adding gems to our project here at work is ... let's say interesting.
<bnagy> what?
<bnagy> it's stdlib
<_mh_> uuh? okay, I'm confusing it with something then. Cancel everything after good morning.
<_mh_> bnagy: going to look at it, thanks.
khebbie has joined #ruby
<bnagy> _b
<haudoing> hello
<Ox0dea> haudoing: Hau doing?
<ljarvis> heuheuheu
<[k-> haha
lugub has joined #ruby
<lugub> how do we read from stdin mid way through a program?
<lugub> like a getch
<[k-> gets
<lugub> AH
<lugub> thanks
<[k-> yw
<haudoing> Ox0dea: what's up
<Ox0dea> haudoing: I'm making Kernel.global_variables less of a liar. :)
oo_ has quit [Remote host closed the connection]
mandarinkin has joined #ruby
dcarmich has quit [Quit: Textual IRC Client: www.textualapp.com]
<yorickpeterse> lugub: make sure you call STDIN.gets
<yorickpeterse> not just "gets"
<yorickpeterse> because the 2 are different
<ljarvis> herp derp
CloCkWeRX has joined #ruby
<haudoing> Ox0dea: huh?
<[k-> those evil changes
<yorickpeterse> at least I recall there being some sort of difference
<bnagy> anyone know offhand is there's a measurable perf difference between "foo" and 'foo' for non-interpolated strings?
iamninja has quit [Ping timeout: 248 seconds]
<[k-> >> $>
<ruboto> [k- # => #<IO:<STDOUT>> (https://eval.in/386742)
<haudoing> help
<[k-> oh
<[k-> yes?
<yorickpeterse> bnagy: No
<ljarvis> bnagy: nope
<bnagy> it's the sort of thing we used to fret about years ago, but I thought it was a nonissue now
<yorickpeterse> bnagy: there is no performance difference
<[k-> bnagy, nonissue
<_mh_> bnagy: should be fine.
<[k-> ^
<bnagy> yorickpeterse: does it get caught by preprocessor / compiler?
<yorickpeterse> As in, the literal "foo" is exactly the same as 'foo'
<bnagy> yeah ok
<lugub> yorickpeterse: thanks. STDIN.gets = answer still isn't stopping for input though
<[k-> yes it does
<yorickpeterse> It's not until you add interpolation that it becomes different
<lugub> I mean answer = STDIN.gets
<yorickpeterse> lugub: `answer = STDIN.gets`
<[k-> escapes
<bnagy> what about the code path during creation?
<Ox0dea> >> [->{'foo'}, ->{"foo"}].map { |x| RubyVM::InstructionSequence.of(x).to_a }.reduce(:==)
<ruboto> Ox0dea # => true (https://eval.in/386743)
<Ox0dea> bnagy: They are literally the exact same bytecode.
<[k-> :/
<yorickpeterse> >> RubyVM::InstructionSequence.compile('"foo"').disasm
<ruboto> yorickpeterse # => "== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========\n0000 trace 1 ...check link for more (https://eval.in/386745)
<bnagy> after creation, yes
<yorickpeterse> >> RubyVM::InstructionSequence.compile("'foo'").disasm
<ruboto> yorickpeterse # => "== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========\n0000 trace 1 ...check link for more (https://eval.in/386746)
<yorickpeterse> ^ check links, instructions are exactly the same
<[k-> pls why so deep
<bnagy> thanks :)
<yorickpeterse> The bikeshedding occurs because people have no idea how to measure performance
<yorickpeterse> "OMG DOUBLE QUOTES SO SLOW SUCH IMPORTANT WOW"
<[k-> >> $<
<ruboto> [k- # => ARGF (https://eval.in/386748)
k3asd` has quit [Ping timeout: 256 seconds]
<[k-> >> p $stdin, stdin, STDIN
<ruboto> [k- # => undefined local variable or method `stdin' for main:Object (NameError) ...check link for more (https://eval.in/386749)
<lugub> yorickpeterse: could optsparse be taking away from gets?
<bnagy> yorickpeterse: yeah I'm having a half-argument with a friend on twitter and I was too lazy to check whether it's 'not worth worrying about' or "exactly the same"
<yorickpeterse> lugub: no idea, hard to tell without any code
yh has quit [Ping timeout: 265 seconds]
<yorickpeterse> bnagy: if they're argueing about it I recommend them to learn how to write a benchmark
<[k-> bnagy, throw them an article
<yorickpeterse> and learn something about statistics too
<lugub> It keeps looping with no option to input
<yorickpeterse> but yeah, the bikeshed occurs in lots of languages
<bnagy> I think they just haven't done serious ruby for years
<bnagy> haxors etc
<yorickpeterse> lugub: change "elsif" to "else"
<[k-> doesnt options parsing use ARGF
<ljarvis> lugub: gets includes the newline
asmodlol has joined #ruby
<yorickpeterse> and that ^
<[k-> or ARGV
<yorickpeterse> bnagy: I remember the same arguments from PHP
<lugub> OH. wow I totally missed that. thanks
<[k-> what's the diff between ARGF and V
<ljarvis> [k-: look at the documentation
z3uS has quit [Ping timeout: 255 seconds]
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
danielpclark has quit [Ping timeout: 244 seconds]
* [k- slogs to the docs
<bnagy> argf is for reading from pipes
<Ox0dea> ARGF is for reading everything.
<bnagy> if your command is pipelined
oo_ has joined #ruby
<ljarvis> yes ARGF is for reading any stdin
Cust0sLim3n has joined #ruby
<[k-> ARGF reads files
<Ox0dea> ARGF reads stdin and anything in ARGV that it can determine is a file.
khebbie has quit [Ping timeout: 272 seconds]
<apeiros> I think it actually treats everything in ARGV as a file
<apeiros> and will raise if it doesn't happen to be one
eGGsha has joined #ruby
<Ox0dea> You're right.
<apeiros> and Kernel#gets being ARGF.gets, and not $stdin.gets causes quite some trouble because of that
<ljarvis> yep
<Ox0dea> apeiros: ARGF isn't greedy, though.
<apeiros> greedy?
<ljarvis> ~% ruby -e 'p gets' -- foo
<ljarvis> -e:1:in `gets': No such file or directory @ rb_sysopen - foo (Errno::ENOENT)
<[k-> > If ARGV is empty, ARGFacts as if it contained STDIN, i.e. the data piped to your script. 
<ljarvis> WHAT BUG
hectortrope has quit [Quit: WeeChat 0.4.2]
<Ox0dea> It won't immediately attempt to read every argument as a file.
djbkd has joined #ruby
<[k-> I think my autocorrect jumped in
livathinos has joined #ruby
<Ox0dea> ARGF.read will raise if there are non-file arguments, but ARGF.readline won't, as an example.
<apeiros> Ox0dea: correct. like all IOs too, it'll only read when you actually tell it to :)
z3uS has joined #ruby
CustosLimen has quit [Ping timeout: 264 seconds]
<apeiros> um, readline will read, yes
<lugub> yorickpeterse: how come the second time around getc doesn't allow for input? do I need to clear a buffer or something?
asmodlol has quit [Quit: Leaving]
<apeiros> and it will also raise
<ljarvis> readline will raise too
<apeiros> $ ruby -e 'ARGF.readline' -- foo
<apeiros> -e:1:in `readline': No such file or directory @ rb_sysopen - foo (Errno::ENOENT)
Bertg has joined #ruby
<[k-> Error no entry :D
car has quit [Quit: Leaving]
<Ox0dea> Right, but if you had supplied two arguments, only the first of which was a file, it wouldn't have raised until a second call to readline.
<apeiros> anything which causes an actual read will raise
<Ox0dea> Yes.
<Ox0dea> Or, rather, it will raise if it can't rea.d
<apeiros> well, until the first file is completely read
<Ox0dea> *read.
<[k-> foo is a legit file in my computer
asmodlol has joined #ruby
<yorickpeterse> lugub: https://eval.in/386752
<lugub> yorickpeterse: thanks
djbkd has quit [Ping timeout: 265 seconds]
langlands has joined #ruby
* apeiros prefers $stdin/$stdout over STDIN/STDOUT
<apeiros> allows me to keep the constants as backup when I reassign the globals
<apeiros> also apart from gets using ARGF, Kernel methods use the globals too (e.g. puts uses $stdout, not STDOUT)
prinsen has quit [Quit: leaving]
<[k-> foo = nil; loop { foo = STDIN.gets; break if valid(foo) }; logic here
<ljarvis> wat
qiukun has quit [Quit: qiukun]
danielpclark has joined #ruby
<Ox0dea> How did I end up in ##c?
<adaedra> took a wrong turn
<yorickpeterse> a rather sharp turn
<yorickpeterse> oh wait, that would've been c#
<yorickpeterse> shit
<ljarvis> ##c#
<adaedra> yorickpeterse: heh
<[k-> you want to learn ##c to improve Ruby? :D
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea> I know enough C to be dangerous, and I would like to use that knowledge to pluck at some of the lower-hanging fruit in MRI.
<yorickpeterse> heh
<yorickpeterse> lower hanging fruit
<yorickpeterse> MRI
<yorickpeterse> heh
<Ox0dea> Heh.
hanmac1 has joined #ruby
<Ox0dea> The code is occasionally remarkably intertwined.
<Ox0dea> I'm pretty sure I understand how the RB_BLOCK_CALL_FUNC_ARGLIST macro works now, and it's one of the trickier parts.
zeroDi has joined #ruby
sevenseacat has quit [Quit: Me dun like you no more.]
Rollabunna has joined #ruby
<Ox0dea> MRI does a lot of what could rightly be called metaprogramming.
<Ox0dea> In C.
yh has joined #ruby
bucaran has quit [Ping timeout: 248 seconds]
<hanmac1> Ox0dea: so do you like macros? if yes, check this one out: https://github.com/Hanmac/rwx/blob/master/ext/wxWindow.cpp#L113 ... the macro is defined https://github.com/Hanmac/rwx/blob/master/ext/main.hpp#L490
zeroDivisible has quit [Ping timeout: 250 seconds]
<yorickpeterse> Ox0dea: parse.y is a fine example of MRI
<Ox0dea> yorickpeterse: We oughtn't judge a thing at its worst.
<zenspider> I don't want keyword _args_ I want keyword _methods_... like smalltalks
allenn has quit [Read error: Connection reset by peer]
Rollabunna has quit [Ping timeout: 248 seconds]
<Ox0dea> hanmac1: Token pasting is pretty nifty.
axl_ has quit [Read error: Connection reset by peer]
<Ox0dea> You might've taken it just past sane, though. :)
lkba has joined #ruby
<hanmac1> Ox0dea: hm where do i do "Token pasting"? my macro_attr is method generating
<Ox0dea> hanmac1: ## is token pasting.
axl_ has joined #ruby
<lugub> how come this is an invalid retry? retry if answer.downcase.eql?("y")
<hanmac1> ah that is what you mean ... its for turning Attr into _getAttr and _setAttr methods
<Ox0dea> lugub: Where do you expect the retry to retry from?
bucaran has joined #ruby
<Ox0dea> hanmac1: Yes, I know; "Attr" is the token in that case.
<[k-> retry has to be in a begin block right
<zenspider> just call ping again instead of retry
<hanmac1> shevy: did you see that? Ox0dea did validate i am " just past sane" ;P
<zenspider> also: 2 spaces per indent
dumdedum has quit [Quit: foo]
<lugub> zenspider: thanks yeah gist auto changed it
<[k-> don't use eql?
<lugub> how come the retry doesn't work?
<zenspider> don't. use. tabs. EVER.
<lugub> yeah I know gist did it
<zenspider> ew. yeah. don't use eql?
<lugub> why not?
<zenspider> no, you did it.
<Ox0dea> lugub: redo and retry can only be called from within rescue clauses.
<zenspider> it converted it to 8 spaces per tab. you made tabs.
<lugub> 0x0dea: thanks
* hanmac1 uses tabs but only for its C++ code
<lugub> oh you're right zenspider my bad
olistik has quit [Remote host closed the connection]
<zenspider> ping uri if answer.downcase == "y"
<[k-> sub classes usually don't override eql?
arup_r has joined #ruby
<[k-> don't you ever override equal?
<Ox0dea> lugub: They're intended to handle *exceptional* behavior, not just when some value doesn't meet some constraint.
<zenspider> Unlike ==, the equal? method should never be overridden by subclasses as it is
<zenspider> used to determine object identity (that is, a.equal?(b) if and only if a is
<zenspider> the same object as b):
sandstrom has quit [Quit: My computer has gone to sleep.]
<lugub> right
<[k-> it's in BasicObject
<lugub> I still have the original problem where I can't reget input if it loops again
<lugub> zenspider: right, I understand
<lugub> thanks :)
<[k-> if you type something and press enter, it will work
<Ox0dea> lugub: I suspect you're wanting the user to not have to press Enter to have their input processed, yes?
<lugub> 0x0dea: nope! just if they press y to ping again
<[k-> that wouldn't be easy to do
rob_ has left #ruby [#ruby]
<[k-> press y and enter
<lugub> and then if it fails ping again if they say y
<Ox0dea> lugub: There is a crucial difference between just pressing Y, or pressing Y and then Enter.
<[k-> you must press the enter key!
<hanmac1> [k-: eql? != equal?
<hanmac1> >> ["y".eql? "y", "y".equal? "y"]
<ruboto> hanmac1 # => /tmp/execpad-62b7aed93872/source-62b7aed93872:2: syntax error, unexpected tSTRING_BEG, expecting ']' ...check link for more (https://eval.in/386787)
<lugub> $:ruby healthcheck.rb
<lugub> Server http://localhost:12080/pages/index1.html responded with Not Found.
khebbie has joined #ruby
<lugub> Continue? (y/n)
<hanmac1> >> ["y".eql?("y"), "y".equal?("y")]
<lugub> y
<ruboto> hanmac1 # => [true, false] (https://eval.in/386788)
<lugub> Server http://localhost:12080/pages/index1.html responded with Not Found.
<[k-> hanmac, I never said they are the same
<lugub> Continue? (y/n)
<lugub> oh really?
<lugub> I press y and enter
<Ox0dea> Then your Enter is being picked up by STDIN.getc.
<lugub> ahhh
RegulationD has joined #ruby
<Ox0dea> Pressing Enter puts a newline into the input stream.
<[k-> I know they are different, but I never said they were the same
<lugub> so do I clear STDIN on each iteration?
<zenspider> either use gets or don't hit enter
Rickmasta has joined #ruby
<Ox0dea> Or require 'io/console' and use STDIN.getch.
<zenspider> or deal with bad input better
eGGsha has joined #ruby
<Ox0dea> lugub: Easiest would be to use STDIN.gets instead of STDIN.getc, and then just String#chomp off the newline before comparing the input with "y".
<lugub> right, I sorted. gets and answer.chomp!
<lugub> zenspider: its just a script, I don't need to worry about bad input
<lugub> thanks guys :D took a while
chinmay_dd has quit [Read error: Connection reset by peer]
chinmay_dd has joined #ruby
<lugub> there would be no memory worry because I'm calling ping on itself again right? is it good practice?
<bnagy> fwiw I write those a "Hit [enter] to continue, or ^C to abort"
<Ox0dea> lugub: You're using unbounded recursion, so your stack would overflow given enough invalid input.
ahmetkapikiran has joined #ruby
sepp2k has quit [Quit: Leaving.]
RegulationD has quit [Ping timeout: 248 seconds]
<bnagy> y/n is for when you have a choice of "do this or not" but you're going to continue anyway
<lugub> 0x0dea: what would be the best practice?
hectortrope has joined #ruby
<zenspider> that's a LOT of invalid input. doesn't matter here since "it's just a script"
aryaching has joined #ruby
<Ox0dea> Right, you would need *a lot* of invalid input before it became a problem.
sepp2k has joined #ruby
bosma has quit [Ping timeout: 255 seconds]
<lugub> yeah I thought so
<[k-> 3000+?
<Ox0dea> lugub: It's a really little thing, but not having to press Enter is a nice user experience.
<[k-> I prefer if you shift the user input out of ping
fabrice31 has quit [Remote host closed the connection]
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ziprar is now known as zipace
Zai00 has quit [Quit: Zai00]
roolo has quit [Remote host closed the connection]
grzywacz has quit [Ping timeout: 276 seconds]
Macaveli has joined #ruby
joneshf-laptop has joined #ruby
sdothum has joined #ruby
ItSANgo has joined #ruby
Xeago has joined #ruby
RandyT has joined #ruby
baxx has joined #ruby
Asher1 has joined #ruby
senayar has quit [Remote host closed the connection]
RandyT_ has quit [Ping timeout: 244 seconds]
ndrei has quit [Ping timeout: 272 seconds]
Soda has quit [Remote host closed the connection]
ItSANgo_ has quit [Ping timeout: 256 seconds]
connor_goodwolf has quit [Ping timeout: 252 seconds]
Xeago has quit [Ping timeout: 246 seconds]
<[k-> did he leave before my suggestion? ;-;
Asher has quit [Ping timeout: 272 seconds]
sandstrom has joined #ruby
<lugub> right I get you
<lugub> no I'm still here :)
fabrice31 has joined #ruby
withnale_ has quit [Read error: Connection reset by peer]
neohunter has joined #ruby
wildroman2 has quit [Remote host closed the connection]
<[k-> :3
nettoweb has joined #ruby
Miron has quit [Ping timeout: 252 seconds]
ndrei has joined #ruby
nofxx has quit [Ping timeout: 252 seconds]
connor_goodwolf has joined #ruby
phutchins has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fabrice31 has quit [Read error: Connection reset by peer]
haudoing has quit []
fabrice31_ has joined #ruby
datanoise has joined #ruby
ta has quit [Read error: Connection reset by peer]
fabrice3_ has joined #ruby
fabrice31_ has quit [Read error: Connection reset by peer]
ta has joined #ruby
oo_ has quit [Remote host closed the connection]
CloCkWeRX has quit [Ping timeout: 256 seconds]
datanoise has quit [Ping timeout: 264 seconds]
CloCkWeRX has joined #ruby
Rollabunna has joined #ruby
oo_ has joined #ruby
Miron has joined #ruby
kith_ is now known as kith
tvw has joined #ruby
axilla has joined #ruby
connor_goodwolf has quit [Read error: Connection reset by peer]
grzywacz has joined #ruby
rodfersou has joined #ruby
Rollabunna has quit [Ping timeout: 248 seconds]
danielpclark has quit [Ping timeout: 250 seconds]
<yh> Should a Ruby Gem specify in its Gemfile the exact version of dependencies it uses?
<jhass> yh: rubygems doesn't read Gemfile's
unclouded has quit [Ping timeout: 246 seconds]
<jhass> only .gemspec's
<yh> jhass: my bad, I did mean gemspec actually
<jhass> well, for determining a gem's dependencies that is these days
lennae has quit [Ping timeout: 272 seconds]
<yh> Otherwise, it's leaving the decision to the consuming application's Gemfile.lock, which seems to open it to fault if it was programmed to a version that had a bug patched, say
<jhass> and no, I'd say be as permissive as possible
maxshelley has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<yh> oh i see, ~> I'm guessing
<yh> oh, no
lkba has quit [Read error: Connection reset by peer]
lkba has joined #ruby
unsymbol_ has quit [Quit: cheerio]
Miron has quit [Ping timeout: 276 seconds]
unsymbol has joined #ruby
diegoviola has joined #ruby
ndrei has quit [Ping timeout: 264 seconds]
mtakkman has joined #ruby
eregon_ is now known as eregon
tkuchiki_ has quit [Remote host closed the connection]
Ox0dea has left #ruby ["WeeChat 1.3-dev"]
ndrei has joined #ruby
hanmac1 has quit [Ping timeout: 244 seconds]
iceyec has joined #ruby
Miron has joined #ruby
iceyec has quit [Client Quit]
tkuchiki has quit [Ping timeout: 255 seconds]
oo_ has quit [Remote host closed the connection]
Miron has quit [Excess Flood]
CloCkWeRX has quit [Ping timeout: 256 seconds]
danielpclark has joined #ruby
rodferso1 has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<yorickpeterse> question that will get me frowns: is there something like Builder but for generating Ruby source code?
bucaran has quit [Quit: Lost terminal]
<yorickpeterse> (as a String that is)
livathinos has quit []
<white_bear> i guess there is no way to comment array items when using %w[] syntax, right?
Scrofff has quit [Read error: Connection reset by peer]
Scroff has joined #ruby
fabrice3_ has quit [Read error: Connection reset by peer]
rodfersou has quit [Ping timeout: 246 seconds]
fabrice31 has joined #ruby
dgutierrez1287 has joined #ruby
<yorickpeterse> I know there's unparser, but that is a bit too heavy for my taste
negev has joined #ruby
<yorickpeterse> (too many deps and what not, also depends on "parser" which I don't want)
hck89 has joined #ruby
hck89 has quit [Client Quit]
zeroDi has quit [Ping timeout: 256 seconds]
iamninja has joined #ruby
khebbie has joined #ruby
oo_ has joined #ruby
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Zai00 has joined #ruby
Miron has joined #ruby
rodferso1 has quit [Quit: leaving]
negev has quit [Quit: leaving]
Zai00 has quit [Read error: Connection reset by peer]
rodfersou has joined #ruby
olistik has joined #ruby
Zai00 has joined #ruby
oo_ has quit [Remote host closed the connection]
Miron has quit [Ping timeout: 252 seconds]
oo_ has joined #ruby
husanu has quit [Remote host closed the connection]
husanu has joined #ruby
eGGsha has joined #ruby
sgambino has joined #ruby
Xeago has joined #ruby
Zai00 has quit [Read error: Connection reset by peer]
oo_ has quit [Remote host closed the connection]
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[k-> white_bear: try it
atom3 has quit [Ping timeout: 276 seconds]
<white_bear> [k-: i ask because it doesn't work :p
zeroDi has joined #ruby
atom3 has joined #ruby
<apeiros> white_bear: no comments within %w
Miron has joined #ruby
rubie has joined #ruby
michael_mbp has quit [Excess Flood]
<white_bear> right, that's what i thought. will stick with [ 'foo' 'bar' ] then
Xeago has quit [Ping timeout: 272 seconds]
<white_bear> can't use symbols because of "-" characters
<apeiros> can
<apeiros> >> :"foo-bar"
<ruboto> apeiros # => :"foo-bar" (https://eval.in/386849)
<apeiros> any valid utf-8 string can be used as a symbol
<white_bear> i meant without quotes :p
<adaedra> >> :"
<ruboto> adaedra # => :
<adaedra> interesting
oo_ has joined #ruby
<white_bear> the purpose of %w is not using quotes, so... :D
<apeiros> it is also a string array
<apeiros> %I/%i is for symbol arrays
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
michael_mbp has joined #ruby
<adaedra> >> %i[hello-world
<ruboto> adaedra # => [:"hello-world", :
cytoskeletor has joined #ruby
rubie has quit [Ping timeout: 265 seconds]
withnale_ has joined #ruby
n3vtelen has quit [Ping timeout: 264 seconds]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fabrice31 has quit [Remote host closed the connection]
ndrei has quit [Ping timeout: 244 seconds]
Xeago has joined #ruby
fabrice31 has joined #ruby
senayar has joined #ruby
senayar has joined #ruby
serivich has joined #ruby
yfeldblum has quit [Ping timeout: 248 seconds]
blackmesa has quit [Quit: WeeChat 1.2]
rodfersou has quit [Quit: leaving]
rodfersou has joined #ruby
ringarin has joined #ruby
Iskarlar has joined #ruby
blackmesa has joined #ruby
<[k-> ^
<ringarin> do I simply run `gem update bundler` to address : http://blog.rubygems.org/2015/05/14/CVE-2015-3900.html
quimrstorres has quit [Remote host closed the connection]
<white_bear> what's the difference between %I and %i (double-quotes vs single?)
<[k-> there is no diff between double and single quotes
<[k-> >> ''
<ruboto> [k- # => "" (https://eval.in/386859)
<ljarvis> white_bear yes one supports interpolation
<[k-> '' will be converted to ""
<adaedra> [k-: there's a diff
<[k-> '' is called the literal string iirc
<ljarvis> [k-: white_bear is clearly asking about %I vs %i
<white_bear> that explains why adaedra's example outputs "" while using %i
Xeago has quit [Remote host closed the connection]
<[k-> :/
<ljarvis> and there's a difference in that %I supports interpolation (thus, making it like " and not like ')
mtakkman has quit [Ping timeout: 246 seconds]
Zai00 has joined #ruby
<adaedra> >> a = 'h'; [ %i[a#{h}], %I[a#{h}] ]
<ruboto> adaedra # => undefined local variable or method `h' for main:Object (NameError) ...check link for more (https://eval.in/386861)
<adaedra> >> h = 'h'; [ %i[a#{h}], %I[a#{h}] ]
<ruboto> adaedra # => [[:"a\#{h}"], [:ah]] (https://eval.in/386862)
Bertg has joined #ruby
Rollabunna has joined #ruby
<[k-> >> %&lalalalalala&
<ruboto> [k- # => "lalalalalala" (https://eval.in/386864)
<adaedra> %I is to %i what %Q is to %q
Xeago has joined #ruby
lxsameer has quit [Quit: Leaving]
dorei has joined #ruby
mdw has joined #ruby
zeroDivisible has joined #ruby
ndrei has joined #ruby
sevenseacat has joined #ruby
Rollabunna has quit [Ping timeout: 252 seconds]
maxshelley has joined #ruby
zeroDi has quit [Ping timeout: 272 seconds]
Zai00 has quit [Read error: Connection reset by peer]
Zai00 has joined #ruby
Zai00 has quit [Read error: Connection reset by peer]
doertedev has joined #ruby
c355E3B has joined #ruby
rbennacer has joined #ruby
commondream has joined #ruby
yh has quit [Ping timeout: 265 seconds]
oo_ has quit [Remote host closed the connection]
Xeago has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kotk has quit [Quit: Leaving...]
DroidBurgundy has joined #ruby
Xeago has joined #ruby
commondream has quit [Ping timeout: 248 seconds]
n008f4g_ has joined #ruby
RegulationD has joined #ruby
oo_ has joined #ruby
unclouded has joined #ruby
ldnunes has joined #ruby
codecop has joined #ruby
x44x45x41x4E has quit [Ping timeout: 272 seconds]
cytoskeletor has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cytoskeletor has joined #ruby
Zai00 has joined #ruby
RegulationD has quit [Ping timeout: 255 seconds]
luzidco_ has joined #ruby
SOLDIERz has joined #ruby
psy_ has quit [Ping timeout: 250 seconds]
rodferso1 has joined #ruby
fabrice31_ has joined #ruby
luzidco_ has quit [Client Quit]
blackmesa has quit [Ping timeout: 255 seconds]
langland_ has joined #ruby
<ringarin> do I simply run `gem update bundler` to address : http://blog.rubygems.org/2015/05/14/CVE-2015-3900.html
<jhass> ringarin: that's an issue in Rubygems, not Bundler
rodfersou has quit [Ping timeout: 276 seconds]
<jhass> gem update --system
SOLDIERz has quit [Ping timeout: 246 seconds]
fabrice31 has quit [Ping timeout: 272 seconds]
danielpclark has quit [Ping timeout: 248 seconds]
langlands has quit [Ping timeout: 264 seconds]
bronson has joined #ruby
arup_r has quit [Remote host closed the connection]
rbennacer has quit [Remote host closed the connection]
wildroman2 has joined #ruby
mdw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bhorn1 has quit [Read error: Connection reset by peer]
oo_ has quit [Remote host closed the connection]
roolo has joined #ruby
arup_r has joined #ruby
oo_ has joined #ruby
cajone has joined #ruby
cajone has left #ruby [#ruby]
quimrstorres has joined #ruby
bronson has quit [Ping timeout: 248 seconds]
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
_blizzy_ has joined #ruby
startupality has joined #ruby
datanoise has joined #ruby
danielpclark has joined #ruby
yardenbar has quit [Ping timeout: 256 seconds]
pikpok has joined #ruby
ahmetkapikiran has quit [Quit: ahmetkapikiran]
GitGud has quit [Ping timeout: 252 seconds]
arup_r has quit [Remote host closed the connection]
oo_ has quit [Remote host closed the connection]
grzywacz has left #ruby [":wq"]
oo_ has joined #ruby
eGGsha has joined #ruby
cytoskeletor has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
CloCkWeRX has joined #ruby
segfalt has quit [Quit: segfalt]
arup_r has joined #ruby
Igorshp has joined #ruby
k3asd` has joined #ruby
ahmetkapikiran has joined #ruby
Iskarlar has joined #ruby
mary5030 has joined #ruby
tkuchiki has joined #ruby
yardenbar has joined #ruby
ivorpad has quit [Quit: Textual IRC Client: www.textualapp.com]
soxet has joined #ruby
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Rollabunna has joined #ruby
<yorickpeterse> hrmpf, distributed synchronization using AWS autoscaling tags is an interesting problem
* yorickpeterse checks if he didn't put drugs in his tea this morning
thelastinuit has joined #ruby
bkxd has quit [Ping timeout: 244 seconds]
<yorickpeterse> this would be nicer if AWS had some sort of CAS operation for their API
<yorickpeterse> but alas
IanV0rn has joined #ruby
x44x45x41x4E has joined #ruby
DroidBur_ has joined #ruby
DroidBurgundy has quit [Read error: Connection reset by peer]
terlar has quit [Ping timeout: 246 seconds]
<shevy> hanmac, yeah; if there is one guy that is even crazier than you are, it is Ox0dea
Rollabunna has quit [Ping timeout: 248 seconds]
neohunter has quit [Ping timeout: 246 seconds]
I has joined #ruby
DroidBur_ is now known as droidburgundy
I is now known as Guest54477
denver has joined #ruby
ndrei has quit [Ping timeout: 246 seconds]
ndrei has joined #ruby
ashemark has joined #ruby
langlands has joined #ruby
<[k-> ^
ruv has joined #ruby
ashemark has quit [Client Quit]
yardenbar has quit [Ping timeout: 256 seconds]
ringarin has quit [Ping timeout: 276 seconds]
langland_ has quit [Ping timeout: 250 seconds]
zeroDi has joined #ruby
Bertg has joined #ruby
shredding has joined #ruby
chinmay_dd has quit [Read error: Connection reset by peer]
jpfuentes2 has joined #ruby
chinmay_dd has joined #ruby
zeroDivisible has quit [Ping timeout: 256 seconds]
terlar has joined #ruby
hectortrope has quit [Quit: WeeChat 0.4.2]
last_staff has joined #ruby
treehug88 has joined #ruby
roolo_ has joined #ruby
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby
RegulationD has joined #ruby
dgutierrez1287 has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rbennacer has joined #ruby
ahmetkapikiran has quit [Quit: ahmetkapikiran]
dblessing has joined #ruby
roolo has quit [Ping timeout: 244 seconds]
datanoise has quit [Ping timeout: 248 seconds]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
whippythellama has joined #ruby
<shevy> I'd wish ruby would somehow be simpler to use extensively
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Guest54477 has quit [Quit: This computer has gone to sleep]
<shevy> Something opinionated that is streamlined.
RegulationD has quit [Ping timeout: 255 seconds]
<shevy> for instance, i find myself to use this here a lot:
<shevy> RbConfig::CONFIG['sitelibdir']+'/foobar/'
<shevy> for a gem project called foobar
yh has joined #ruby
<shevy> any better way to obtain the base directory for a project?
Rickmasta has joined #ruby
JoshL has joined #ruby
<[k-> sitelibdir?
<ljarvis> shevy: that isn't accurate..
nateberkopec has joined #ruby
ndrei has quit [Ping timeout: 265 seconds]
Bertg has joined #ruby
endash has joined #ruby
<ljarvis> just use File.expand_path('..', __FILE__)
devdazed has quit [Quit: Computer has gone to sleep.]
<yorickpeterse> that isn't much more accurate either
<ljarvis> at least it'll point to the file and not *anything*
<ljarvis> i don't even know what "base directory for a project" means though
<adaedra> just use __dur__ ?
<adaedra> __dir__*
senayar has quit [Remote host closed the connection]
<shevy> lemme test
Xeago has quit [Remote host closed the connection]
<[k-> it's funny we have __LINE__ __FILE__ but dir is __dir__
tomjoro has quit [Remote host closed the connection]
<adaedra> iirc, it's because __LINE__ and __FILE__ are keywords, not __dir__
Igorshp has quit [Remote host closed the connection]
<ljarvis> yeah __dir__ is a method
fmcgeough has joined #ruby
oo_ has quit [Remote host closed the connection]
<[k-> guess it doesn't make sense for dir to be a keyword
scripore has joined #ruby
ndrei has joined #ruby
endash has quit [Quit: endash]
malconis has joined #ruby
abuzze has quit [Remote host closed the connection]
<shevy> your two solutions do not work
yardenbar has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy> they refer to the specific file in question rather than the base directory for a project
<ljarvis> shevy: what are you actually trying to do?
<shevy> RbConfig::CONFIG['sitelibdir']+'/foobar/' <-- always yields to you the base directory of a given project
Xeago has joined #ruby
<ljarvis> no
<shevy> your solution does?
<ljarvis> it doesn't
<ljarvis> what is "the base directory of a given project"
<ljarvis> what does that even mean?
<shevy> what is so hard to understand
<shevy> you have a project called "foobar"
<shevy> it'll be installed into the SITE_DIR
malconis has quit [Remote host closed the connection]
<ljarvis> a project? Ruby has no concept of "project"
<shevy> everything works relative to site dir
<shevy> require 'foobar' # there we go
havenwood has joined #ruby
<ljarvis> sigh
<shevy> so could you now please provide an alternative?
lugub has quit [Quit: Bye]
<[k-> $LOAD_PATH?
fabrice31 has joined #ruby
<shevy> I think that'll just be an Array of all the paths respectively that ruby will search through
<adaedra> Your base dir has to be defined somewhere, as it is not something native to ruby
fabrice31_ has quit [Read error: Connection reset by peer]
<ccooke> shevy: correct. What are you actually doing with this directory once you have calculated it?
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy> ccooke I use it to load all files that belong to said project
CloCkWeRX has quit [Ping timeout: 256 seconds]
abuzze has joined #ruby
jerius has joined #ruby
<shevy> adaedra I usually follow a simple scheme, main-name like module Foo, path would be foo/ and there will be a foo.rb respectively
yh__ has joined #ruby
ta has quit [Remote host closed the connection]
<shevy> In the past I used Pathname
rubie has joined #ruby
<ccooke> shevy: so basically you want to load some ruby code that exists in a directory structure?
fgo has joined #ruby
<shevy> ccooke yeah but it is already a gem actually; all my projects are essentially gems, mostly (save for some old code)
<ljarvis> OH
<ljarvis> it's a gem is it?
<ljarvis> thanks for mentioning that
<shevy> all. my. projects. are. gems
<shevy> and I use setup.rb for installation as well
<shevy> all the structures I use are gem-compatible as well
<adaedra> I. feel. anger. in. there.
<shevy> and I can install them with or without gem
* ljarvis walks away
<sevenseacat> lol
<shevy> yeah because ljarvis isn't helping
hectortrope has joined #ruby
Xeago has quit [Remote host closed the connection]
<adaedra> yeah, of course.
<ccooke> shevy: that wasn't clear. The use of "Project" instead of "gem" is confusing, especially when people ask what you mean by "project" (Which is not a defined term in Ruby). So, you have a gem that needs to load dependant things automatically.
senayar has joined #ruby
senayar has joined #ruby
<shevy> no, I have a project that can be like a gem
Bertg has joined #ruby
<shevy> and no, it does not "need" to load anything; everything already works just fine
<sevenseacat> *like* a gem?
<shevy> <shevy> any better way to obtain the base directory for a project?
<adaedra> If it ain't broken, don't fix it
malconis has joined #ruby
<shevy> adaedra yeah that is fine, I can retain the current way but I am wondering if there are better ways
<ccooke> shevy: __FILE__ on the root .rb file of the project.
yh has quit [Ping timeout: 264 seconds]
<ccooke> That is the most accurate way to be sure.
<shevy> ah
<shevy> I see what you mean
Iskarlar has joined #ruby
<shevy> I was using it on a file one directory structure down
Igorshp has joined #ruby
<shevy> ok
bentanweihao has joined #ruby
<adaedra> File.expand_path is here to help with relativity to a given path...
<ccooke> Set it to a constant in the root .rb, then refer to it from the loaded file?
bruno- has quit [Ping timeout: 276 seconds]
<ccooke> that way you have an easy way to load it, at least.
<shevy> ccooke yeah
blackmesa has joined #ruby
ziprar has joined #ruby
<shevy> that way it'll give the correct path
<ccooke> Foo::BASEDIR is - if loading things from a base directory is important - perfectly reasonable.
rubie has quit [Ping timeout: 265 seconds]
<[k-> why not use json!
<ccooke> and it's a *lot* less to type :-)
<[k-> then it's extensible!
<shevy> thanks
lxsameer has joined #ruby
konsolebox has quit [Ping timeout: 272 seconds]
lxsameer has quit [Changing host]
lxsameer has joined #ruby
husanu has quit [Remote host closed the connection]
husanu has joined #ruby
ahmetkapikiran has joined #ruby
nettoweb has joined #ruby
GarethAdams has quit [Ping timeout: 252 seconds]
bentanweihao has quit [Client Quit]
zipace has quit [Ping timeout: 255 seconds]
luzidco has joined #ruby
abuzze_ has joined #ruby
<mikecmpbll> is there a more sensible way to implement a min_by method that returns all the members of the collection that share the same min value than: array.select{ |x| x.foo == array.min_by { |y| y.foo }.foo } ?
Xeago has joined #ruby
roolo has joined #ruby
<apeiros> mikecmpbll: for starters, only find the min value once
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<adaedra> yeah, save the min in a variable and just select on x.foo == min
<apeiros> instead of on every iteration
<mikecmpbll> this is true.
jpfuentes2 has joined #ruby
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
crazydiamond has quit [Remote host closed the connection]
iceyec has joined #ruby
<mikecmpbll> thanks :)
<[k-> array.lazy.map(&:foo).select { |x| x == min }
abuzze has quit [Ping timeout: 256 seconds]
<adaedra> don't really need this .lazy
JakFrist has joined #ruby
GarethAdams has joined #ruby
Rollabunna has joined #ruby
<adaedra> and this only returns you a table of the min value
<adaedra> s/table/array/
<mikecmpbll> yeah, that's a problem.
einarj has joined #ruby
<mikecmpbll> i'll go with what i had but with the optimisation.
roolo_ has quit [Ping timeout: 256 seconds]
<adaedra> it's not a bad way, just don't calculate the min at each time.
<mikecmpbll> indeed.
<apeiros> if it proves to be too slow, there's 2 alternatives. but I would only try those routes if min_by followed by select is indeed too slow.
<mikecmpbll> nah, not slow just aiming for readability and general making sense-ness.
<apeiros> then definitively this solution.
soulcake has quit [Ping timeout: 277 seconds]
<mikecmpbll> ok thanks :)
<[k-> aww
jpfuentes2 has quit [Ping timeout: 252 seconds]
CloCkWeRX has joined #ruby
<[k-> .lazy ensures it doesn't loop twice
eGGsha has joined #ruby
soulcake has joined #ruby
<[k-> I wish Ruby had currying sometimes
drewvanstone has joined #ruby
<apeiros> [k-: it'll probably still be slower, though
mtakkman has joined #ruby
<adaedra> anyway, it doesn't return any sensible value in your sample
yh__ has quit [Quit: Lost terminal]
<[k-> yuh
fantazo has quit [Ping timeout: 255 seconds]
konsolebox has joined #ruby
<[k-> goodie!
Rollabunna has quit [Ping timeout: 248 seconds]
Tai15 has joined #ruby
k3asd` has quit [Ping timeout: 264 seconds]
<mikecmpbll> :D
mrmargolis has joined #ruby
Igorshp has quit [Remote host closed the connection]
devdazed has joined #ruby
msnyon has joined #ruby
enebo has joined #ruby
drewvanstone has quit [Quit: leaving]
<_mh_> yeah, ruby has curry. Discovered a bit ago.
<_mh_> not found myself using it much, as ruby's programming style is somewhat different, but still it's nice to have it at your fingertips
<shevy> _mh_ that's weird isn't it? when a feature in ruby somehow does not seem to fit into other aspects of how one could use or write ruby code
<[k-> what does this mean
<shevy> I am having that a lot with that -> lambda
<jhass> [k-: that you broke ruby
<shevy> [k- is that valid syntax?
<[k-> there is -@
<[k-> so I think it's valid
<jhass> nope
<jhass> those are all special cases
<[k-> nope?
<apeiros> only -@ and +@
<[k-> :(
<shevy> :D
<apeiros> no idea why not for !@ and ~@ too
<apeiros> as those are prefixed as well
<shevy> !!!
charliesome has joined #ruby
ndrei has quit [Ping timeout: 252 seconds]
<shevy> [k- now you could file a FEATURE REQUEST at bugs.ruby-lang.org/projects/ruby-trunk
<havenwood> ~ and ! too
mduk has quit [Quit: WeeChat 0.3.7]
<adaedra> apeiros: because there is no ambiguity with a binary operator
<shevy> hmm
<[k-> alias method -@ hehe
<havenwood> ah, you already said
<havenwood> apeiros: You're too fast with two working arms!
ndrei has joined #ruby
abuzze_ has quit [Remote host closed the connection]
subtwo has quit [Quit: (null)]
davedev24_ has joined #ruby
<shevy> and a working nose
<[k-> I guess so
<[k-> feature request it is
Channel6 has joined #ruby
<apeiros> adaedra: still. I'd be consistent
* [k- adds to to-do
jtdoncas has joined #ruby
<apeiros> define prefixed ops with <sigil>@, define all ordinary methods with just the name
<_mh_> shevy: exactly taht.
<shevy> :)
<apeiros> havenwood: yeah! brace yourselves :D
einarj has quit [Ping timeout: 246 seconds]
* apeiros goes take a nap
<apeiros> ;-)
<adaedra> the banhammer is out
<jhass> apeiros: so you're also in the "all self modifying methods should end with !" camp? :P
<[k-> only certain symbols should be allowed
<apeiros> jhass: hm, not really
einarj has joined #ruby
<[k-> we shouldn't have "@
<jhass> but it'd be consistent!
<apeiros> but I understand the sentiment
<shevy> [k- hey... class variables have two of them!
<jhass> (I'm not btw ;) )
<apeiros> but personally I'm not a fan of ! and ? for method names in general
droidbur_ has joined #ruby
<shevy> I love ?
<shevy> do not take it away from me!
<apeiros> I liked it at the beginning, but changed my mind
<[k-> I like ?
<apeiros> I do still like =, though
<[k-> that's the only thing you can guarantee the type without checking!
<apeiros> you can't
<[k-> convention...
<apeiros> >> def fooled?; "totally!"; end; fooled?
<ruboto> apeiros # => "totally!" (https://eval.in/387002)
<[k-> booooo
chinmay_dd has quit [Remote host closed the connection]
<[k-> you deserve a slap for not following convention
mrmargolis has quit []
<apeiros> there's plenty of people who advocate not converting the return value of ? methods to boolean, instead just use the truthiness of whatever you query
<apeiros> (which I find horrible - it's a potential leak)
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[k-> :/
<apeiros> [k-: oh, I do. my ? methods strictly return true/false.
* apeiros is right back
<apeiros> would that be `/me irb`?
<[k-> we should have <@> while we are at it
<[k-> html!
arup_r has quit [Remote host closed the connection]
<ytti> i don't see added value of adding
<apeiros> that'd be quite confusing to say in a ruby channel, huh? :D
<ytti> if last_line
<havenwood> >> 42.nonzero?
<ruboto> havenwood # => 42 (https://eval.in/387008)
ValicekB has quit [Ping timeout: 272 seconds]
<[k-> whyyyyyyy
eGGsha has joined #ruby
<jhass> haha
<apeiros> File.size? is another example
<[k-> >> 0.non_zero?
<ruboto> [k- # => undefined method `non_zero?' for 0:Fixnum (NoMethodError) ...check link for more (https://eval.in/387009)
droidburgundy has quit [Ping timeout: 255 seconds]
livathinos has joined #ruby
<[k-> 0.nonzero?
<[k-> bleh
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
einarj_ has joined #ruby
<[k-> why do they not follow conventions
<jhass> [k-: ssh, I gave you a place to experiment
<havenwood> [k-: The convention is a truthy value. 42 is truthy.
<ytti> how does
<[k-> we should shove them out of the window when Ruby 3 comes
<ytti> 42 ? true : false
<ytti> avoid leak
einarj has quit [Read error: Connection reset by peer]
Synthead has joined #ruby
<ytti> what is the leak? information leak?
<apeiros> ytti: in the case of an immediate, there's no leak
<ytti> or object which may get mutated?
<apeiros> x = foo.query?
droidbur_ has quit [Ping timeout: 256 seconds]
<[k-> >> !!0.nonzero?
<ruboto> [k- # => false (https://eval.in/387011)
DoubleMalt has joined #ruby
<[k-> :)
<apeiros> if x is any non trivial datastructure, you've just added a reference and prevent GC
<ddv> my convention might be different than yours
<[k-> we should !! all methods? now
<havenwood> [k-: 0.nonzero? is already: #=> false
abuzze has joined #ruby
<havenwood> nil
<havenwood> rather
<havenwood> falsey
<[k-> UGH WHY
s2013 has joined #ruby
<apeiros> anyway, brb!
Cust0sLim3n has quit [Ping timeout: 246 seconds]
doublemalt_ has quit [Ping timeout: 246 seconds]
<havenwood> >> 0.nonzero?
<ruboto> havenwood # => nil (https://eval.in/387018)
<[k-> we should really throw these away
<havenwood> [k-: Because the method ends with a `?` do the return value is truthy or falsey.
abuzze_ has joined #ruby
micmus has joined #ruby
<[k-> we should have a method blacklist
husanu has quit [Remote host closed the connection]
griffindy has joined #ruby
<havenwood> [k-: So `nil` or `false` are one option, and the other option is anything else.
JakFrist has joined #ruby
commondream has joined #ruby
Scroff has quit [Remote host closed the connection]
husanu has joined #ruby
<[k-> but then if we want a Boolean we have to !!
<havenwood> [k-: What's wrong with how it is?
<havenwood> [k-: Why do you want true instead of truthiness?
mrmargolis has joined #ruby
Xeago has quit [Remote host closed the connection]
<[k-> case things; when true
<[k-> does 42===true
<[k-> I think not
Scroff has joined #ruby
jtdoncas has quit [Ping timeout: 255 seconds]
aryaching has quit [Read error: Connection reset by peer]
<havenwood> >> :no_problem if 42
<ruboto> havenwood # => :no_problem (https://eval.in/387024)
aryaching has joined #ruby
datanoise has joined #ruby
<havenwood> [k-: It's how Ruby works. It may be unintuitive for you at first but it's not surprising when you're accustomed.
Hounddog has quit [Read error: Connection reset by peer]
chinmay_dd has joined #ruby
Xeago has joined #ruby
sanguisdex has joined #ruby
<[k-> ;-;
soulcake has quit [Ping timeout: 276 seconds]
abuzze has quit [Ping timeout: 252 seconds]
mtakkman has quit [Ping timeout: 246 seconds]
<[k-> that's why I prefer staticly typed
ivorpad has joined #ruby
<[k-> staticallg
<[k-> derp
ValicekB_ has joined #ruby
soulcake has joined #ruby
ValicekB_ is now known as ValicekB
husanu1 has joined #ruby
kristofferR has joined #ruby
abuzze_ has quit [Remote host closed the connection]
RegulationD has joined #ruby
bruno- has joined #ruby
shredding has quit [Ping timeout: 272 seconds]
livathinos has quit []
<apeiros> stalactite typing?
<jhass> crystal is doing that a lot more for ? methods, it even has Hash#[]? ;D
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros> pondered having appended ? as a generic boolean conversion in my toy lang
sfarley has joined #ruby
denver has quit [Ping timeout: 272 seconds]
<apeiros> sooo, what did I want to work on?
<adaedra> ruby
<havenwood> [k-: I say it's not surprising once you're accustomed but a few years ago Rails had a kerfuffle where some folk argued for `true` and `false`. They were rebuffed but it comes up.
Xeago has quit [Remote host closed the connection]
<jhass> chronos for crystal
<apeiros> adaedra: that'd be "with", not "on" :)
<adaedra> nuclear weapons
<adaedra> HELLO NSA
<apeiros> nucular
<[k-> kerfuffle?
denver has joined #ruby
<apeiros> I think I'll work on my valaptor lib. need that for quite a couple of things :)
<[k-> crystal's type system isn't doing enough imo
<shevy> velociraptor
<[k-> we need return types of methods!
<jhass> [k-: it's there
<[k-> :o
<[k-> I only ever seen def a (b: type)
<apeiros> jhass: that'd probably be fun. I hate how limiting time is :(
<[k-> that's a bit ugly
<[k-> but ohwells
<ddv> [k- always wants stuff that is already available
<[k-> yes that's why I'm into Haskell
<[k-> it's not like language cannot be improved
<havenwood> [k-: It seems all the features you want do exist though. You just don't know about them!
IanV0rn has quit [Excess Flood]
thelastinuit has quit [Ping timeout: 256 seconds]
_axx has joined #ruby
<[k-> well there are Contracts for ruby
<[k-> those gems that you plug in
axl__ has joined #ruby
<havenwood> Not DRY.
IanV0rn has joined #ruby
thelastinuit has joined #ruby
<havenwood> But potentially useful nonetheless.
<apeiros> [k-: contracts? as in DBC?
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<[k-> dbc?
<apeiros> design by contract
eGGsha has quit [Quit: Textual IRC Client: www.textualapp.com]
<apeiros> pre-, postconditions and invariants
<havenwood> [k-: See Mirah or Crystal if you're yearning for types. Or upcoming versions of Rubinius and Ruby may have some variant of optional/gradual/soft typing.
<[k-> dbc on github? no
<[k-> I've seen where you type Contract on top of defs
mduk has joined #ruby
<[k-> like decorators
darkf has quit [Quit: Leaving]
<[k-> yessss
<apeiros> jhass: oh, that'd probably be something which would totally get me into crystal - if they added DBC + command/query separation
<apeiros> (the latter is a necessity for the former as far as I can see it)
jshepherd has joined #ruby
adamjleonard has joined #ruby
<jhass> apeiros: mmh, they seek to stabilize the language, work's more going into stdlib and fixing compiler bugs these days
findaway has joined #ruby
<ddv> elixir <3
<havenwood> ddv: \o/
<apeiros> I wonder whether I'll revisit eiffel one day
andikr has quit [Remote host closed the connection]
Kricir has joined #ruby
mary5030 has quit [Remote host closed the connection]
<apeiros> from what I remember it was pretty nice
<[k-> crystal looks like scalla
rjno has joined #ruby
<[k-> Scala*
tagrudev has quit [Remote host closed the connection]
<jhass> wat
mary5030 has joined #ruby
aganov has quit [Remote host closed the connection]
axl_ is now known as nua
<[k-> a little
chinmay_dd has quit []
<ddv> [k-: why?
<[k-> var:Type
<adaedra> typescript has that too
<adaedra> rust also, iirc
Xeago has joined #ruby
Igorshp has joined #ruby
Papierkorb has joined #ruby
sevenseacat has quit [Quit: Me dun like you no more.]
einarj has joined #ruby
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
langlands has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
einarj_ has quit [Ping timeout: 252 seconds]
<[k-> i myself prefer haskell's way of doing it
IanV0rn has joined #ruby
<[k-> the ::
<jhass> foo :: Type is a definition in crystal
<havenwood> Speaking of Elixir, Erlang/OTP 18 released today.
jamesaxl has joined #ruby
volty has joined #ruby
<yorickpeterse> dat error message
<[k-> is it only for variables?
<jhass> where else would it make sense?
<adaedra> for half-radioactive vietnamese turtles
<[k-> I thought I was convinced to learn crystal
<[k-> but meh
acke has quit [Remote host closed the connection]
<havenwood> [k-: Because?
<adaedra> because haskell is better, duh
<ddv> [k-: why are you even in this channel?
Scroff has quit [Read error: Connection reset by peer]
<[k-> because I also Ruby?
Scroff has joined #ruby
<[k-> your accusation was hurtful tho.
<ddv> what accusation?
<[k-> 'why are you even in this channel'
<[k-> maybe accusation is the wrong word
c0ncealed has quit [Remote host closed the connection]
<[k-> but hurtful nonetheless
Palmer11 has joined #ruby
<ddv> did I hurt your feelings?
renier has quit [Quit: Textual IRC Client: www.textualapp.com]
<volty> what's going on here, a love story ? :)
<[k-> somewhat
gambl0re has joined #ruby
segfalt has joined #ruby
Rollabunna has joined #ruby
<ddv> lol
ndrei has quit [Ping timeout: 246 seconds]
Soda has joined #ruby
<apeiros> what do you folks think about emoji for passwords?
<havenwood> apeiros: :)
einarj_ has joined #ruby
<havenwood> uh... for it!
<apeiros> serious question
<adaedra> undoable
<txdv> how do jo write them out
<ddv> apeiros: easy to brute force
<apeiros> txdv: on apple devices - nothing easier than that
einarj has quit [Ping timeout: 264 seconds]
cpruitt has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
<apeiros> txdv: cmd-ctrl-space brings up the emoji palette
<adaedra> apeiros: not everywhere
droidburgundy has joined #ruby
<havenwood> apeiros: Rename the computers and any network devices to Emoji names too.
<ddv>
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soxet has quit [Ping timeout: 246 seconds]
<apeiros> havenwood: not talking about that ;-)
<adaedra>
<havenwood> I have whether git is dirty change the emoji in my prompt. I like that.
<havenwood> Emoji ALL THE PLACES \o/
<ddv> I didn't even know there was a emoij palette
<apeiros> I think using emojis for passwords is ingenious
<ddv> lol
<adaedra>
<adaedra> noes*
<apeiros> entropy goes high up, and it's easy to remember
<txdv> apeiros: once you are not on an apple computer you will have trouble writing them
<apeiros> that'd be the pro's
atomical_ has joined #ruby
<[k-> don't broadcast ssid and use emojis
<apeiros> contras: hard to tell somebody else your password when needed (might actually be a pro :-p)
<[k-> no one will ever guess!
<adaedra> until you invert
ahmetkapikiran has quit [Quit: ahmetkapikiran]
<apeiros> txdv: good point. contra: potential difficult entry if you're on a foreign device
<volty> I think better go with chinese logosyllabic — much more choice, much more fantasy
ClassyCritic has joined #ruby
Rollabunna has quit [Ping timeout: 248 seconds]
droidburgundy has quit [Remote host closed the connection]
<ClassyCritic> Hey guys, I'm getting this error when I'm trying to scrape NCAA soccer teams: https://gist.github.com/AthleteInvictus/e27798233e78fd38dd6e
<apeiros> volty: that's actually in the same area of thought. increase entropy by using characters beyond the ascii range
<havenwood> ClassyCritic: Forbidden! 403 Forbidden (OpenURI::HTTPError)
startupality has quit [Read error: Connection reset by peer]
<apeiros> I do wonder though - a cracker could consider the max entropy to still be 256, by treating it as binary. even a bit less, by treating it as "anything valid utf-8". no?
<ClassyCritic> havenwood: yes, that's the problem I'm receiving
<ClassyCritic> havenwood: I'm new to Ruby, and I'm not quite sure how to fix it
k3asd` has joined #ruby
startupality has joined #ruby
<[k-> China will crack your password no problem
<volty> that's true — total length of n bytes can still be reduced to cracking just that bytes
<volty> s/can still/ is/
<adaedra> This is an HTTP error ClassyCritic, your distant service don't want you to access what you're trying to access
<ClassyCritic> adaedra: so no way around?
atomical has quit [Ping timeout: 248 seconds]
AlexRussia has quit [Remote host closed the connection]
<adaedra> not ruby-side, I'd say - except if you have a problem in your request building
<adaedra> try to access it with curl -v (url)
<jhass> ClassyCritic: there's always a way around. Though if they make it hard consider if it's legal
x44x45x41x4E has quit [Remote host closed the connection]
sdwrage has joined #ruby
symm- has joined #ruby
<ClassyCritic> jhass: Just trying to draw some mens soccer statistics from the NCAA website
<volty> I remember the first time I was trying to crypto something, shifting, rolling, moving, and at the end in the binary I had the same password shown over the space chars :)
ahmetkapikiran has joined #ruby
<volty> (or zeroes, can't remember)
<havenwood> ClassyCritic: For example if they forbid certain user agent strings, you could change yours to something they don't forbid. As already mentioned, examine the legality before you bypass being forbidden.
<Tai15> that's an interesting thought. i use passphrases already and speak Chinese. It never occured to me to use a Chinese passphrase.
<havenwood> Tai15: :)
fantazo has joined #ruby
<adaedra> makes sense, if you're sure you can type it anywhere you may need
<Tai15> and I use traditional characters. those commies would be completely fooled!
<adaedra> “commies”
senayar has quit [Remote host closed the connection]
I has joined #ruby
pontiki has joined #ruby
coderhs has joined #ruby
I is now known as Guest37459
<Tai15> sorry, a bad joke adaedra, HK and Taiwan use different characters than communist china
* jhass makes his next password out of box drawing characters
<adaedra> Tai15: ah ok
<apeiros> jhass: tetronomicon password :D
<volty> maybe drawing chinese ideograms on a bitmap. but as apeiros pointed out, for a cracker it's just a sequence of bytes / chars / whatevers
<jhass> mmh, or all these lovely different spaces
unshadow has quit [Quit: leaving]
umgrosscol has joined #ruby
<jhass> narrow non-breaking space zero width space wide space
atomical_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros> oh, fez calls it "tetronimo"
scripore has quit [Quit: This computer has gone to sleep]
coderhs has quit [Client Quit]
<apeiros> jhass: yeah, there's at least 8 of them
<apeiros> (spaces)
<adaedra> all those spaces
<pontiki> ooooo, one for every day of the week plus a spare!
<jhass> RTL mark could be a fun addition too
psy_ has joined #ruby
anisha has quit [Quit: Leaving]
<adaedra> poor RTL
<jhass> my password is all spaces, but from right to left!
<apeiros> haha
yalue has quit [Read error: Connection reset by peer]
atomical has joined #ruby
droidburgundy has joined #ruby
<Tai15> brilliant jhass
connor_goodwolf has joined #ruby
<shevy> unicode spaces?
<adaedra> meh, I keep hunter2, at least it's easy to type.
freerobby has joined #ruby
Iskarlar has joined #ruby
<shevy> no
<shevy> you are french
<shevy> it would be:
<shevy> unter2
<Tai15> adaedra, that just showed up as ******* for me
<dudedudeman> oonter2*
<jhass> reminds me I should try to learn neo2 again, which has all kind of nice symbols accessible
finisherr has joined #ruby
<adaedra> shevy: …
<shevy> lol Tai15
sinkensabe has quit [Remote host closed the connection]
AlexRussia has joined #ruby
<adaedra> Tai15: of course it did, IRC protect my password
<adaedra> *+s
* Tai15 nods
<apeiros> I use a single space as password everywhere.
<apeiros> nobody ever tries that :o)
<jhass> I wonder how many sites you can trip with trailing space
<shevy> I think some require more minimal characters
<jhass> like stripping it during input but not during validation or vice versa
<shevy> I had to change my gmail password to 9 characters... I hated that
scripore has joined #ruby
<jhass> shevy: just use a sentence, you're easily beyond 20
<apeiros> shevy: I would hate it too if I had to reduce the length of my password
jpfuentes2 has joined #ruby
<shevy> jhass but then I'd type even more!!!
<Tai15> i use a password manager that's a 20 character mix of random upper,lower, and numbers
volty has quit [Ping timeout: 246 seconds]
<apeiros> shevy: you type your passwords?!? o0
<Tai15> i'm amazed at how many sites i have to manually chop off 4 characters for it
<shevy> apeiros yeah
<apeiros> well…
<apeiros> Tai15: yeah
<Tai15> and then they yell at me that I need a special character
<adaedra> I type my passwords too
volty has joined #ruby
<Tai15> >:-(
<adaedra> I trust no password manager
<apeiros> it's annoying how many sites think they have to add an upper limit to pw length
<apeiros> I mean, 255 I'd understand
ValicekB has quit []
<apeiros> but anything below it just doesn't make sense.
<pontiki> the stored field is likely 255 anyway :>
<shevy> do you want to use shakespeare as password?
<adaedra> It's hashed anyway
<[k-> they have databases types to fulfill
JoshL has quit [Read error: Connection reset by peer]
<apeiros> storage can't be the reason either if they're doing it correctly.
<[k-> they also have space restrictions
<Tai15> idk, my password manager is only for online stuff so I figure it's not the weakest link
<apeiros> the hash will be the same length, no matter how long the pw
<Tai15> my local encryption is all diceware passwords
<shevy> Tai15 YOU are the weakest link :)
<adaedra> all passwords have the same length in DB...
JoshL has joined #ruby
<[k-> oh
snockerton has joined #ruby
<jhass> adaedra: or so you hope ;D
* Tai15 stares at the wrench in the corner
<[k-> huehuehue
<Tai15> yup
troulouliou_dev has joined #ruby
icebourg has joined #ruby
ahmetkapikiran has quit [Quit: ahmetkapikiran]
senayar has joined #ruby
Macaveli has joined #ruby
<apeiros> hrm
<apeiros> trying to find a good way to define allowed characters in a password validator…
<adaedra> /./
<yorickpeterse> why would you disallow anything in the first place?
<apeiros> pondering to just use e.g. `characters: %w[L M N]`, where the values are anything which is valid in \p{} regex
<yorickpeterse> unless you store things in plain text it shouldn
<yorickpeterse> * shouldn't matter
<Aria> Yeah. Passwords = bytes.
<apeiros> yorickpeterse: *I* wouldn't
<apeiros> plenty of orgs seem to, though
<Aria> So as long as you're consistent with encoding -- and you should be -- I say don't restrict.
<apeiros> e.g. because they can't handle it on all systems
<apeiros> (our company e.g. fails at anything non-ascii somewhere in the ldap auth :-S)
<yorickpeterse> wtf
<adaedra> wtff
<ddv> wtf
<apeiros> nah, this is for a validator, i.e. not a specific case.
<Aria> Fun.
<apeiros> like this: `password_validator = Valaptor.validate(:password).using minimum: 8, dictionaries: %[top10k english]`
Agoldfish has joined #ruby
<volty> the character set should be limited at the expense of the length
freerobby has quit [Quit: Leaving.]
freerobby has joined #ruby
<apeiros> the default for characters would probably be \p{Any}
endash has joined #ruby
endash has quit [Client Quit]
lkba has quit [Read error: Connection reset by peer]
<volty> n * (set) === 2 * n * (set / 2)
<apeiros> and encoding: 'utf-8'
rbennacer has quit [Read error: Connection reset by peer]
motivated has joined #ruby
dorei has quit [Remote host closed the connection]
rbennacer has joined #ruby
Macaveli has quit [Ping timeout: 276 seconds]
<dudedudeman> how the eff does one test for datetime in minitest
<motivated> how to learn the oops concept?
<apeiros> motivated: practice
Guest37459 has quit [Quit: Leaving]
terlar has quit [Ping timeout: 244 seconds]
<shevy> motivated thing of ants
<shevy> erm, *think
Xeago has quit [Remote host closed the connection]
dopie has joined #ruby
<volty> naaa, not ants
dorei has joined #ruby
<volty> absolutely
fabrice31 has quit [Remote host closed the connection]
<shevy> class Ant
[k-_ has joined #ruby
<shevy> ant_452356 = Ant.new
<shevy> ant_452357 = Ant.new
[k-_ is now known as [k
Scroff has quit [Read error: Connection reset by peer]
railsraider has quit [Quit: railsraider]
Scroff has joined #ruby
<volty> the best example for learning oop is geometry — position (coordinates), point, shape, etc etc
<motivated> where i can practice?
<volty> nothing better than that
jlast has joined #ruby
hahuang65 has joined #ruby
Xeago has joined #ruby
speakingcode has quit [Ping timeout: 246 seconds]
<volty> motivated: on your desk?
<Tai15> hey, while i'm hanging out with you guys, does anyone have any experience with any of the tools like RUBYMOTION that allow you to write cross-platform apps in Ruby
<apeiros> Tai15: #rubymotion has plenty I'd guess ;-)
<Tai15> or just experience with writing apps in ruby at all
nickfausnight has quit [Quit: Connection closed for inactivity]
<jhass> ?anyone ;)
<ruboto> ;), Just ask your question, if anyone has or can, they will respond.
<shevy> it should not be too difficult to have it work on linux and windows at the same time
<jhass> ups
<Tai15> oh, there's a whole channel? sweet, thank you, kind sir/ma'am
<shevy> yeah ma'am
<shevy> the lady apieros
<[k> but anyone is referring to everybody!
<shevy> nobody is referring to anyone
<[k> its much better then zeroing to one person
<shevy> they could zero in on one person :)
kristofferR has quit [Quit: Textual IRC Client: www.textualapp.com]
sshuff has joined #ruby
<Tai15> i didn't really have a question about it specifically, just wondered if anyone had any opinions about which ones worked well. i'm thinking about trying my hand at some app development for a speciality market, and ruby is my strongest language
<Tai15> ...and I just realized I responded to a bot
<shevy> ?anyone jhass would now tell you about anyone
<ruboto> jhass, Just ask your question, if anyone has or can, they will respond.
<Tai15> ._.
luzidco has left #ruby [#ruby]
<shevy> damn, that bot truncates
principessa has joined #ruby
<shevy> Tai15 happened to someone else too, about yesterday or so
nettoweb has joined #ruby
<shevy> ruboto just looks so clever and innocent
<Tai15> hehe, thanks shevy :-)
hahuang65 has quit [Ping timeout: 256 seconds]
scripore has quit [Quit: This computer has gone to sleep]
droidburgundy has quit [Remote host closed the connection]
<volty> shevy: have you done something with ruboto ?
<volty> or somebody else, here ?
<shevy> volty I haven't
scripore has joined #ruby
<apeiros> shevy: it doesn't truncate. the command is simply `?<factoid> <target nickname>`
<_blizzy_> hmm, RestClient or Faraday
codecop has quit [Remote host closed the connection]
Rollabunna has joined #ruby
<motivated> i wanted to do
<jhass> I think http is the new hip thing
<[k> we have a just http?
<[k> level 10 succinctness!
ClassyCritic has quit [Ping timeout: 256 seconds]
droidburgundy has joined #ruby
mhi^ has left #ruby [#ruby]
<jhass> I like faraday because I can just swap out the adapter as needed
<volty> motivated: maybe better you state what already you know.
<jhass> though some people had issues with it I heard
uber has quit [Ping timeout: 246 seconds]
Tai15 has quit [Read error: Connection reset by peer]
djbkd has joined #ruby
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby
iamninja has quit [Read error: Connection reset by peer]
sinkensabe has joined #ruby
iamninja has joined #ruby
Or1on has joined #ruby
t0rrieri has joined #ruby
djbkd has quit [Ping timeout: 255 seconds]
Tai15 has joined #ruby
B1n4r10 has joined #ruby
droidburgundy has quit [Remote host closed the connection]
<mikecmpbll> i find that chaining syntax really crappy.
dgutierrez1287 has joined #ruby
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lolmaus has joined #ruby
droidburgundy has joined #ruby
gauke has quit [Quit: gauke]
pengin has joined #ruby
khebbie has joined #ruby
dopie has left #ruby ["Leaving"]
uber has joined #ruby
konsolebox has quit [Quit: Leaving]
l0oky has joined #ruby
<l0oky> Hello :)
<[k> hello
khebbie has quit [Client Quit]
volty has quit [Ping timeout: 272 seconds]
<[k> (some people dont like it if you complain about ruby here)
dgutierrez1287 has quit [Ping timeout: 264 seconds]
<l0oky> Will this " unless params[:group] " check If not params[:group] is defined? or do I have to say it to ruby diffrently?
<l0oky> [k: you talking to me ? :D
<apeiros> grmpf, somehow my construct seems too verbose :-|
<l0oky> I like ruby :)
quimrstorres has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
atom3 has quit [Ping timeout: 276 seconds]
tkuchiki has quit [Remote host closed the connection]
<[k> l0oky: no
<apeiros> l0oky: yes
atom3 has joined #ruby
<l0oky> hahah
<l0oky> yes no yes... no?
<apeiros> l0oky: `unless expression` is (almost) identical to `if !(expression)`
<[k> params will check if :group is defined
<[k> but not the unless
adamjleonard has quit [Quit: Leaving...]
<[k> and it'll throw an error
<l0oky> apeiros: I am not talking about a unless keyword
<apeiros> though, it will not check "definedness"
<[k> you should use .key?
<apeiros> l0oky: well, params[:group] will simply look up the key
<l0oky> if It's not defined?
<apeiros> no
<[k> throw an error
husanu1 has quit [Remote host closed the connection]
<apeiros> l0oky: actually - what *is* params? a hash?
<l0oky> It wouldn't do like false
<apeiros> or are we talking about rails? then it'd be a HashWithIndifferentAccess
<l0oky> if you ever used rails its a string parameter passed at the url
jamesaxl_ has joined #ruby
<[k> i don't recommend you using if/unless params[:group]
jamesaxl has quit [Ping timeout: 250 seconds]
<l0oky> yeah that..
<apeiros> ok, so rails. and no, params is not a string ;-)
<l0oky> :P
<apeiros> ok, params HWIA has normal []. it looks up a key and returns the value
<apeiros> if the key is not in the hash, it returns nil
<apeiros> and nil is falsy
<l0oky> .nil?
<[k> oh it doesnt throw an error? i confused it with fetch
<apeiros> >> if nil then 1 else 2 end
<ruboto> apeiros # => 2 (https://eval.in/387070)
<[k> (╯°□°)╯︵ ┻━┻
<apeiros> l0oky: ^ nil is falsy, as said
<apeiros> [k: you can make it raise an error if you want :)
<l0oky> ty :)
<apeiros> params = Hash.new { |_h, k| raise KeyError, "Key not found: #{k.inspect}" }
creakybones has joined #ruby
creakybones has joined #ruby
acke has joined #ruby
<l0oky> Hash is very much like json
<l0oky> is js
<apeiros> l0oky: very much not.
<l0oky> in*
sinkensabe has quit [Remote host closed the connection]
sfarley has quit [Remote host closed the connection]
<apeiros> JSON is serialized data.
<apeiros> a hash is not serialized.
<l0oky> Does that mean JSON is better? ?
r0bby_ has joined #ruby
<l0oky> :D
pengin has quit [Remote host closed the connection]
<apeiros> oh dear
<apeiros> no, it doesn't mean that.
<l0oky> JK
<pontiki> flee!! FLEEEEE!!!!
<l0oky> HAHHA
<Tai15> hehe
<havenwood> Ruby Object Notation (RON) is different than JavaScript Object Notation (JSON).
<adaedra> !quote l0oky
sinkensabe has joined #ruby
Igorshp has quit [Remote host closed the connection]
langlands has joined #ruby
sfarley has joined #ruby
GitGud has joined #ruby
Iskarlar has joined #ruby
<l0oky> Well both serve the same purpose and they're different in nature i guess
r0bby_ has quit [Client Quit]
Or1on has quit [Ping timeout: 244 seconds]
<havenwood> l0oky: Are you familiar with YAML, Marshal, etc?
endash has joined #ruby
<l0oky> havenwood: not really.. :D
<startupality> what requirements is gmail using for threading, does it decide only on subject and senders, or it includes in-reply-to, references header to decide which email should be in the same thread with which?
<l0oky> YAML actually a template engine?
robbyoconnor has quit [Ping timeout: 272 seconds]
<l0oky> I think I've used it in node.js express
ndrei has joined #ruby
diegoviola has quit [Ping timeout: 255 seconds]
<Sou|cutter> startupality: mostly seems like subject to me.
volty has joined #ruby
<havenwood> l0oky: Check the docs for them and you'll see they're actually the serialization business.
lkba has joined #ruby
<startupality> Sou|cutter: excelt t
<startupality> except that it is not
<l0oky> ty
<startupality> there is something more and it doesnt seem that participants is enough either
<startupality> i am finding contrasting info online about this
Scroff has quit [Remote host closed the connection]
<havenwood> l0oky: Another serialization option that's a gem instead of in the stdlib would be MessagePack, for example: http://msgpack.org/
<[k> there is also PStore
chinmay_dd has joined #ruby
ReK2 has joined #ruby
ReK2 has joined #ruby
<[k> which is in the stdlib
<havenwood> [k: That's transactional Marshal.
acke has quit [Remote host closed the connection]
ramfjord has joined #ruby
<havenwood> [k: That's not a different serialization.
<havenwood> [k: Its equivalent for YAML is YAML::Store.
<[k> :/
<havenwood> [k: Marshal is to PStore as YAML is to YAML::Store.
Scroff has joined #ruby
OrbitalKitten has joined #ruby
St1gma has joined #ruby
<havenwood> *transactional storage to a file
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<l0oky> What would the `||=` operator mean here: `@current_user ||= User.find(session[:user_id]) if session[:user_id]` ? Thanks :P
d0lph1n98 has joined #ruby
fgo has quit [Ping timeout: 272 seconds]
<havenwood> Transactional YAML to DB too: http://ruby-doc.org/stdlib/libdoc/yaml/rdoc/YAML/DBM.html
<havenwood> YAML::DBM
jud has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
slawrence00 has joined #ruby
volty_ has joined #ruby
d0lph1n98 has quit [Client Quit]
freerobby has quit [Quit: Leaving.]
commondream has quit [Remote host closed the connection]
asmodlol has quit [Ping timeout: 250 seconds]
volty has quit [Ping timeout: 256 seconds]
baweaver has joined #ruby
fgo has joined #ruby
asmodlol has joined #ruby
fgo has quit [Client Quit]
yardenbar has quit [Quit: Leaving]
droidburgundy has quit [Ping timeout: 255 seconds]
prosodyContext_ is now known as prosodyContext
scripore has quit [Quit: This computer has gone to sleep]
<[k> l0oky: it means @current_user = (@current_user || User.find(session[:user_id]) if session[:user_id]
aryaching has quit []
<[k> i forgot a ) there
<havenwood> l0oky: @current_user || @current_user = ...
<[k> oh
aryaching has joined #ruby
<[k> i stand corrected then
<[k> i thought it always assigns
diego3 has joined #ruby
sfarley has quit [Remote host closed the connection]
diego3 has quit [Changing host]
diego3 has joined #ruby
Pwnna has left #ruby ["Leaving"]
<[k> A common misconception is that a ||= b is equivalent to a = a || b, but it behaves like a || a = b
<[k> i thought it was the second in the first place
<[k> but i got corrected by an article before
asmodlol has quit [Ping timeout: 265 seconds]
s2013 has joined #ruby
<[k> so i switched to the first
<[k> @.@
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
towski_ has joined #ruby
acke has joined #ruby
asmodlol has joined #ruby
<[k> i'll just remember it as short-curcuiting again
<apeiros> [k: well, generally `a <op>= b` indeed expands to `a = a <op> b`
<apeiros> but &&= and ||= are the two exceptions
<[k> pls no
<[k> i alrdy know this
<l0oky> havenwood: So rails doesn't query the second time cool
<[k> they always correct me!
<l0oky> ty
<[k> and my brain gets it wrong!
<apeiros> :)
<apeiros> it's all about eliminating a potential foo= method call.
<[k> i have long known that ruby can short curcuit
einarj_ has quit [Ping timeout: 244 seconds]
einarj has joined #ruby
<apeiros> other than that, the two are equivalent
zeroDivisible has joined #ruby
<apeiros> with variables (no foo= assignment method) it makes no difference
<[k> luckily, ifs are not a method call, or else they would be expensive
mrmargol_ has joined #ruby
<[k> wait, how does that stack up in rubinius?
<[k> are ifs in rubinius a method call?
<[k> are they expensive?
Lucky_ has joined #ruby
zeroDi has quit [Ping timeout: 255 seconds]
muhammadn has joined #ruby
<muhammadn> Hi
mrmargolis has quit [Ping timeout: 256 seconds]
<muhammadn> I have a ruby code (not rails!) that benchmarks mongodb but i can't seem to have the data persisted..
peter_paule has joined #ruby
geilt has joined #ruby
<adaedra> “(not rails!)” :)
<[k> mongodb and data persistance...
<muhammadn> adaedra: take a look at my gist. :)
<adaedra> Already did
<adaedra> Don't see anything wrong, but I'm no mongodb expert :)
Luun has joined #ruby
<[k> i recommend 2000.times do |i|
stan has quit [Ping timeout: 256 seconds]
<[k> for loops are discouraged
Siyfion has quit [Quit: Textual IRC Client: www.textualapp.com]
<dx7> adaedra: where is the mongoid.yml?
<muhammadn> ok
<adaedra> why do you ask me, dx7
lxsameer has quit [Quit: Leaving]
<muhammadn> dx7, you have to created in a directory config/mongoid.yml
<apeiros> does this look sensible? https://gist.github.com/apeiros/f78b5e30d3486b258957
<[k> you also have a ridiculously long method arguments
asmodlol has quit [Ping timeout: 264 seconds]
Luun has quit [Remote host closed the connection]
ramfjord has joined #ruby
Luun has joined #ruby
<muhammadn> dx7: i have included in the gist - https://gist.github.com/muhammadn/b16a6b5d8396a3ee8283
sinkensabe has quit [Remote host closed the connection]
<muhammadn> [k: yeah.
einarj has quit [Read error: Connection reset by peer]
einarj has joined #ruby
<[k> what you should do is to split it into multiple lines if you have no choice
asmodlol has joined #ruby
<apeiros> alternatively pondering to allow `process_port = validate_input | adapt_port | validate_port` (use | like a pipe, instead of the .then)
sfarley has joined #ruby
rubie has joined #ruby
railsraider has joined #ruby
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
diego3 is now known as diegoviola
scripore has joined #ruby
<dx7> muhammadn: are you setting the environment to "staging"?
rodferso1 is now known as rodfersou|lunch
<muhammadn> dx7: yeah. export RACK_ENV="staging"
<muhammadn> dx7: actually it can be anything depending on mongoid.yml
white_bear has quit [Quit: leaving]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
alex88 has quit []
langland_ has joined #ruby
Bertg has joined #ruby
startupality has quit [Read error: Connection reset by peer]
pietr0 has joined #ruby
startupality has joined #ruby
dfockler has joined #ruby
joonty has quit [Quit: joonty]
langlands has quit [Ping timeout: 256 seconds]
<dx7> muhammadn: I ran it here and everything works fine
<dx7> $ RACK_ENV=staging ruby test.rb
<dx7> Time elapsed: 2.727871 seconds.
<dx7> PageView created:
<dx7> 2000
<muhammadn> dx7: what does mongotest collection show you?
Xiti has quit [Quit: Xiti]
DoubleMalt has quit [Ping timeout: 256 seconds]
<muhammadn> dx7: use mongotest db.mongotest.find()
OrbitalKitten has joined #ruby
jtdowney_ is now known as jtdowney
DexterLB has quit [Read error: Connection reset by peer]
<muhammadn> dx7: do you see any documents directly inside mongodb?
<muhammadn> dx7: i mean mongo shell
JoshL has quit [Read error: Connection reset by peer]
Papierkorb has quit [Quit: ArchLinux completes an endless loop faster than any other distro!]
dangerousdave has joined #ruby
<dx7> muhammadn: 1 min
JoshL has joined #ruby
StephenOTT has joined #ruby
cndiv has joined #ruby
<apeiros> hm, nobody got an opinion on https://gist.github.com/apeiros/f78b5e30d3486b258957 ? :(
<dangerousdave> hello
<apeiros> hi dangerousdave
<jhass> apeiros: that means it's good, nothing to profi.. er criticize ;)
<dangerousdave> apeiros: how are you?
<apeiros> dangerousdave: fine, fine. and you?
<apeiros> jhass: hrm, I guess that's one way to see it
<dangerousdave> not bad at all
<dx7> muhammadn: 2000 documents
choke has joined #ruby
<muhammadn> dx7: all created on your end?
<dangerousdave> hoping things will be better once I can get some help with what I am sure is a silly mistake https://gist.github.com/deathwishdave/17fbc7aceac1ad0667f3
<muhammadn> dx7: hmm.. mine is not appearing
<dx7> muhammadn: you need to do: "use mongotest" to use the database
StephenOTT has quit [Client Quit]
<dangerousdave> why is key undefined?
<muhammadn> dx7: i did in the mongodb shell
<dx7> muhammadn: after that you need to verify the collection, not the database again
volty_ has quit [Ping timeout: 256 seconds]
<dx7> muhammadn: then to this: "db.page_views.count();"
DexterLB has joined #ruby
<dx7> or as you want: db.page_views.find();
rafaelsa_ has quit []
<apeiros> dangerousdave: well, I don't see any definition for "key" in your SharedFile class
<apeiros> dangerousdave: did you forget to add `attr_reader :key`?
<muhammadn> dx7: how stupid of me. i did db.mongotest.find() instead of db.page_view.find()
<muhammadn> dx7: how stupid of me. i did db.mongotest.find() instead of db.page_views.find()
<[k> much derp dangerousdave
<apeiros> dangerousdave: also IMO if the class is File*, the file_ in file_name and _size is redundant ;-)
<apeiros> [k: that was uncalled for
<[k> you do not need to do self.key too, key will suffice, although you could use key() to make it more explicit
<dx7> muhammadn: hehehe it's not stupid... just a little detail
<dangerousdave> apeiros: thanks! i new it would be a silly mistake, just couldn't see the wood for the trees
<dangerousdave> working now
<[k> oh there is an @key
<apeiros> dangerousdave: yw
<[k> you should use @key instead of self.key
<[k> that is the problem
<apeiros> won't help with other.key, though ;-)
<[k> but the error is with self.key!
* apeiros prefers @key over self.key/key too, though
Xiti has joined #ruby
* apeiros should use the word "though" less often, though
einarj has quit [Ping timeout: 252 seconds]
rjno has quit [Remote host closed the connection]
<[k> dangerousdave: also, use alias_method :eql?, :== as it is more expressive :D
<muhammadn> dx7: yeah. i had not used mongodb in a very long time.
Rollabunna has quit [Ping timeout: 248 seconds]
pengin has joined #ruby
startupality has quit [Quit: startupality]
luriv has joined #ruby
<[k> dangerousdave: (non-issue) use results.each { |result| ... } if the body is one-liner (according to the style guide)
<[k> but that's a non-issue
commondream has joined #ruby
<[k> dangerousdave: attr_reader also accepts multiple arguments, so you can collapse them into 1 method call
baweaver has quit [Remote host closed the connection]
<[k> eg attr_reader :file_name, :file_size
mrmargolis has joined #ruby
<dfockler> oh whoa I think I used self.attribute when I switched over from java
<[k> (it is also recommended not to use MD5 now a days)
NeverDie has joined #ruby
einarj has joined #ruby
rjno has joined #ruby
<[k> does anyone leave out brackets when defining methods like me?
<[k> i usually just def == other
<[k> looks cleaner imo
<apeiros> [k: my style guide says "use do/end for side effect"
sarmiena_ has joined #ruby
<[k> after many many ridiculous times of using if() in java
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[k> i was like i hate brackets!
<dangerousdave> [k: thanks
tomjoro has joined #ruby
<dfockler> brackets?
Xeago has quit [Remote host closed the connection]
Asher1 has quit [Quit: Leaving.]
pengin_ has joined #ruby
<[k> parentheses
<dfockler> parentheses, ahh ok
Asher has joined #ruby
<dangerousdave> [k: whats wrong with md5?
<[k> apeiros: link pls :3
<dfockler> I only leave them off when I'm using a dsl
Mia has joined #ruby
pengin has quit [Read error: Connection reset by peer]
mrmargol_ has quit [Ping timeout: 248 seconds]
pengin has joined #ruby
Rollabunna has joined #ruby
Palmer11 has quit [Quit: Palmer11]
<[k> dangerousdave: it is found that collisions are much more frequent in md5 than other hashing algorithms
<apeiros> sadly the link to the late Jim's 2004 article about it is 500 server error :(
<[k> (i follow the github one to a certain extent)
baroquebobcat has joined #ruby
volty_ has joined #ruby
_seanc_ has joined #ruby
Axy has quit [Ping timeout: 248 seconds]
peter_paule has quit [Ping timeout: 244 seconds]
skade has quit [Quit: Computer has gone to sleep.]
<dfockler> that multiline braces one gives me javascript jitters
<[k> seems like a good convention to follow
sebbers has joined #ruby
sparr has quit [Changing host]
sparr has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
vasilakisfil__ has joined #ruby
<[k> yeah, thats why i avoided it
<jhass> apeiros: it's in the wayback machine
<dfockler> and just eyeballing it, it looks like you are building a nested hash
pengin_ has quit [Ping timeout: 264 seconds]
<apeiros> even with the convention of using {} for return value, you'll usually not have multiline {} blocks
<apeiros> simply because that collides with other elements of good style :)
<apeiros> jhass: thanks
Tai15 has quit [Remote host closed the connection]
<jhass> np, that's totally in my bookmarks :D
_seanc_ has quit [Read error: Connection reset by peer]
<muhammadn> dx7: thanks man for helping me out here
Tai15 has joined #ruby
<dx7> muhammadn: no problem
_seanc_ has joined #ruby
peter_paule has joined #ruby
<slash_nick> Does anyone have any info on the performance of a method with implicit block vs method with explicit block... that is, is `def foo; yield; end` somehow more performant than `def foo(&block); yield; end` ???
<apeiros> slash_nick: &block is faster for passing the block on. for everything else, yield is faster.
senayar has quit []
<apeiros> e.g. `def my_each(&block); @my.each(&block); end` is better than `def my_each; @my.each do |*args| yield(*args); end; end`
IanV0rn has joined #ruby
<apeiros> but `def my_yielder; yield 1, 2, 3; end` is better than `def my_yielder(&block); block.call(1, 2, 3); end`
symm- has quit [Ping timeout: 255 seconds]
volty_ has quit [Quit: Konversation terminated!]
IanV0rn has quit [Max SendQ exceeded]
<slash_nick> apeiros: This is a perfect example of the situation I'm asking about: https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-api/lib/elasticsearch/api/utils.rb#L190-L201
IanV0rn has joined #ruby
peter_paule has quit [Ping timeout: 244 seconds]
<slash_nick> eh, my highlight picked up a few lines at the end by mistake... I'm talking about that `def __rescue...` method
Xeago has joined #ruby
charliesome has quit [Quit: zzz]
<[k> explict < implicit
<sebbers> Has anyone here had experiencing parsing out the day and times from a string like the following:
<sebbers> “I’m available on Tuesday and Thursday from 4:15pm to 7:15pm.
<sebbers> Then also from 3 to 5 on Wed. and Fri.
duderonomy has quit [Ping timeout: 248 seconds]
<sebbers> Wed 10:00-2“
<[k> explicit is slower
peter_paule has joined #ruby
<[k> sebbers, there are libraries out there for ruby to pick out info like this
<[k> i forgot what they are
<[k> i think i bookmarked some gem aggregation sites
<[k> hold on
<apeiros> [k: not correct.
<apeiros> [k: as I said, it depends on the context.
<sebbers> thank you [k
<sebbers> really appreciate it
<apeiros> slash_nick: that's a case for yield. and then you don't define the &block in the args either.
<apeiros> __methods? srsly? o0
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
deric_skibotn has joined #ruby
Igorshp has joined #ruby
rbennacer has quit [Remote host closed the connection]
<sebbers> thank you!
elia has quit [Quit: Computer has gone to sleep.]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
atom3 has quit [Ping timeout: 275 seconds]
atom3 has joined #ruby
<[k> yw
<[k> apeiros: ;-;
<havenwood> sebbers: You might also look at ChronicDuration: https://github.com/hpoydar/chronic_duration#readme
<[k> its the truth for the most case
blackmesa has quit [Ping timeout: 272 seconds]
<sebbers> oh alright. thank you!
<havenwood> sebbers: It can't handle the Tues/Thurs from your example but it gets the times: #=> 14835
RoryHughes has quit [Ping timeout: 246 seconds]
Scroff has quit [Remote host closed the connection]
Rollabun_ has joined #ruby
tvw has quit [Remote host closed the connection]
Rollabunna has quit [Ping timeout: 248 seconds]
<[k> chronic can parse "mon"
<[k> it looks like chronic duration was meant more for durations
<[k> heh
hahuang65 has joined #ruby
CamonZ has joined #ruby
<slash_nick> apeiros: thanks, you're the best... don't tell shevy
<[k> you already pinged him
antgel has quit [Ping timeout: 250 seconds]
lsmola has quit [Ping timeout: 276 seconds]
Scroff has joined #ruby
<apeiros> [k: I wouldn't actually make any bets on whether I have &block or yield more often in my code
<apeiros> gut feeling is that I have more &block
NeverDie has joined #ruby
Xeago has quit [Remote host closed the connection]
RoryHughes has joined #ruby
noethics has quit [Read error: Connection reset by peer]
Igorshp has quit [Remote host closed the connection]
hahuang65 has quit [Ping timeout: 256 seconds]
muhammadn has quit [Ping timeout: 246 seconds]
sshuff has quit [Quit: Leaving]
Xeago has joined #ruby
Rollabunna has joined #ruby
Rollabun_ has quit [Ping timeout: 248 seconds]
Igorshp has joined #ruby
Igorshp has quit [Read error: Connection reset by peer]
noethics has joined #ruby
Igorshp has joined #ruby
Scroff has quit [Read error: Connection reset by peer]
Scrofff has joined #ruby
freerobby has joined #ruby
abuzze has joined #ruby
Igorshp has quit [Remote host closed the connection]
Scrofff has quit [Remote host closed the connection]
Rollabunna has quit [Client Quit]
dangerousdave has quit [Ping timeout: 246 seconds]
freerobby has quit [Client Quit]
wallerdev has joined #ruby
Pumukel has joined #ruby
muhammadn has joined #ruby
<avdi> apeiros: thanks
_seanc__ has joined #ruby
_seanc_ has quit [Read error: Connection reset by peer]
_seanc__ is now known as _seanc_
<apeiros> avdi: yw :D
jamesbrink has quit []
Zai00 has quit [Quit: Zai00]
rbennacer has joined #ruby
OrbitalKitten has joined #ruby
B1n4r10 has joined #ruby
sfarley has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Zai00 has joined #ruby
abuzze has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
OrbitalKitten has quit [Client Quit]
Xeago has quit [Remote host closed the connection]
Zai00 has quit [Client Quit]
<shevy> slash_nick lol
zeroDivisible has quit [Ping timeout: 244 seconds]
<shevy> I think that was the funniest comment I read on #ruby today
ta has joined #ruby
<shevy> I don't get to do much ruby anymore, somehow everything is shifting away to other things :(
peter_paule has quit [Ping timeout: 244 seconds]
segfalt has quit [Quit: segfalt]
Xeago has joined #ruby
<wmoxam> shevy: what are you doing instead?
lkba_ has joined #ruby
<Senjai> shevy: Should submit to bash.org
luzidco has joined #ruby
greensoup has joined #ruby
<greensoup> what's the difference between the `bundle` and `bundler` command?
sepp2k has quit [Quit: Leaving.]
jshepherd has quit []
lkba has quit [Ping timeout: 256 seconds]
Lucky_ has quit [Read error: Connection reset by peer]
Gnubie__ has quit [Read error: Connection reset by peer]
ivorpad has left #ruby ["Textual IRC Client: www.textualapp.com"]
ivorpad has joined #ruby
ivorpad has quit [Quit: Textual IRC Client: www.textualapp.com]
<apeiros> greensoup: there is no bundler command?
<apeiros> bundle is the command provided by the bundler gem
<Darkwater> there is for me
inoic has joined #ruby
<shevy> wmoxam currently I am reading up on organic chemistry and biochemistry; biochemistry is ok, I don't like organic chemistry too much... to reach compound D, starting from A, over B and C... hard to know what rules to apply when, how and where...
<apeiros> maybe they've added it because too many were confused that bundler's executable was called bundle…
<greensoup> apeiros: both seem to appear in my path when I install the bundler gem.
<shevy> bundler should provide a bin/bundle file greensoup
<apeiros> greensoup: anyway, just inspect it?
<Darkwater> maybe it's for people who expect bundler's binary to be called bundler
<Darkwater> ie. same as package name
<apeiros> …
<shevy> no sorry my mistake
<apeiros> that's what I meant
bosma has joined #ruby
<shevy> I just realized that bundler provides bin/bundle and also bin/bundler
<Darkwater> oh read straight over that, sorry
<wmoxam> shevy: ah, I assumed you were using a different language
<greensoup> they are identical looking script files. I was wondering if there was something deeper that looked at the args and acted differently
<shevy> wmoxam ah, nah... I still want to learn something new... C is on my immediate list... but if I look at university lectures and exams, it's a lot of C++ and Java...
<[k> you can use a diff checker
endash has quit [Quit: endash]
<shevy> strangely enough, bundle and bundler differ
<shevy> in one line:
<greensoup> someone in #travis said one worked locally for him when the other didn't. which surprised me.
<shevy> if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
<shevy> if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
CalvinnHobbes has quit [Ping timeout: 244 seconds]
<shevy> greensoup well almost identical :-)
<shevy> but I may not have the most recent bundler... 1.9.4 or so
<[k> could be a bug
creakybones has quit [Ping timeout: 244 seconds]
yfeldblum has joined #ruby
OrbitalKitten has joined #ruby
zz_Outlastsheep is now known as Outlastsheep
arturhoo has joined #ruby
msnyon has quit [Read error: Connection reset by peer]
<greensoup> shevy: weird. mine are completely identical to each other. but programs can always act differently based on the values of argv or something like that.
<greensoup> but I doubt that's the case here
Virtual_ has joined #ruby
<shevy> I just realized... my favourite ruby philosophy is not the TIMTOWTDO or DRY or anything else but this quote from matz:
<shevy> "Instead of emphasizing the what, I want to emphasize the how part: how we feel while programming."
<shevy> greensoup well perhaps it was fixed in later versions
<shevy> I find it confusing that two almost same-names are provided though
<shevy> perhaps because people were wondering why "bundle" worked for a project called "bundler" hehehe
msnyon has joined #ruby
<Virtual_> I'm having some trouble with Ruby gems on Arch Linux is this the right to place to seek help
<shevy> yeah Virtual_
<shevy> jhass is using arch btw
<shevy> so he can answer!
centrx has joined #ruby
<Outlastsheep> Virtual_: I use Arch, though I'm not a super-guru.
<Outlastsheep> I can keep bashing my head into the wall until either one of the two breaks, or jhass comes in.
<Senjai> ?use Virtual_
<ruboto> Virtual_, Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
<Outlastsheep> What seems to be the problem?
OrbitalKitten has quit [Client Quit]
Gnubie_ has joined #ruby
OrbitalKitten has joined #ruby
<Virtual_> well i'm trying to install the gem 'gosu' with 'gem install gosu' I get no problems from that until I try to require gosu in irb and it tells me it can't find gosu
<Virtual_> or any other gem im trying for that matter
<wmoxam> shevy: Java is pretty boring ;)
<wmoxam> shevy: it's good to know some C though
<Outlastsheep> Hmm.
<apeiros> Virtual_: sounds like your irb and your gem command don't use the same ruby
towski_ has quit [Remote host closed the connection]
<jhass> Virtual_: did you change anything opposed to the defaults? gist your gem env output
shinnya has joined #ruby
<shevy> wmoxam yeah
<apeiros> Virtual_: what does `command -v ruby` show? and what does `gem env` list as "RUBY EXECUTABLE"?
rodfersou|lunch is now known as rodfersou
CustosLimen has joined #ruby
shadoi has joined #ruby
<shevy> Virtual_ do you have more than one ruby? also, study the output of "gem env" or ideally upload that information to gist or somewhere
sukki07 has joined #ruby
<shevy> if we all repeat it once, it will stick :)
<[k> you all charge at him at onc
<[k> i bet he feels overloaded
<apeiros> that's virtually impossible
jtbnyc69 has joined #ruby
postmodern has joined #ruby
<[k> heh
msnyon has quit [Ping timeout: 264 seconds]
Igorshp has joined #ruby
Iskarlar has joined #ruby
<shevy> [k he is an arch user, they are smarter than the average ubuntu user!
vkgfx has left #ruby ["Leaving"]
<Virtual_> 'command -v ruby' just prints /usr/bin/ruby
<jhass> Virtual_: works fine here, are you sure the gem install gosu was successful?
pdoherty has joined #ruby
<jhass> does gem list have it?
<shevy> Virtual_ gosu must be compiled, it did not error out?
<apeiros> jhass: they say irb can't find any gem
<Virtual_> jhass: I am it reported no errors anyway
<shevy> for me I just tried and failed
<apeiros> I doubt it's a problem with gosu
<shevy> In file included from Input-TextInput.cpp:1:0:
<shevy> ../../src/Input/TextInput.cpp:4:22: fatal error: SDL2/SDL.h: No such file or directory
pontiki has quit [Quit: <poit>]
<apeiros> Virtual_: and `command -v irb`?
<Virtual_> gem list doesn't have it nor does it have any of the others
<[k> ;p;
<[k> ;-;*
<Virtual_> apeiros: '/usr/bin/irb'
<jhass> Virtual_: run gem install gosu again and gist the entire output including invocation
<apeiros> odd
<shevy> Virtual_ you have SDL2?
mtakkman has joined #ruby
<shevy> I am compiling SDL2 right now
ldnunes has quit [Read error: Connection reset by peer]
<Virtual_> I think I may have realised the problem but I will let you know when it's finished building the gem
freerobby has joined #ruby
<Virtual_> I do have all the dependencies gosu put on the official website, they have an Arch one which is neat I don't have to search for em
<Virtual_> Yeah problem was a minor one but a habit I picked up from Python, install gems as sudo
<Virtual_> instead of just gem install gosu
AlphaAtom has joined #ruby
<[k> oh
<[k> ok
<Virtual_> irb(main):001:0> require 'gosu'
nua has quit [Ping timeout: 245 seconds]
<Virtual_> => true
<Virtual_> works now
choke has joined #ruby
<[k> I bring you this public service announcement to update your rubygems
codecop has joined #ruby
acke has quit [Remote host closed the connection]
<[k> === 2.4.8 / 2015-06-08
<[k> Bug fixes:
<[k> * Tightened API endpoint checks for CVE-2015-3900
rubie has quit [Remote host closed the connection]
kirun has joined #ruby
yardenbar has joined #ruby
<shevy> huh
<shevy> we have a new bot here
<shevy> a security bot
<[k> where?
duderonomy has joined #ruby
<[k> that was like ~12days ago?
nateberkopec has quit [Quit: Leaving...]
<[k> 17*
sarmiena_ has quit [Quit: sarmiena_]
withnale_ has quit [Ping timeout: 264 seconds]
duderonomy has quit [Max SendQ exceeded]
ldnunes has joined #ruby
<jhass> mh yeah, I wanted to ping anatolik about it
baweaver has joined #ruby
tomphp has joined #ruby
<ljarvis> compact_map needs to exist
ht__ has joined #ruby
bronson has joined #ruby
acke has joined #ruby
nua has joined #ruby
idafyaid has quit [Read error: Connection reset by peer]
subtwo has joined #ruby
<[k> it doesnt?
<baweaver> >> module Enumerable; def compact_map(&block) map(&block).compact end end; [nil, 1, 2].compact_map(&:itself)
<ruboto> baweaver # => [1, 2] (https://eval.in/387137)
jmoles has joined #ruby
<[k> that looks simple enough
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
jmoles is now known as cubicool
nertzy has quit [Quit: This computer has gone to sleep]
<cubicool> Hey guys... I'm having a hard time figuring this out. I am developing some Ruby code I want to EVENTUALLY Gem-ify, so I'm keeping the directory struct and code laid out properly. However...
jtbnyc69 has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
<cubicool> I'm having trouble USING this code (locally) without going through the rigamole of 'gem build; gem install' every time I make a small change. Is there any alternative?
<miah> load your code in irb/pry.
NeverDie has joined #ruby
hahuang65 has joined #ruby
Iskarlar has quit [Ping timeout: 252 seconds]
<cubicool> I don't follow...
jtbnyc69 has joined #ruby
xelkarin has joined #ruby
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<cubicool> Is there no way to simply symlink to my module.rb/module directories in the project that USES the Gem?
yardenbar has quit [Ping timeout: 276 seconds]
dstarh has joined #ruby
nofxx has joined #ruby
nofxx has joined #ruby
muhammadn has quit [Ping timeout: 265 seconds]
<miah> you can use require_relative, or modify the ruby load path, or write tests so that you can test your code in isolation without the external gem
<miah> s/external gem/external project
subtwo has quit [Quit: (null)]
casadei has joined #ruby
shadeslayer has joined #ruby
Xeago has quit [Remote host closed the connection]
<cubicool> Ruby load path, that sounds promising. I'll google. :)
andywojo has joined #ruby
Xeago has joined #ruby
choke has quit [Quit: Textual IRC Client: www.textualapp.com]
asmodlol has quit [Ping timeout: 264 seconds]
choke has joined #ruby
hahuang65 has quit [Ping timeout: 250 seconds]
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dfockler> do environment variables ever clash?
jackjackdripper has joined #ruby
<centrx> They just overwrite right?
baweaver has quit [Remote host closed the connection]
<miah> there can be only one
<shevy> aha
<[k> i think they do
<shevy> miah the highlander girl
<miah> =)
<[k> since ENV is a hash
<shevy> ENV appears like a hash
<[k> it subclasses it doesnt it
<dfockler> it just seems like a weird way to have your program operate, by looking at variables set inside the os
<[k> >> ENV.ancestors
<ruboto> [k # => undefined method `ancestors' for #<Object:0x41421ff8> (NoMethodError) ...check link for more (https://eval.in/387138)
towski_ has joined #ruby
<shevy> >> ENV.is_a? Hash
<ruboto> shevy # => false (https://eval.in/387139)
<shevy> >> Hash.new.is_a? Hash
<ruboto> shevy # => true (https://eval.in/387141)
<[k> buttttt
<miah> the environment variable 'FOO' can only have one value
<miah> you can change it any time though
<shevy> I learned this from the old pickaxe [k
<[k> >> ENV.ancestor
<ruboto> [k # => undefined method `ancestor' for #<Object:0x40f29ff0> (NoMethodError) ...check link for more (https://eval.in/387142)
<[k> why doesnt this work :(
<shevy> today is [k fail day
atom3 has quit [Ping timeout: 277 seconds]
<miah> im thrown off by the missing ]
sarmiena_ has joined #ruby
Scroff has joined #ruby
flughafen_ has joined #ruby
<shevy> yeah
<miah> i have a minecraft pickaxe made out of pearler beads on my desk.
atom3 has joined #ruby
<Darkwater> i have minecraft
<miah> thats cool
blackmesa has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
<centrx> I like balloons
creakybones has joined #ruby
yqt has joined #ruby
Yiota has joined #ruby
<miah> i like turtles
balazs has joined #ruby
<[k> k
Or1on has joined #ruby
flughafe1 has quit [Ping timeout: 264 seconds]
[k has quit [Quit: Lingo: www.lingoirc.com]
c0ncealed has joined #ruby
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
[k- has quit [Quit: -a- IRC for Android 2.1.25]
baweaver has joined #ruby
Scrofff has joined #ruby
B1n4r10 has joined #ruby
<shevy> miah as long as you have a cat next to the pickaxe it's ok
baroquebobcat has joined #ruby
hahuang65 has joined #ruby
nateberkopec has joined #ruby
mtakkman has quit [Ping timeout: 256 seconds]
Scroff has quit [Ping timeout: 264 seconds]
k3asd` has quit [Ping timeout: 256 seconds]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andywojo> Anyone know of a good way / gem to tackle running sudo on a remote system via SSH? I've lately just been doing system calls %x[ssh #{host} "sudo -S cmd"]
ghostpl has quit [Ping timeout: 276 seconds]
<andywojo> It stinks though for handling return codes / issues
asmodlol has joined #ruby
<andywojo> all of the gems to do SSH natively without resorting to system calls stinks
c0m0 has quit [Ping timeout: 246 seconds]
greensoup has quit [Ping timeout: 246 seconds]
sukki07 has quit [Quit: Page closed]
Yiota has joined #ruby
gianlucadv has joined #ruby
husanu has quit [Remote host closed the connection]
husanu has joined #ruby
Yiota has quit [Client Quit]
Bertg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
finisherr has quit [Quit: finisherr]
Yiota has joined #ruby
codecop has quit [Remote host closed the connection]
<miah> dunno how that'd work though either =)
podman has joined #ruby
<miah> net-ssh being somewhat... deprecated.
fantazo has quit [Ping timeout: 255 seconds]
markalanevans has joined #ruby
dionysus69 has joined #ruby
<markalanevans> Hey folks, what do you call these : http://pastie.org/10256989
bb010g has quit [Quit: Connection closed for inactivity]
TheHodge has quit [Quit: Connection closed for inactivity]
<markalanevans> i want to understand how blocks like that are initalized
<markalanevans> is it a conditional block ?
<markalanevans> or something
<markalanevans> for ex: environment :test do …. end
<miah> just a block
startupality has joined #ruby
Scroff has joined #ruby
c355E3B has quit [Quit: Connection closed for inactivity]
<markalanevans> so just for clarificaiton
<markalanevans> there is a function somehwere defined as environment
<miah> yes
<markalanevans> and it it there is some sort of test
<markalanevans> to see if :test
<markalanevans> or if :production
yardenbar has joined #ruby
<markalanevans> how is the block aware of the :test or :production
troulouliou_dev has quit [Quit: Leaving]
andywojo has quit [Ping timeout: 252 seconds]
<nofxx> markalanevans, def environment(args, &:block)
wldcordeiro has joined #ruby
Scrofff has quit [Ping timeout: 256 seconds]
<nofxx> markalanevans, args would be :development , in the case
blaines has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<markalanevans> ok.
codecop has joined #ruby
<markalanevans> so in the block, i just compare args == some_function_that_returns_actual_env()
s2013 has joined #ruby
<markalanevans> and then if true it executes
<nofxx> markalanevans, more like it storing that block for somewhere else call it, with the env
dgutierrez1287 has joined #ruby
<markalanevans> ok.
<markalanevans> So i have a ruby file that just have the block statements
lostcuaz_km has joined #ruby
lostcuaz has quit [Ping timeout: 272 seconds]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<nofxx> markalanevans, or yes, its just a return unless ENV == args
<markalanevans> Does that meant that there is some global function environment
blue_deref has joined #ruby
langlands has joined #ruby
<nofxx> markalanevans, env vars usually
abuzze has joined #ruby
<nofxx> FOO=bar ./program inside program: ENV['FOO']
blaines has quit [Ping timeout: 246 seconds]
<markalanevans> ok
msnyon has joined #ruby
wilbert has joined #ruby
OrbitalKitten has joined #ruby
langland_ has quit [Ping timeout: 244 seconds]
bronson has quit [Remote host closed the connection]
icosa has quit [Read error: Connection reset by peer]
dgutierrez1287 has quit [Ping timeout: 256 seconds]
<markalanevans> thanks nofxx & miah
lkba has joined #ruby
wilbert has quit [Quit: quit]
blaines has joined #ruby
pengin has quit [Remote host closed the connection]
wilbert has joined #ruby
abuzze has quit [Ping timeout: 246 seconds]
canton7 is now known as n
n is now known as canton7
OrbitalKitten has quit [Client Quit]
lkba_ has quit [Ping timeout: 264 seconds]
IanV0rn has joined #ruby
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
khebbie has joined #ruby
Zai00 has joined #ruby
infinitone has quit [Remote host closed the connection]
Igorshp has quit [Remote host closed the connection]
Kruppe has joined #ruby
choke has joined #ruby
andywojo has joined #ruby
langland_ has joined #ruby
symm- has joined #ruby
pengin_ has joined #ruby
aryaching has quit [Ping timeout: 244 seconds]
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Zai00 has quit [Client Quit]
<apeiros> I really wish ruby/gems had a canonical way to handle optional dependencies.
langlands has quit [Ping timeout: 244 seconds]
sfarley has joined #ruby
langlan__ has joined #ruby
exadeci has quit [Quit: Connection closed for inactivity]
Zai00 has joined #ruby
Luun has quit [Quit: Luun]
<jhass> like "recommends" in distro package managers?
<Senjai> apeiros: If they're optional, they aren't dependencies. But yes, I agree, but thats their argument and it also makes sense
<Senjai> I would like a Gemfile.local or something
<Senjai> to also load the gems for that, that wouldn't be committed and things
<apeiros> Senjai: I'd disagree
IanV0rn has quit [Read error: Connection reset by peer]
<apeiros> they are a dependency under a given condition
piet_ has joined #ruby
<apeiros> "if you want to use feature X, Y is a dependency"
Igorshp has joined #ruby
<apeiros> but please, tell me a better term
greensoup has joined #ruby
IanV0rn has joined #ruby
<Senjai> Feature X should therefore be its own gem then.
<apeiros> eager to learn :)
<Senjai> Again, another argument they have made
<Senjai> :P
blue_deref has quit [Ping timeout: 252 seconds]
<jhass> Senjai: well, bundler has 1.10 has optional groups now, so you could spam your gemfile with developer tools and not install them by accident
<Aria> Conditional dependency makes sense. But I think we'd do well to avoid them.
<apeiros> Senjai: seriously not :-)
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<piet_> how bad is performance when using method_missing
<Aria> piet_: performance of what?
<centrx> This bad <----->
<Senjai> jhass: lol nice. But I still would want a Gemfile.local
<apeiros> Senjai: example: email address validation, optionally resolving the domain
adamjleonard has joined #ruby
<apeiros> Senjai: you don't seriously tell me you'd split the latter part into its own gem? that makes about zero sense to me…
langland_ has quit [Ping timeout: 264 seconds]
<apeiros> (the dependency is simpleidn btw - because resolve can't handle IDNs)
<jhass> Senjai: also install_if so you could do install_if: -> { `whoami` == "Senjai" } xD
<Senjai> I'm not saying that. Its just an argument I've seen made
<Senjai> install_if is terrible
<jhass> but maybe don#t
<apeiros> and I think the argument is flawed :)
<Senjai> apeiros: Right, but you have to be able to convince THEM of that :)
<apeiros> there *may* be cases where that's a way to work around it
nertzy has joined #ruby
rubie has joined #ruby
<apeiros> Senjai: atm, YOU are THEM :-p
<apeiros> as you're arguing on THEIR behalf :D
<Senjai> Oh, I see, but I cant argue a point I already disagree with
<Senjai> I'm simply saying that this conversation has gone on forever in github issues
<apeiros> piet_: benchmark it
<Senjai> and this is the stuff they come up with
<piet_> just wondering how heavily i should rely on alias_method_missing type behavior in a rails app
<Senjai> You could theoretically wrap a bunch of crap in if defined? blocks, too, but thats lamesauce
<apeiros> well, my current way to deal with it: add the dependency in the gemspec. document in the readme that it's only needed for given feature. use a custom require with a descriptive info in case of failure.
charliesome has joined #ruby
Scroff has quit [Remote host closed the connection]
Scroff has joined #ruby
IanV0rn has quit [Read error: Connection reset by peer]
segfalt has joined #ruby
joaomdmoura has joined #ruby
Yiota has joined #ruby
<Senjai> apeiros: I would just go the if defined? route. And tell people if x gem is included, behavior will differ
<Senjai> or make it a configuration option
Xeago_ has joined #ruby
<Senjai> allowing them to plug in a class
<Senjai> Similiarly with how you can switch rails' default json parser to Oj
Luun has joined #ruby
<diegoviola> HAL: This mission is too important for me to allow you to jeopardize it.
<Senjai> aspiers: Honestly, everything at this moment can be solved with clean composition
<Senjai> For email address validation, you could have a base adapter, and a GemSpecializedAdapter, and have them set to use the GemSpecializedAdapter if they want it.
<Senjai> as a configuration option
balazs has quit [Remote host closed the connection]
<Senjai> That way it can be declared as a development dependency, and is optional to the user
<Senjai> The only downside of it being that its not obviously optional from the gemspec
peter_paule has joined #ruby
Scroff has quit [Ping timeout: 276 seconds]
<apeiros> Senjai: I don't like that approach.
<apeiros> it makes it harder for the user.
Scroff has joined #ruby
<apeiros> I see, you suggested two approaches. but I also see that I'd say the same about the second approach :D
Xeago has quit [Ping timeout: 272 seconds]
sarkyniin has joined #ruby
<Senjai> It adds a configuration step, which I agree adds oweness to the user, but I wouldnt say it'd make it harder
<Senjai> if a user cant figure out how to MyGem.configure {|c| c.email_parser = ThingClass }
<Senjai> they have larger issues
<Senjai> and if its well documented, and in the readme, its literally just a copy and paste
dionysus69 has quit [Quit: dionysus69]
<Senjai> and that's -only- if you dont want the change in behavior automatic
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Senjai> if you want it automatic, you could use if defined? craziness to determine what adapter to use
jenrzzz has joined #ruby
uxp_ is now known as uxp
IanV0rn has joined #ruby
<Senjai> apeiros: Just to reiterate, I agree with you that optional deps would be cool. I'm more talking about how it could be solved with composition now. So I'm not disagreeing with you.. just being clear :)
sarkyniin has quit [Remote host closed the connection]
<apeiros> Senjai: oh, yes, I got that
baxx has quit [Quit: WeeChat 0.4.2]
<apeiros> and thanks for your suggestions
peter_paule has quit [Ping timeout: 272 seconds]
Virtual_ has quit [Ping timeout: 277 seconds]
Virtual_ has joined #ruby
_seanc_ has quit [Read error: Connection reset by peer]
_seanc__ has joined #ruby
<apeiros> sorry, I scold others for not being thankful when they get support which they don't/can't use. so I should do better myself :D
<apeiros> s/being/expressing/
phutchins has quit [Ping timeout: 272 seconds]
piet_ has quit [Quit: leaving]
railsraider_ has joined #ruby
railsraider has quit [Ping timeout: 246 seconds]
railsraider_ is now known as railsraider
Tai15 has quit [Read error: Connection reset by peer]
railsraider has quit [Client Quit]
platzhirsch has left #ruby [#ruby]
Tai15 has joined #ruby
<Senjai> Oh all good, never thought that way. Just wanted to make sure that errone knew what I was talkin bout
peter_paule has joined #ruby
Tai15 has quit [Read error: Connection reset by peer]
Xeago_ has quit [Remote host closed the connection]
balazs has joined #ruby
sarkyniin has joined #ruby
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sinkensabe has joined #ruby
carter1 has joined #ruby
langlan__ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Outlastsheep is now known as zz_Outlastsheep
sfarley has quit [Remote host closed the connection]
sinkensabe has quit [Remote host closed the connection]
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ledestin has joined #ruby
peter_paule has quit [Ping timeout: 250 seconds]
DexterLB has quit [Ping timeout: 252 seconds]
greensoup has quit [Ping timeout: 255 seconds]
nertzy has quit [Quit: This computer has gone to sleep]
elia has joined #ruby
bluOxigen has joined #ruby
chinmay_dd has quit [Remote host closed the connection]
bruno- has quit [Ping timeout: 252 seconds]
bb010g has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
tomphp has joined #ruby
aphprentice has quit [Remote host closed the connection]
startupality has quit [Quit: startupality]
vikaton has joined #ruby
choke has joined #ruby
rjno has quit [Remote host closed the connection]
sandstrom has quit [Quit: My computer has gone to sleep.]
jahrichie has joined #ruby
balazs has quit [Remote host closed the connection]
rjno has joined #ruby
zacts has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
nua has quit [Remote host closed the connection]
<Senjai> Ugh
<Senjai> I have a terrible question
<Senjai> I want to expect that any number of instances will receive 2 calls of a method total
<Senjai> across all instances
<Senjai> It is TERRIBLE, I understand
<apeiros> Senjai: in a test? mocking?
<Senjai> apeiros: Yes
<Senjai> specifically, active record
<Senjai> in a non rails project
<apeiros> I guess the test double framework would matter as information ;-)
centrx has quit [Ping timeout: 264 seconds]
* apeiros won't be able to help, though
<Senjai> rspec
wildroman2 has quit [Remote host closed the connection]
<apeiros> huh? what's AR.delay_touching?
sarkyniin has quit [Quit: Quit]
<Senjai> The worst thing ever, that you should never use
<Senjai> It's a monkey patch that consolidates touches
<Senjai> so if a record gets touched several times, it only happens once instead
* apeiros blinks
<Senjai> when it hits the db
<Senjai> Because rails developers like to do things on after_touch that are expensive as hell apparently.
<Senjai> (we didn't write this codebase)
<apeiros> what constitutes as a touch? update queries? deletes? other things?
<Senjai> my_record.touch.
peter_paule has joined #ruby
Xeago has joined #ruby
<Senjai> which simply updates the updated_at
lolmaus has quit [Quit: Konversation terminated!]
<Senjai> for busting caches
<Senjai> But you can define after_touch callbacks, and thats where the "we cant afford to touch things multiple times" thing comes in
<apeiros> oy
<apeiros> I see
freerobby has quit [Quit: Leaving.]
principessa has quit [Quit: Leaving...]
powersurge has joined #ruby
<powersurge> how can I convert 'true' to a boolean?
Xeago has quit [Read error: Connection reset by peer]
freerobby has joined #ruby
lolmaus has joined #ruby
<Aria> parse it as json?
<Aria> or yaml?
nertzy has joined #ruby
<powersurge> surely there's a simpler way to just get it from a string?
<apeiros> powersurge: 'true' == 'true'
<apeiros> not kidding
<powersurge> I expected 'true'.to_bool to be there and was surprised when it wasn't
dstarh has quit [Read error: Connection reset by peer]
<powersurge> how very strange
blackmesa has quit [Ping timeout: 244 seconds]
<havenwood> powersurge: There' s no Bool class.
<apeiros> powersurge: a "to_bool" method for just two possible string values? that sounds unreasonable.
<apeiros> powersurge: additionally, expectations might very well differ.
blackmesa has joined #ruby
<apeiros> should "0" be false? should "no" be false? should "FALSE" be false? etc.
<c-c> yeag
<powersurge> yea, I agree that it's ambiguous to assume
<apeiros> and really, `val == "true"` is simple enough.
<powersurge> but I expected there to be something with documentation to explain away any ambiguity
<c-c> that has made javascripts 'clever' boolean equality mess a lot of things up
<havenwood> powersurge: You can use apeiros' literal_parser gem: https://github.com/apeiros/literal_parser#readme
<apeiros> havenwood: hah!
<powersurge> heh
<apeiros> great use
<havenwood> LiteralParser.parse 'true' #=> true
uber has quit [Ping timeout: 265 seconds]
<havenwood> >> eval 'true'
<ruboto> havenwood # => true (https://eval.in/387189)
<Senjai> sadness that that needs to exist though
<Senjai> :P
<Senjai> Things should just pass in proper things in a perfect world
<apeiros> Senjai: tbh, I don't even remember why I wrote that in the first place :(
<Senjai> apeiros: That project contains css?
<Senjai> wat
freerobby has quit [Client Quit]
<powersurge> in a perfect world, a computer would just understand what I want to happen ahead of time and just do it :>
<apeiros> Senjai: css?
<apeiros> in the docs probably…
<Senjai> Ah
<Senjai> Yeah, the project is like 42% css
<c-c> >> a_value = false; another_value = true; [TRUE == a_value, another_value == TRUE]
<ruboto> c-c # => [false, true] (https://eval.in/387191)
<c-c> >> 'true' == TRUE
<ruboto> c-c # => false (https://eval.in/387192)
<apeiros> funny how TRUE is a *typical" true value, while FALSE is false itself
<c-c> yay!
<c-c> >> 1 == TRUE
<ruboto> c-c # => false (https://eval.in/387193)
<c-c> another yay!
<c-c> >> true == TRUE
<ruboto> c-c # => true (https://eval.in/387194)
<c-c> umm...
<apeiros> >> TRUE
<ruboto> apeiros # => true (https://eval.in/387195)
<apeiros> TRUE is true
<Senjai> apeiros: Your sorting gem looks legit
<apeiros> ?experiment c-c
<ruboto> c-c, Please use your local irb or pry (see ?pry) to experiment, ruboto's eval functionality is for demonstration purposes only.
<c-c> B)
<apeiros> Senjai: ooooh, don't remind me. I still have natural sort in a branch I want to release for *ages*
<Senjai> just doet
<Senjai> I would prefer returning a specialized object instead of an array though :P
<apeiros> can't. there was something I had/wanted to resort first. and I forgot what.
bosma has quit [Quit: Leaving]
sinkensabe has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
danielpclark has quit [Ping timeout: 248 seconds]
<apeiros> Senjai: where?
bosma has joined #ruby
<hoelzro> I /win3
<hoelzro> ww =(
iceyec has quit [Quit: iceyec]
Yiota has joined #ruby
centrx has joined #ruby
bronson has joined #ruby
<apeiros> s/resort/sort out/
blackmesa has quit [Quit: WeeChat 1.2]
greensoup has joined #ruby
ixti has joined #ruby
deric_skibotn has quit [Read error: Connection reset by peer]
nertzy has quit [Quit: This computer has gone to sleep]
blackmesa has joined #ruby
<apeiros> Senjai: if you mean in the sort_by block - that's just how you commonly sort by multiple values with sort_by.
jenrzzz has quit [Ping timeout: 265 seconds]
<apeiros> Senjai: but I'm interested in ways to improve the usability and/or readability :)
DANtheBEASTman has joined #ruby
PaulCapestany has quit [Quit: .]
uber has joined #ruby
Xeago has joined #ruby
<apeiros> hm, you might actually have given me an idea. not sure I can turn it into something I like, though.
IanV0rn has joined #ruby
bronson has quit [Ping timeout: 265 seconds]
vasilakisfil__ has quit [Read error: Connection reset by peer]
sandstrom has joined #ruby
vasilakisfil__ has joined #ruby
zeroDivisible has joined #ruby
sinkensabe has quit [Remote host closed the connection]
blackmes1 has joined #ruby
husanu1 has joined #ruby
blackmes1 has quit [Client Quit]
husanu1 has quit [Remote host closed the connection]
<apeiros> Senjai: something like this? https://gist.github.com/apeiros/148ad8d6c53a57daa6f4
icarus has joined #ruby
blue_deref has joined #ruby
blackmesa has quit [Ping timeout: 265 seconds]
icarus has quit [Client Quit]
icarus has joined #ruby
_seanc__ has quit [Quit: _seanc__]
danielpclark has joined #ruby
andywojo has quit [Quit: Lost terminal]
creakybones has quit [Quit: Leaving]
<hanmac> apeiros: ;P that looks funky ;P
<dfockler> could you do Sorting.asc instead
duderonomy has joined #ruby
<apeiros> dfockler: I don't follow
<dfockler> Sorting.asc person.first_name
deric_skibotn has joined #ruby
baweaver has quit [Remote host closed the connection]
<apeiros> dfockler: you can do that already
<Senjai> apeiros: yeah
<dfockler> would there be another sorting method than Sorting.comparable
<Senjai> I would prefer to save my sorting strategies somewhere
<apeiros> asc/desc exist already to be used with Enumerable#sort_by
<dfockler> ah ok cool
<apeiros> Sorting.comparable would just be a way to generate a custom comparable object instead of using a plain array
Igorshp has quit [Remote host closed the connection]
Lucky_ has joined #ruby
<dfockler> so you have to use an array because you can't chain the methods together?
denver has quit [Remote host closed the connection]
Palmer11 has joined #ruby
ndrei has quit [Ping timeout: 246 seconds]
lostcuaz_km is now known as lostcuaz
Igorshp has joined #ruby
Narzew has joined #ruby
wallerdev has quit [Quit: wallerdev]
ndrei has joined #ruby
dblessing has quit [Quit: Textual IRC Client: www.textualapp.com]
A205B064 has joined #ruby
centrx has quit [Quit: Shutting down, Please wait...]
JDiPierro has joined #ruby
cj__ is now known as cj
<dfockler> can you yield a new Sorting class that contains the state of your list as you sort it with each call
atomical_ has joined #ruby
<apeiros> dfockler: hm? you use an array because that's how you commonly sort by multiple values with sort_by
<dfockler> ah ok
scripore has quit [Quit: This computer has gone to sleep]
x1337807x has joined #ruby
sinkensabe has joined #ruby
skade has joined #ruby
elia has quit [Quit: Computer has gone to sleep.]
subtwo has joined #ruby
atomical has quit [Ping timeout: 248 seconds]
<apeiros> e.g., `people.sort_by { |person| [person.first_name, person.last_name, person.age] }` works without sorting gem too
atomical_ has quit [Client Quit]
<hal_9000> hmm. it would be *possible* to write an “invert” function for a string, to sort oppositely :)
baroquebobcat has joined #ruby
sebbers has quit [Read error: Connection reset by peer]
<apeiros> what sorting gem adds is asc(value)/desc(value) to sort the individual values ascending/descending
<apeiros> and it allows you to deal with nil values
<hal_9000> just like sorting by -x for numeric
<apeiros> hal_9000: that's precisely what desc does
scripore has joined #ruby
sinkensabe has quit [Remote host closed the connection]
<apeiros> just in a generic way
<apeiros> not just for strings
<hal_9000> it doesn’t just reverse the comparison?
uptownhr has joined #ruby
<hal_9000> that would be the way i would “really” do it
<apeiros> I thought that's what you mean
tjbiddle has joined #ruby
<apeiros> it creates an invertedly sorting value by having its <=> inverted
frem has joined #ruby
bronson has joined #ruby
<hal_9000> oh - i meant you could create a function for strings analogous to - for numbers — but in real life, that would be umb
<hal_9000> *dumb
<apeiros> not sure that'd be possible
<apeiros> but even if - it'd be more expensive anyway
<apeiros> both memory and cpu
<hal_9000> yes, mostly just kidding
jahrichie has quit [Quit: Leaving.]
<hal_9000> i think i recognize your nick, but “get info” does not work for me in colloquy now
<Senjai> apeiros: I believe that kind of construct would benefit from returning an object instead of an unnamed data structure thats all :P
<Obfuscate> hal_9000, apeiros: If you have a sequence in ascending order, then you already have it sorted in descending order as well: you merely need to iterate over the sequence from right to left rather than left to right.
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jahrichie has joined #ruby
catcher has joined #ruby
<hal_9000> Obfuscate: true enough, but that does not help in formulating a block for sorting, right?
flughafen_ has quit [Ping timeout: 252 seconds]
<catcher> How can I assign the results of a block to a var?
jenrzzz has joined #ruby
<hal_9000> catcher: var = meth { block }
doertedev has quit [Quit: leaving]
sinkensabe has joined #ruby
<hal_9000> assuming meth returns tha block value
peter_paule has quit [Ping timeout: 246 seconds]
<hal_9000> or var = block.call or var - yield
<Obfuscate> hal_9000: True multi-indexed containers can have the same property, since each index is a constraint on the retrieval order.
rjno has quit []
speakingcode has joined #ruby
<catcher> hal_9000, does meth already exist in your example?
<hal_9000> catcher: well, i was assuming that was some method name - but it may not apply in your situation
<Obfuscate> hal_9000: The problem is that sorting in most languages (rather than actual databases) is adhoc.
rbennacer has quit [Remote host closed the connection]
<catcher> in pseudocode, I'm trying to do this: foo = { ...do some things, return a string... }
<catcher> like an anonymous function
yqt has quit [Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/]
<hal_9000> catcher: you could always do: foo = proc { blah }.call
rbennacer has joined #ruby
tomphp has joined #ruby
spygame has joined #ruby
baweaver has joined #ruby
<apeiros> Obfuscate: try to apply that with multiple values.
<spygame> hey guys, i have some conditions stored in the database like field_name operator value and i wanna build if else out of this. how is this possible using ruby
asmodlol has quit [Ping timeout: 256 seconds]
<Senjai> ?code spygame
<ruboto> spygame, We can't help you without your code, please post it to https://gist.github.com
blahwoop has joined #ruby
elia has joined #ruby
<catcher> hal_9000, that works, thanks. Is that a relatively normal way to do it?
sinkensabe has quit [Remote host closed the connection]
<blahwoop> is there a better way to write this find_min method? min = array[0]; array.each { |num| min = num if num < min };min
wilbert has quit [Ping timeout: 256 seconds]
_seanc_ has joined #ruby
<havenwood> blahwoop: array.min
treehug88 has quit [Quit: Textual IRC Client: www.textualapp.com]
<blahwoop> trying to write my own for practice
<jhass> array.sort.first
<jhass> j/k
<hal_9000> catcher: offhand i can’t think of a more natural way
<Obfuscate> apeiros: It works for composite keys with an arbitrary number of indexes. See boolean query optimization in real databases.
asmodlol has joined #ruby
<blahwoop> jhass: lol
<jhass> but no, you pretty much found the way to do it
balazs has joined #ruby
<blahwoop> ok thanks
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<blahwoop> i was wondering if it was possible to get it into one line
yfeldblum has quit [Ping timeout: 248 seconds]
roolo has quit [Remote host closed the connection]
Zai00 has quit [Quit: Zai00]
<Senjai> spygame: ruboto is a bot
<spygame> lol
<scpike> blahwoop: you could use inject, but don't use this in the real world: array.inject() { |min, x| (min && min < x) ? min : x }
<bougyman> ◀▬▬ is not a bot
<Senjai> spygame: You can do that, you just shouldn't
ta has quit [Remote host closed the connection]
<Senjai> Why do you have to do that
<Senjai> Specifying an operator is... no
jacor has quit [Read error: Connection reset by peer]
<Senjai> You can maybe store a class name, and have a instance of that class be responsible for calculation
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jacor has joined #ruby
<Senjai> but even then.. theres usually a better way to do whatever it is you're trying to do
tomphp has joined #ruby
Xeago has quit [Read error: Connection reset by peer]
<blahwoop> scpike: o boy. ur right lol
<spygame> Senjai: i don't think i get it completely. so you are saying have everything store in a separate class but again how do i do the calculation ?
balazs has quit [Ping timeout: 256 seconds]
<Senjai> spygame: I dont have enough context about the problem you're trying to solve
bruno- has joined #ruby
<jhass> mmh, do we have ?context already
<jhass> ?context
<ruboto> Please add more context to your question, what are you doing, why are you doing it, which libraries are involved. Post some code to gist if it clarifies your question.
<jhass> \o/
<scpike> blahwoop: actually without a first arg to `inject` it passest in the first element of the collection, so you can just do `.inject { |min, x| min < x ? min : x }`
<scpike> neat
<apeiros> Obfuscate: it does not work when you have different orientations
<spygame> Senjai: so i have a form where you can build certain conditions. like selecting the field_name and operator and what should be the desired value. so its a bunch of conditions like if this and that or that then do this
Kricir has quit [Remote host closed the connection]
freerobby has joined #ruby
<jhass> and what problem does that form solve?
<Senjai> ^
<spygame> and i'm storing each condition as a row in the db
<Senjai> spygame: We're just going to ask "Why?" until you tell us what the actual problem is :P
<spygame> it acts like a filter for user submitted values
<Senjai> Get us to a point where we cant ask why anymore
<jhass> are you implementing a DSL by treating data as logic?
<Senjai> spygame: Why?
kirun has quit [Quit: Client exiting]
last_staff has quit [Quit: last_staff]
luzidco has quit [Quit: Bye, bye...]
<sweeper> so like, lisp?
luzidco has joined #ruby
<jhass> heh
luzidco is now known as Guest83840
<diegoviola> I like writing Ruby code
rbennacer has quit [Remote host closed the connection]
<jhass> spygame: how many operators are there, how are the actions defined and is there a defined set of those
Alayde_ has quit [Ping timeout: 246 seconds]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ValicekB has joined #ruby
kristoph has joined #ruby
kristoph has quit [Client Quit]
subtwo has quit [Remote host closed the connection]
<Senjai> jhass: The actual question should be "Why do you have to dynamically filter user input"
<jhass> I bet on "because management"
<scpike> is there a piece of syntax sugar like %w(cat dog) but for integers? I don't think there is, but kind of hard to be sure via google.
<jhass> nope
<spygame> jhass: https://gist.github.com/mfa213/f1b7d260c23b0fa23671 i have updated the gist
<Senjai> scpike: its not hard to [1, 2, 3]
rubie has quit [Remote host closed the connection]
fmcgeough has quit [Quit: fmcgeough]
<slash_nick> apeiros: https://www.omniref.com/ruby/2.2.0/symbols/Proc/yield?#annotation=4087638&line=711
jpfuentes2 has joined #ruby
<Senjai> scpike: %w is just a developer conveniance
atomical has joined #ruby
<spygame> jhass: 3 operators == && ||
<Senjai> can't make it much simpler for that with integers
theery has joined #ruby
<scpike> Senjai: I know, but it's 3 extra characters!
<spygame> actions are predefined as well
<scpike> they gave us %i(a b c)
<Senjai> scpike: And adds 3x as much complexit ;)
<baweaver> Senjai: (1..3) ?
<apeiros> slash_nick: seems to be missing the "pass block on" case.
<Senjai> spygame: So this is an action rule system?
<apeiros> slash_nick: but yeah, supports what I said about the case of not passing the block on. use yield in that case.
<scpike> Senjai: yea I don't really think it should exist, but if it did I wanted to make sure I was using it
<Senjai> Perform actions if all the rules match?
<Senjai> scpike: I usually discourage %w unless its like a longgg list of strings
<Senjai> and even then
<Senjai> %i is the only one I regularly use
<diegoviola> where does return come from in ruby?
fabrice31 has joined #ruby
<Senjai> what, return is a thing in almost every language
<diegoviola> I know
<diegoviola> but every object in ruby belongs to a class
<Senjai> diegoviola: ^
carter1 has quit [Quit: Leaving]
<jhass> spygame: I still don't get it, you only did the "add code" part of ?context. I'd suggest you answer Senjai's questions
<apeiros> diegoviola: return is not an object
* slash_nick thinks diegoviola found something in ruby that's not an object: `return`
<diegoviola> is return a keyword or an object?
<_blizzy_> ok well this is getting stupid. please excuse the messy code. can anyone help me figure out why my @pkmn_team array keeps resetting? https://gist.github.com/NotBlizzard/4dae9559d0ffebeb2b24
<diegoviola> oh
<diegoviola> it's like def then?
<apeiros> diegoviola: despite what people say, not everything is an object.
<apeiros> it's a keyword, yes. like def. yes.
<diegoviola> ok thanks
Guest83840 has quit [Quit: Bye, bye...]
spygame has quit [Ping timeout: 246 seconds]
<diegoviola> people should stop saying that everything is an object
<Senjai> E.g, you do not return.new(myreturnvalue)
commondream has quit [Remote host closed the connection]
<Senjai> diegoviola: Every "thing" is an object
<Senjai> return is not a "thing"
<Senjai> you cannot pass it around
<slash_nick> Senjai: so... is a keyword an object?
<Senjai> def is not a thing
<scpike> Senjai: %r can be nice in small doses
Zai00 has joined #ruby
<Senjai> a keyword in the form of a symbol :keyword is
<Senjai> If that's what you emant
spygame has joined #ruby
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Xeago has joined #ruby
maxshelley has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fabrice31 has quit [Ping timeout: 248 seconds]
<diegoviola> thanks
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hck89 has joined #ruby
<jhass> spygame: I still don't get it, you only did the "add code" part of ?context. I'd suggest you answer Senjai's questions (in case you didn't get it)
sfarley has joined #ruby
<apeiros> symbols aren't keywords, though
<Senjai> apeiros: I know, but I think he was trying to get me on calling a symbol a keyword.
<Senjai> because of kwargs
<Senjai> just defending myself :P
<apeiros> Senjai: think of the children! you might confuse them!
wallerdev has joined #ruby
finisherr has joined #ruby
<slash_nick> Senjai: I'm mostly being silly... was having fun with one of these moments: http://i.computer-bild.de/imgs/4/3/7/8/4/2/9/Conspiracy-Keanu-745x559-5176787edc95968f.jpg
a346 has joined #ruby
numberte1 is now known as numberten
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Igorshp has quit [Remote host closed the connection]
sumark has quit [Remote host closed the connection]
s2013 has joined #ruby
joshbamboo2 has quit [Quit: Leaving]
<spygame> jhass: i'm sorry, i was searching in log to find Senjai's question :) . So i'm not sure how to explain this. Its a rules based system where you define certain rules which basically is if/else condition(s) and if the statement is true you perform a certain action. why am i doing this? i guess i'm replicating a system and that's the business requirement if that's serves as an explanation
sumark has joined #ruby
RegulationD has quit [Remote host closed the connection]
RegulationD has joined #ruby
gianlucadv has quit [Ping timeout: 264 seconds]
spider-mario has joined #ruby
juanpaucar has joined #ruby
rbennacer has joined #ruby
<_blizzy_> please excuse the messy code. can anyone help me figure out why @team keeps resetting to []? https://gist.github.com/NotBlizzard/d6b057df27ab03837f67
rodfersou has quit [Quit: leaving]
<jhass> Senjai: ^ see I win, because management
<_blizzy_> I've been working on this for about 2 hours, can't find the bug. ._.
<slash_nick> spygame: be wild and use elasticsearch percolators to solve the problem
phutchins has joined #ruby
<havenwood> _blizzy_: It's odd you initialize @team as `Array.new` then a few lines later replace that with `false`.
<havenwood> _blizzy_: Use `[]` and `{}` instead of `Array.new` and `Hash.new`.
<_blizzy_> havenwood, I love you so much right now.
<_blizzy_> thank you.
<havenwood> _blizzy_: you're welcome
<_blizzy_> and I thought Hash.new was faster?
<havenwood> _blizzy_: Nope, use the literal.
<_blizzy_> havenwood, ok then.
<jhass> spygame: anyway, it seems like you have a defined set of possible statements, use a case when and access fields with the hash brackets
<slash_nick> _blizzy_: pkmn only gets populated conditionally... are all those conditions met?
<slash_nick> pkmn_team*
atomical has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<_blizzy_> slash_nick, yes.
<_blizzy_> but I'll double check them.
Papierkorb has joined #ruby
WildBamboo-Josh has joined #ruby
Ontolog has joined #ruby
<havenwood> _blizzy_: Here's a benchmark-ips with Ruby 2.2: https://gist.github.com/havenwood/8f4e4ee03aa79549caf0
Xeago has quit [Remote host closed the connection]
__butch__ has joined #ruby
<_blizzy_> havenwood, thxs.
<havenwood> _blizzy_: There the literal is a bit more than 6x as fast.
Xeago has joined #ruby
<_blizzy_> ok then. I'll use literal.
<Ontolog> Gemfile question. Suppose I have a couple of gems I personally want to use for development and debugging (e.g., "awesome_print"), but I don't want to make changes to the Gemfile for everyone else, is there a way to do that?
micmus has quit [Ping timeout: 272 seconds]
ht__ has quit [Quit: Konversation terminated!]
<jhass> Ontolog: no sane one
<Senjai> jhass: Not really
greensoup has quit [Ping timeout: 264 seconds]
<Senjai> jhass: I guessed the system type
<Senjai> spygame: How often do the rules need to change?
<Senjai> jhass: <3
<jhass> Ontolog: note there are optional groups with bundler 1.10
<Senjai> jhass: besides, you cheated, everything eventually boils down to because management
<jhass> Senjai: I saw no rules defined yet, so...
<spygame> Senjai: once defined i doubt they will change for that particular landing point
<Senjai> spygame: Okay, there is a better way of doing this.
powersurge has left #ruby ["WeeChat 0.4.3"]
dgutierrez1287 has joined #ruby
lavros has quit [Quit: leaving]
<_blizzy_> also, havenwood, seems like that wasn't it
<diegoviola> why can't I return() from the ruby main scope?
<_blizzy_> I put a print statement to find out if all the conditions were being met, and they are
<diegoviola> I get some stupid error
asmodlol has quit [Ping timeout: 256 seconds]
<_blizzy_> however, the array still resets for some reason.
<diegoviola> LocalJumpError
<diegoviola> sigh
<shevy> DanceCrazyError
<apeiros> diegoviola: you can't think of a reason why you can't?
<spygame> Senjai: which is ?
<Senjai> spygame: If you have things that very rarely change, even arithmetic operations, you could do something like: https://gist.github.com/Senjai/92ceb0abd26281310ff3
DoubleMalt has joined #ruby
tomphp has joined #ruby
<diegoviola> apeiros: I don't get your question
<Senjai> spygame: Speccifically, give an action, and a ruleset, and if it passes the ruleset, do the action
<shevy> apeiros also does not know the answer
<Senjai> this is basic fraud checking, but it can apply to your case too
<diegoviola> apeiros: because it's in main()?
<_blizzy_> havenwood, pkmn_team is the one with the items
einarj has quit [Ping timeout: 246 seconds]
<apeiros> diegoviola: you notice you can't return from main. and you can't figure out why?
<Senjai> spygame: I would also store the rules in json somewhere too
<_blizzy_> so wouldn't that also make @team have the items
acke has quit [Remote host closed the connection]
<apeiros> diegoviola: that's just restating a fact.
<havenwood> _blizzy_: Each time the #run method is called, `pkmn_team` is cleared here: https://gist.github.com/NotBlizzard/d6b057df27ab03837f67#file-a-rb-L55
einarj has joined #ruby
<diegoviola> apeiros: yeah sorry I wasn't thinking about what I was asking
<_blizzy_> havenwood, oh ok.
<apeiros> diegoviola: so what should happen when you return from main?
<_blizzy_> let's try this then.
duderonomy has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Senjai> spygame: This approach, unaltered, would allow admins to check box a list of rulesets that they want for that action, but oyou would define the rulset in code.
<shevy> exit!
<Senjai> You could also have each ruleset take an argument
<diegoviola> apeiros: I don't know, you tell me
<Senjai> and only store those arguments in a serialized column on the database
<shevy> exit!
<Senjai> TLDR, thousands of ways to solve your problem :P
<apeiros> shevy: you need help exiting the channel? :-p
asmodlol has joined #ruby
<shevy> I think a return would exit from main
duderonomy has joined #ruby
<apeiros> Senjai: lol
a346 has quit [Quit: a346]
<shevy> lol
cubicool has quit [Quit: leaving]
<shevy> what an ugly girl
<shevy> I mean bird! bird!!!
<shevy> does such a bird exist for real?
<apeiros> shevy: that'd be a somewhat decent action. what do you do when somebody does `return Foo.new("hello")`?
dgutierrez1287 has quit [Ping timeout: 272 seconds]
vickleton has joined #ruby
tomphp has quit [Client Quit]
<shevy> I discard it!
<shevy> apeiros by the way, is your programming language still called halsbe?
<apeiros> shevy: it will forever be called that way :)
<shevy> ah ok
<_blizzy_> havenwood, thanks, but it's still resetting. let me paste my new code. :/
nahtnam has quit [Quit: Connection closed for inactivity]
micmus has joined #ruby
<_blizzy_> https://gist.github.com/NotBlizzard/15da6fdfaa67df87c0ce sorry that I keep asking for help, havenwood
segfalt has quit [Quit: segfalt]
Kache4 has joined #ruby
Jackneill has quit [Remote host closed the connection]
tomphp has joined #ruby
soulcake has quit [Ping timeout: 276 seconds]
baroquebobcat has quit [Ping timeout: 265 seconds]
soulcake has joined #ruby
<havenwood> _blizzy_: This code is being run multiple times but not appending to @team?
B1n4r10 has joined #ruby
bluOxigen has quit [Ping timeout: 256 seconds]
jlast has quit [Read error: Connection reset by peer]
Igorshp has joined #ruby
<_blizzy_> havenwood, the code is being ran, and it's appending to @team, it just keeps resetting somewhere.
<havenwood> _blizzy_: When you initialize a new Battle?
<_blizzy_> havenwood, no, I only initialize a new battle once
JoshL has quit []
<_blizzy_> I then use that same battle to run the run method
<havenwood> _blizzy_: Show the code you run it wiht?
Alayde_ has joined #ruby
Igorshp has quit [Remote host closed the connection]
ruv has quit [Ping timeout: 256 seconds]
<havenwood> _blizzy_: It seems the other place you modify the contents of @team is here: https://gist.github.com/NotBlizzard/15da6fdfaa67df87c0ce#file-a-rb-L270
JDiPierro has quit [Remote host closed the connection]
commondream has joined #ruby
einarj has quit [Ping timeout: 248 seconds]
<_blizzy_> havenwood, yeah, but that is never reached for a while
jlast has joined #ruby
<havenwood> _blizzy_: Don't create global variables.
<_blizzy_> havenwood, oh, ok.
<_blizzy_> c:
<havenwood> _blizzy_: Looks like the first few globals you use should be constants.
asmodlol has quit [Remote host closed the connection]
<havenwood> _blizzy_: Do you have any unit tests?
<_blizzy_> havenwood, not atm.
jtbnyc69 has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
s2013 has quit [Read error: Connection reset by peer]
<havenwood> _blizzy_: Just glancing at the #run method I don't follow what it's doing. It's doing a lot.
Scrofff has joined #ruby
einarj has joined #ruby
catcher has quit [Remote host closed the connection]
<_blizzy_> havenwood, it's connecting to a websocket, so I pass the message to the method. based on the data in the message, it does something different.
<_blizzy_> thus the switch case /case when.
<havenwood> _blizzy_: Try to make methods shorter than hundreds of lines. ;)
rubie has joined #ruby
<_blizzy_> havenwood, ok. :)
sarkyniin has joined #ruby
atom3 has quit [Ping timeout: 276 seconds]
adamjleonard has quit [Quit: Leaving...]
pdoherty has quit [Quit: Leaving]
balazs has joined #ruby
<havenwood> _blizzy_: You might try putting a few `p "this place: #{@team}"`s in there in different places to sanity check that it's doing what you think it's doing. Once you hone in, maybe a`require 'pry'` and a `binding.pry` or two to explore.
<havenwood> _blizzy_: Breaking methods down into smaller units that you test might help you gain confidence in your code.
atom3 has joined #ruby
spygame has quit [Quit: Page closed]
Channel6 has quit [Quit: Leaving]
Scroff has quit [Ping timeout: 256 seconds]
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hck89 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<_blizzy_> havenwood, thanks for the advice.
<_blizzy_> I just wish I could find this bug.
adamjleonard has joined #ruby
rbennacer has quit [Remote host closed the connection]
baroquebobcat has joined #ruby
AlphaAtom has joined #ruby
pengin_ has quit [Remote host closed the connection]
diegoviola has quit [Quit: WeeChat 1.2]
<postmodern> is there any documentation on using database-backed sessions with warden?
einarj has quit [Ping timeout: 248 seconds]
balazs has quit [Ping timeout: 244 seconds]
aphprentice has joined #ruby
sarkyniin has quit [Read error: Connection reset by peer]
kadoppe has quit [Ping timeout: 264 seconds]
greensoup has joined #ruby
<_blizzy_> idk if I should upgrade to ruby 2.2 or stick with ruby 2.1.0
einarj has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ldnunes has quit [Quit: Leaving]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
skade has quit [Quit: Computer has gone to sleep.]
kadoppe has joined #ruby
sanjivupadhyaya has joined #ruby
<sanjivupadhyaya> hello
Takasm has joined #ruby
Takasm is now known as Guest10751
Guest10751 has quit [Client Quit]
mikecmpbll has quit [Quit: i've nodded off.]
<sanjivupadhyaya> hello
blackmesa has joined #ruby
<_blizzy_> hello, sanjivupadhyaya
<sanjivupadhyaya> i am just testing.. sorry for that ;)
<slash_nick> hello, hello, sanjivupadhyaya :)
baroquebobcat has quit [Quit: baroquebobcat]
sarkyniin has joined #ruby
<sanjivupadhyaya> hello , hello
<sanjivupadhyaya> :)
<sanjivupadhyaya> can you guys tell me why we specify rails version while creating a new app
<sanjivupadhyaya> eg : rails __versionNumber__ new exampleApp ?
scripore has quit [Quit: This computer has gone to sleep]
baroquebobcat has joined #ruby
scripore has joined #ruby
sanjivupadhyaya is now known as __noob_
decoponyo has quit [Quit: Leaving...]
__noob_ is now known as __noob__
Palmer11 has left #ruby [#ruby]
<Senjai> __noob__: Dont neeed __ in your name yo
micmus has quit [Quit: Leaving]
<__noob__> haha
<__noob__> i like to keep my name a secret since I am asking silly questions ;)
Juanchito has quit [Quit: Connection closed for inactivity]
<__noob__> I will flash my name after i become a CEO of some fancy startup ;)
<slash_nick> __noob__: if you register a nickname, you can join us in #rubyonrails to get some help with that... And no one here will fault you for asking silly questions.
<__noob__> okay slash.. i will try that now
FernandoBasso has joined #ruby
Pumukel has quit [Quit: ChatZilla 0.9.91.1 [Firefox 38.0.5/20150525141253]]
arturhoo has quit [Quit: arturhoo]
elia has quit [Quit: Computer has gone to sleep.]
bronson has quit [Remote host closed the connection]
arooni-mobile has joined #ruby
* Senjai googles sanjivupadhyaya
Yiota has joined #ruby
<__noob__> well I googled it but could not find it..
<Senjai> __noob__: I'm bugging you, I was more pointing to the fact typing _ to adress you is annoying
<Senjai> :P
<Senjai> address*
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<__noob__> now this shoudl be fine
IanV0rn has joined #ruby
duderonomy has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Virtual_ has quit [Ping timeout: 275 seconds]
blahwoop has quit [Remote host closed the connection]
__noob__ is now known as noob
<noob> sould be fine now ;)
jerius has quit [Quit: /quit]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
michael_mbp has quit [Excess Flood]
Virtual_ has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
scripore has quit [Read error: Connection reset by peer]
Igorshp has joined #ruby
michael_mbp has joined #ruby
Xeago has quit [Remote host closed the connection]
shellie_ has joined #ruby
bronson has joined #ruby
datanoise has quit [Ping timeout: 272 seconds]
rdark has quit [Quit: leaving]
adamjleonard has quit [Read error: Connection reset by peer]
Yiota has joined #ruby
Soda has quit [Remote host closed the connection]
adamjleonard has joined #ruby
IanV0rn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Scrofff has quit [Remote host closed the connection]
sarkyniin has quit [Remote host closed the connection]
sarkyniin has joined #ruby
grex25 has joined #ruby
yqt has joined #ruby
gccostabr has joined #ruby
thelastinuit has quit [Quit: Textual IRC Client: www.textualapp.com]
<grex25> Hi, I am trying to install a gem (gem install jekyll), but theres only a blinking cursor and no output, but I got installed everything
CloCkWeRX has quit [Quit: Leaving.]
<grex25> Am I doing something wrong?
jenrzzz has joined #ruby
motivated has quit [Quit: Page closed]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
einarj has quit [Read error: Connection reset by peer]
Rickmasta has joined #ruby
Musashi007 has joined #ruby
Yiota has joined #ruby
einarj has joined #ruby
Scroff has joined #ruby
vickleton has quit [Quit: Ex-Chat]
sarkyniin has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 272 seconds]
Scroff has quit [Remote host closed the connection]
charliesome has quit [Quit: zzz]
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mrmargolis has quit [Remote host closed the connection]
jenrzzz_ has joined #ruby
Zai00 has quit [Quit: Zai00]
<Senjai> grex25: I usually strace the task there, for those scenarios
<Senjai> and see what system call its getting held up on
<Senjai> grex25: strace gem install jekyll, if it looks like anything related to http, its probably some sort of timeout
<Senjai> or not using https
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 244 seconds]
<drbrain> or you could use the verbose flag
Igorshp has quit [Remote host closed the connection]
chinmay_dd has joined #ruby
<drbrain> gem install jekyll -V
<Senjai> Psht, I didn't know about the verbose flag
<Senjai> drbrain: You need to strace harder sir
<Senjai> :P
<Senjai> I debug ruby with gdb *sunglasses*
<_blizzy_> can anyone help me figure out why @team is resetting the 'when' ends on line 91? https://gist.github.com/NotBlizzard/837716920ff8a7a68da5
wildroman2 has joined #ruby
<drbrain> strace isn't going to tell you if you're seeing normal behavior or not if your only experience is broken behavior
einarj has quit [Ping timeout: 246 seconds]
<_blizzy_> I'm using byebug, and after it hits line 91, it resets.
Igorshp has joined #ruby
f0ster has quit [Ping timeout: 264 seconds]
<Senjai> drbrain: That's fair, but when looking for hangs, which can often be caused by IO, it's still helpful, just may not be the most helpful :P
<Senjai> _blizzy_: Step 1, lock byebug down to an earlier version
<Senjai> recent versions cause issues
<Senjai> Step 2, that is the most complex code I've ever seend
<Senjai> seen*
<Senjai> not really, but I'm making a point
<_blizzy_> Senjai, I mean @team, the array resets
<_blizzy_> not byebug itself
<Senjai> Do you modify it in byebug?
<_blizzy_> no
<Senjai> Idk
<Senjai> byebug is terrible
<_blizzy_> after I step past line 91, the array resets back to nil
<Senjai> I dont use it
<slash_nick> _blizzy_: are you absolutely sure you're not entering the 'else' block? https://gist.github.com/NotBlizzard/837716920ff8a7a68da5#file-a-rb-L79-L83
<Senjai> I use pry
<_blizzy_> slash_nick, I'm sure because I can put in a print statement, and it prints
<_blizzy_> plus at line 91 with byebug, the array has the correct values
<slash_nick> oh.
Igorshp has quit [Remote host closed the connection]
yfeldblum has joined #ruby
<Senjai> _blizzy_: Get rid of byebug, try pry, see if same problem.
einarj has joined #ruby
chinmay_dd has quit [Ping timeout: 272 seconds]
<_blizzy_> Senjai, I just tried pry. how do I 'step forward' in pry?
<Senjai> _blizzy_: You dont.
tjbiddle has quit [Quit: tjbiddle]
<Senjai> _blizzy_: If you have to use byebug, only earlier versions are okay. You shouldnt have to do step driven development
codecop has quit [Remote host closed the connection]
<Senjai> Instead you could clean up your code so you dont have to use step to figure out how it works
<_blizzy_> I tried pry before byebug, and I got the same values.
RegulationD has quit [Remote host closed the connection]
Pwnna has joined #ruby
<slash_nick> _blizzy_: what... your case statement ends on line 87... what's this "when" stuff? https://gist.github.com/NotBlizzard/837716920ff8a7a68da5#file-a-rb-L93-L95
<Senjai> slash_nick: case m[1]
<Senjai> whatever m[1] is
<_blizzy_> it's an AI for a Pokemon simulator.
<Senjai> _blizzy_: I would suggest splitting up so as to eliminate all switch statements. and long if chains
<slash_nick> Senjai: does it not end on line 87?
<Senjai> slash_nick: ... no
<slash_nick> case;when;end;when; is what i'm reading
<Senjai> It ends the if
<Senjai> i believe
<slash_nick> ah, my bad i guess...
<slash_nick> i think the gist pane was doing some scrolling on me
sfarley has quit [Remote host closed the connection]
<_blizzy_> well, IDK what the heck the bug is.
devdazed has quit [Quit: Computer has gone to sleep.]
<_blizzy_> :>
<Senjai> _blizzy_: Nobody could ever tell you. I would not be suprised if that code can break in any way
sfarley has joined #ruby
<_blizzy_> Senjai, it's an AI, so it's not going to be the 'cleanest' code
gigetoo has quit [Ping timeout: 264 seconds]
zeroDivisible has quit [Quit: WeeChat 1.2]
<Senjai> _blizzy_: Uhm, ai's can have clean code
<_blizzy_> plus it's not finished in the first place :/
<Senjai> _blizzy_: Right, but you're already in pain because of poor coding practices
void has joined #ruby
zeroDivisible has joined #ruby
Asher has quit [Quit: Leaving.]
<_blizzy_> how is this poor?
jlast has quit [Remote host closed the connection]
<_blizzy_> a switch case is the best way to handle this imo.
<dfockler> try rich coding instead
<Senjai> How is it not?
bougyman has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<void> hello *
<_blizzy_> you're not giving any reasons why it is?
<Senjai> Point out anything in specific and I'll tell you how
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jlast has joined #ruby
<_blizzy_> you're the one who called me out in the first place.
zeroDivisible has quit [Client Quit]
<Senjai> I'm not going to write a 2000 word essay, pick out anything you think is a good decision
zeroDivisible has joined #ruby
<_blizzy_> ok, then I'll keep writing my code. c:
<Senjai> lol, k
<_blizzy_> k.
B1n4r10 has joined #ruby
workmad3 has joined #ruby
<slash_nick> _blizzy_: he's not picking on you... just encouraging you to step it up a little
<Senjai> ^
<Senjai> We've all been new.
<Senjai> It's about caring about your craft.
<_blizzy_> slash_nick, I know it's not the best code atm. I'm trying to get it to 'work', then I'll refactor
<slash_nick> we're all glad you're here.. glad you're asking questions... glad to help.
<slash_nick> 
<Senjai> _blizzy_: This is already complex to the point where making it work is going to be incredibly harder than refactoring it
<_blizzy_> sorry if I was sounding dickish, Senjai
<_blizzy_> Senjai, but how is complex bad?
<Senjai> Like, if you dont care about getting better, there is nothing we can do.
bougyman has joined #ruby
<Senjai> _blizzy_: The job description of any developer is essentially: "Manage complexity"
<Senjai> Also, occams razor
<_blizzy_> I'm reading a websocket, and there are multiple messages.
<_blizzy_> so I'd rather have a switch case than 20 elsif statements.
<Senjai> Right, so there should be a class that handles the websocket.
jahrichie has quit [Quit: Leaving.]
<_blizzy_> there is
<Senjai> That class should then determine what part of the application should handle that request/push
<_blizzy_> it's just not in the file.
<Senjai> like a controller
fabrice31 has joined #ruby
<_blizzy_> it's in another file.
<Senjai> Each of those classes should only handle its behavior, formulate a response, and return it to the class responsible for responding
<Senjai> each of these cases, should be a seperate class.
pengin has joined #ruby
<_blizzy_> oh, ok.
<_blizzy_> I still don't understand how complex == bad, but ok.
<Senjai> You can take a routing approach, defining "Message handlers" for each code you get from the socket
<_blizzy_> isn't that what I'm doing?
<Senjai> _blizzy_: If you had no knowledge of this code, and were asked to add a feature, you couldn't
<_blizzy_> Senjai, I probably could. :/
<Senjai> I cannot read any piece of this code, without understanding the entire codebase
jlast has quit [Ping timeout: 264 seconds]
<Senjai> m[3].include? 'fnt' <<
<Senjai> m means nothing to me
<Senjai> How am I supposed to know what 3 stands for
<Senjai> or what'
<_blizzy_> I could probably go in a repo
<Senjai> or what's supposed to be at that index
<_blizzy_> grab a random line
<Senjai> 'fnt' also means nothing to me
<_blizzy_> and I wouldn't know what it means.
void has left #ruby ["WeeChat 0.4.2"]
<Senjai> if fnt_list.include? CERTAIN_FNT_TYPE
<Senjai> bam
jenrzzz_ has quit [Ping timeout: 255 seconds]
<Senjai> i just dont know what fnt stand for
workmad3 has quit [Ping timeout: 256 seconds]
<Senjai> I could make it more readable if I did
<_blizzy_> oh.
<Senjai> opponent_immunities = Array.new and resistances, etc
<Senjai> Opponent = Struct.new(:resistances, :weaknesses, :immunities)
<Senjai> There should be the concept of an "Opponent" because it is a "thing"
<Senjai> as I said, I can go on forever
<_blizzy_> ok.
<Senjai> but I suggest you get a good book on programming
<_blizzy_> I know how to program.
<_blizzy_> I'm just trying to get it to 'work' atm. I'll refactor later.
fabrice31 has quit [Ping timeout: 252 seconds]
<Senjai> You don't, you have to admit that. This is brute force programming. It's not something someone who understand how to solve programs with code would even try
noob has quit []
<Senjai> https://pragprog.com/book/ruby4/programming-ruby-1-9-2-0 Is what I'd recommend as a start
<Senjai> Also the refacotoring book by martin fowler
<_blizzy_> how can you say I don't know how to program
<_blizzy_> when I obviously do.
noob has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Narzew has quit [Ping timeout: 252 seconds]
<slash_nick> _blizzy_: you know a programming language
<_blizzy_> slash_nick, I know that. I also know how to 'program'. I know the difference
<Senjai> _blizzy_: Just because you can copy paste code, and it does something, is not knowing "how to use a computer to solve problems effectively"
<_blizzy_> Senjai, I'm not c/p code.
<Senjai> It's a saying
workmad3 has joined #ruby
<_blizzy_> atm, I want to code to work, then, like I said earlier, I will refactor.
<_blizzy_> since everything has a rough draft.
<Senjai> Sure thing, go for it. I'm going to just drop this as I can't convince you of any of this.
<_blizzy_> this is not even 'beta'
<_blizzy_> ok.
Asher has joined #ruby
greensoup has quit [Ping timeout: 246 seconds]
ndrei has quit [Ping timeout: 244 seconds]
ndrei has joined #ruby
mary5030 has quit [Remote host closed the connection]
<slash_nick> _blizzy_: how about this... I'll paste your class into my console... do you have any code to reproduce the problem? something like `b = Battle.new(plz_give_me_this, plz_give_me_this); b.run; b.team == []`
Scroff has joined #ruby
adamjleonard has quit [Quit: Leaving...]
workmad3 has quit [Ping timeout: 256 seconds]
charliesome has joined #ruby
noob has quit []
<umgrosscol> _blizzy_: You'd have to break that code up in to more manageable pieces for people to easily reason about it.
dopie has joined #ruby
<umgrosscol> _blizzy_: does @team end up being nil or an empty array?
<_blizzy_> umgrosscol, nil
<_blizzy_> slash_nick, um, give me a few minutes. I think I found something.
<umgrosscol> puts @team returns a value though?
<umgrosscol> Err... displays a value.
segmond has joined #ruby
Scroff has quit [Ping timeout: 248 seconds]
Luun has quit [Quit: Luun]
<slash_nick> _blizzy_: I will say that I got something strange when I pasted your class definition into my console...class definitions normally return nil. Yours returned :effectiveness .... there is something very wrong in there :) but as everyone is telling you, you'll need to refactor to move forward
<_blizzy_> using byebug, after it reaches a certain line, it becomes nil
havenwood has joined #ruby
<umgrosscol> _blizzy_: I see. Which line does it become nil? you might have gotten out of scope.
<_blizzy_> slash_nick, ok, thank you. sorry if I was acting defensive or 'dickish' to anyone. sorry also, Senjai c:
baweaver has quit [Remote host closed the connection]
<_blizzy_> after line 91
<umgrosscol> although I don't see how as this is all supposed to be one monolithic class.
GPrime has joined #ruby
<_blizzy_> it's a Pokemon AI. It's connecting using a web socket, so I have to parse each line the web socket sends.
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<_blizzy_> then I use a switch case based on the line the web socket sends.
<Senjai> umgrosscol: We went through all of that already. Depending on when you joined the channel
JDiPierro has joined #ruby
<umgrosscol> Senjai: I see.
<umgrosscol> Yeah... too much complexity in one place for me to easily reason about.
<_blizzy_> well, ok, I'll start to refactor.
Lucky_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
CamonZ has quit [Read error: Connection reset by peer]
<umgrosscol> Variables like t, p1, m, data[] reminds me of looking at C.
<umgrosscol> I thought one of the implicit language rules of ruby was cute naming of things.
__rpc has joined #ruby
__rpc has left #ruby [#ruby]
Ropeney has joined #ruby
<umgrosscol> _blizzy_: You might want to write a few simple tests where you're passing in some recorded websocket response. That way you can edit your logic and make sure it's returning the expected results for the input.
volty has joined #ruby
JDiPierro has quit [Remote host closed the connection]
meph has joined #ruby
mandarinkin has quit [Quit: Leaving]
hahuang65 has quit [Ping timeout: 256 seconds]
<_blizzy_> umgrosscol, ok. I still don't understand how this is mind blowingly complex, but ok. ._.
<_blizzy_> I'll add comments
<umgrosscol> _blizzy_: Not mind blowingly complex. You have a lot of nesting and large blocks of code. That generally makes it difficult to reason about at a glance, and more difficult to test generally.
<_blizzy_> umgrosscol, oh.
blue_deref has quit [Quit: bbn]
<umgrosscol> _blizzy_: Some people don't have any problem with that style. I just find it easier to deal with things that are chunked smaller.
<_blizzy_> umgrosscol, oh ok. :)
<Senjai> umgrosscol: You're a much nicer person than I am <3
spider-mario has quit [Read error: Connection reset by peer]
<Senjai> Maybe I'm just bitter
sandstrom has quit [Quit: My computer has gone to sleep.]
<_blizzy_> sorry again, Senjai. I was just defensive.
<Senjai> _blizzy_: Yeah, my point is that you shouldn't be. This whole industry is all about other people telling you your code sucks. And telling other people the same.
<Senjai> Criticism makes everything better.
<_blizzy_> Senjai, oh.
umgrosscol has quit [Remote host closed the connection]
<Senjai> and learning from other peoples mistakes
<Senjai> I often think my code last month is terrible
<_blizzy_> atm I'm splitting up my code
<_blizzy_> into different files
<_blizzy_> like a helper file where some of my methods will be at
speakingcode has quit [Ping timeout: 246 seconds]
_ht has quit [Quit: Konversation terminated!]
greensoup has joined #ruby
datanoise has joined #ruby
<Senjai> _blizzy_: I would start by extracting into classes in the same file so its easier, and then you can move them elsewhere if you want
<_blizzy_> Senjai, ok. :)
<Senjai> _blizzy_: A good thing to ask yourself when refactoring: Does this method only do one thing? If not, should it be refactored so it only does one thing?
<havenwood> _blizzy_: Have you played around with Minitest yet? It ships with Ruby.
Papierkorb has quit [Quit: ArchLinux completes an endless loop faster than any other distro!]
<Senjai> Same with classes, each class should be responsible for a certain set of data
<_blizzy_> havenwood, I was going to try rspec
danielpclark has quit [Ping timeout: 264 seconds]
<Senjai> _blizzy_: That, and adding meaningful names to your methods and variables
hahuang65 has joined #ruby
<Senjai> You can never have too many methods, if it adds legibility and follows SRP
<Senjai> well you can, but your not likely to
<Senjai> And either rspec or minitest is fine.
<havenwood> _blizzy_: RSpec is popular indeed. Minitest is simpler and ships with Ruby.
poguez_ has joined #ruby
jahrichie has joined #ruby
<_blizzy_> havenwood, ok then.
<_blizzy_> thxs.
hatzopoulos has joined #ruby
<havenwood> _blizzy_: Here's a comment on one of your Gists. Try pasting this after loading your code in irb/pry: https://gist.github.com/NotBlizzard/d6b057df27ab03837f67
whippythellama has quit [Quit: WeeChat 1.2]
wilbert has joined #ruby
<havenwood> _blizzy_: You can get a long way with just `assert` and `refute`.
dopie has quit [Quit: This computer has gone to sleep]
<Senjai> Yep
<havenwood> _blizzy_: Then once you have something working and the tests pass, you're free to refactor and the tests can confirm if things are still green of if they've gone red.
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Senjai> havenwood: I still think that would be a bit much to ask at this particular point :P
enebo has quit [Quit: enebo]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<_blizzy_> havenwood, ok then. thanks again for your comment.
<havenwood> Senjai: Hem, I'm not sure. You think Minitest asserts are too much cognitive overhead early on?
<volty> of course, he has to refactor that ugly code first :)
<havenwood> _blizzy_: if you changed that `refute` to `assert` the test will fail
wilbert has quit [Ping timeout: 272 seconds]
<_blizzy_> havenwood, ok.
<volty> (and wrong, e.g. ws = ws
<Senjai> volty: be nice
<havenwood> volty: easier to refactor with tests ;)
<volty> Senjai: I am nice
<Senjai> havenwood: Yeah, the problem being that getting test coverage for all that, even though its all going to change is going to be difficult
einarj has quit [Remote host closed the connection]
<zenspider> did someone say minitest? :P
<havenwood> zenspider: \o/
pontiki has joined #ruby
<zenspider> huh. I don't have that as a keyword
<volty> havenwood: I do not believe so. I think you just can't test a nightmare :)
<zenspider> someone catch me up?
<Senjai> I'm with volty
<volty> _blizzy_: I'm joking.
<havenwood> volty: You could just add a test or two at a zoomed out level. Then extract method refactor and test the units.
<zenspider> bacon is a primary ingredient in my diet
<_blizzy_> volty, oh. c:
<Senjai> zenspider: TLDR convincing _blizzy_ to refactor his code to avoid bugs. Debating on if suggesting test coverage for the existing code before refactor or not
<havenwood> _blizzy_: Have a link to your latest code? (You can update gists by the way, intead of creating new gists.)
adamjleonard has joined #ruby
<Senjai> Psht, I never update gists. gist gem ftw
<_blizzy_> havenwood, well, I'll still refactoring.
<zenspider> always refactor against tests
<Senjai> zenspider: Look at his code first
vasilakisfil__ has quit [Read error: Connection reset by peer]
<zenspider> damn
<zenspider> 1134.1: flog total 189.0: flog/method average
<zenspider> 785.2: Battle#run a.rb:24
<zenspider> 270.1: Battle#decide a.rb:189
<zenspider> 59.6: Battle#effectiveness a.rb:288
finisherr has quit [Quit: finisherr]
wildroman2 has quit [Remote host closed the connection]
<zenspider> that's... untestable
<Senjai> See what I mean? :P
<Senjai> in this case I would refactor first, test second
<Senjai> as currently its not fleshed out or fully working as is
<pontiki> i hate to ask, but.. no, wait, i don't want to see
<volty> logic can be tested only after right semantics. — you have to know what your code does, and how it does. But that's just my humble opinion. I don't mind (and don't like) tests.
<_blizzy_> I feel bad now c:
ndrei has quit [Ping timeout: 265 seconds]
wildroman2 has joined #ruby
<havenwood> _blizzy_: Don't feel bad!
<Senjai> _blizzy_: Don't be, just take it constructively
<zenspider> ok. so, "basic" refactorings, split run into actions and replace the case with send
finisherr has joined #ruby
<Senjai> _blizzy_: We've all written terrible code, nobody just writes good code right away
<zenspider> that'll make each action its own thing, and each one should be (relatively) testable from there on
danielpclark has joined #ruby
<Senjai> zenspider: More like seperate objects etc. but yeah. Dont need to reference specific actions
<Senjai> zenspider: We did go over that too
vasilakisfil has joined #ruby
<zenspider> I wouldn't bother with separate objects at this point. he's not doing the command pattern, just dispatching
<Senjai> zenspider: The logic in each "dispatch" can be a seperate object
<zenspider> action_faint(m)
<zenspider> send "action_#{m[0]}"
<zenspider> err
<Senjai> Or Command if you want to be explicit on the pattern
<zenspider> send "action_#{m[0]}", *m[1..-1]
<Senjai> I'm anti send
<Senjai> zenspider: We're just going to confuse him, lets let him try, and see what he comes up with
<zenspider> I'm anti-gc-for-no-good-reason
<volty> imho the only test possible test at this stage is to see if the prog is running, even if wrong :) // then rewrite from scratch (looking at the old code). but that is a question of style
<Senjai> expect{program}.to_not raise_error
<Senjai> #fixed_forever
<zenspider> ugh
<grex25> Senjai, drbrain: Yeah was a timeout, but works now. Thanks for help!
<Senjai> grex25: <3
<zenspider> worst testing pattern that ever got popular
<Senjai> zenspider: You know I'm joking right
<zenspider> well, at this point, that pretty much IS the only test you can write
<Senjai> Aye haha
neanderslob has joined #ruby
<Senjai> grex25: FYI, 99% of the time, with no output, it usually is
<zenspider> _blizzy_: those numbers I pasted above are from a tool called "flog". The higher the number, the more complex a method is. (non-rails) Industry average is 10/method.
<grex25> Senjai: Was just wondering why there is no output, just like "trying to load gem XYZ.. connecting to 1.2.3.4 "
<zenspider> you should break your code down and in so doing, your flog score goes down and your testability goes up
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
<Senjai> grex25: If you use the verbose flag, there should be according to drbrain
hahuang65 has quit [Ping timeout: 255 seconds]
<Senjai> grex25: Otherwise, probably just not implimented
pontiki has quit [Remote host closed the connection]
<zenspider> there's verbose and debug if you really want to go overboard
<zenspider> the latter really is just noise
<volty> verbose for/at whom?
<grex25> Nono, but I just think just getting confronted with a blinkin cursor and zero output before is bad ;)
RegulationD has joined #ruby
<grex25> Senjai: Yeah, thanks for testing it ;D
mandarinkin has joined #ruby
<havenwood> _blizzy_: This stuff is hard and you're taking really good stabs at it and adapting quickly to advice. Go in the direction and simpler methods with tests and you're on a good track.
vasilakisfil has quit [Ping timeout: 256 seconds]
<havenwood> direction of*
<volty> people, stop pls torturing _blizzy_ :)
<volty> he has too many errors in that code
gigetoo has joined #ruby
<volty> I think he does not have enough experience. And so I suggest him to implement a simple tic-tac-toe before battling with initializiers
jlast has joined #ruby
CloCkWeRX has joined #ruby
<volty> e.g. @team = Array.new; @team = false
Lucky_ has joined #ruby
<_blizzy_> volty, I have experience
<Senjai> Nono, what hes doing is fine.
<_blizzy_> c:
<zenspider> this is far from torture. :P
<havenwood> Small and simple is really important.
<Senjai> We just need to stop suggesting things, and see what his refactoring turns out like
freerobby has quit [Quit: Leaving.]
<zenspider> agreed
<havenwood> Senjai: :)
<Senjai> This convo has gone on for over an hour now :P
RegulationD has quit [Ping timeout: 246 seconds]
<havenwood> Senjai: I've been away so full of vigor!
Musashi007 has quit [Quit: Musashi007]
<havenwood> Senjai: The evening shift is arriving.
<zenspider> dudedudeman: "how the eff does one test for datetime in minitest" ? what does that mean? (real q)
<Senjai> havenwood: Please, you have the same shift as I do
<volty> _blizzy_: then (if experienced) you must be very very tired. Get a rest.
<Senjai> Or at least a superset of it
<havenwood> Senjai: Yeah, we do overlap.
<Senjai> volty: Chill :P
<_blizzy_> volty, I'm not tired. c:
<volty> then by experience you must mean «experience of "particular coding"» :)
<zenspider> volty: "your code sucks. you must be very very tired." ... kinda rude, no?
<volty> at
<Senjai> ^
jlast has quit [Ping timeout: 250 seconds]
<Senjai> volty: That's not constructive, and doesnt help anyone
<_blizzy_> volty, no, I have experience in programming in general.
<volty> absolutely.I'm sure. and good
<volty> and I am not rude at all. And _blizzy_ must know that if he has general experience in programming
<Senjai> havenwood: I think the only reason I'm not on after work si because I run windows at home for the videogames and things. And I refuse to use putty to IRC :P
<Senjai> Also irc drains a lot of time
<Senjai> Best procrastination system
* zenspider looks around shiftily... goes back to coding like he should be
<Senjai> ^
<grex25> this channel is quite funny today *grabs popcorn*
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
greensoup has quit [Ping timeout: 250 seconds]
* dfockler is just over here writing python
arooni-mobile has quit [Ping timeout: 248 seconds]
nobitanobi has joined #ruby
jenrzzz has joined #ruby
pontiki has joined #ruby
mandarinkin2 has joined #ruby
icarus has quit [Ping timeout: 265 seconds]
mandarinkin has quit [Ping timeout: 256 seconds]
ruv has joined #ruby
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
joshbamboo1 has joined #ruby
Grok has joined #ruby
dfockler has quit []
grex25 has quit [Quit: Leaving]
Grok has left #ruby [#ruby]
NeverDie has joined #ruby
WildBamboo-Josh has quit [Ping timeout: 256 seconds]
Virtual_ has left #ruby ["Goodbye!"]
baweaver has joined #ruby
greensoup has joined #ruby
MyMind has quit [Ping timeout: 276 seconds]
scripore has joined #ruby
Pisuke has joined #ruby
baweaver has quit [Ping timeout: 246 seconds]
gigetoo has quit [Ping timeout: 246 seconds]
<_blizzy_> so it's wrong for methods to be big?
theery has quit [Remote host closed the connection]
<volty> it isn't wrong, it's just easier to grasp if you decompose your logic & flow in smaller units. A genius can write all the program in a single method. And even without a method :)
<Senjai> _blizzy_: It's wrong for a method to have more than one responsibility
<Senjai> There are exceptions, but thats a good rule to live by
davedev2_ has joined #ruby
<_blizzy_> I'm getting confused now with refactoring.
<_blizzy_> :/
Yiota has joined #ruby
davedev24_ has quit [Ping timeout: 248 seconds]
<Senjai> Take a brief gander at those
<volty> refactoring = rewriting // you write a novel, then you seen it's a mess, then you rewrite it correcting and polishing
Soda has joined #ruby
<Senjai> Not always man.
<Senjai> Refactoring in theory should not include a change in any logic
<Senjai> rewriting != refactoring
sdwrage has quit [Quit: This computer has gone to sleep]
<Senjai> he's kind of doing a mix of both
sdwrage has joined #ruby
<volty> sorry Senjai. But that about logic isn't true.
<Senjai> volty: Sorry dude, yes it is. A pure refactoring has no change in logic.
soahccc_ is now known as soahccc
<Senjai> Refactoring. …is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior
<volty> for sure you wanted to say «behavior» (external)
<Senjai> Sure
<Senjai> semantics
<volty> yes, you can change the internal logic as much as you please.
<volty> changing the internal structure is about changing the logic of solving / calculating
<Senjai> Yes, again, it was a semantics error
<volty> sorry
GPrime has quit [Quit: Textual IRC Client: www.textualapp.com]
<jhass> changing the logic would change the behavior, no? if we're fighting about semantics I'd say changing the way the logic is expressed
<Senjai> jhass: That's more correct, the logic surrounding the component as a whole is static. Given the same inputs, you get the same outputs. How that's handled can be changed in any which way
<volty> changing the logic does not necessarily change the behavior
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
snockerton has quit [Quit: Leaving.]
<Senjai> Yes, nobody disagrees with you :p
xelkarin has quit [Quit: WeeChat 1.1.1]
swgillespie has joined #ruby
wildroman2 has quit [Remote host closed the connection]
<Senjai> I googled "how to tell people they're right on the internet" but it didn't help
jpfuentes2 has joined #ruby
jamesaxl_ has quit [Read error: Connection reset by peer]
<volty> behaviour of the whole prog, of course (while internal units, of the chain, could change their external behaviour)
gigetoo has joined #ruby
<volty> ahah
<volty> let's conclude with «Internal Logic»
cpruitt has quit [Quit: cpruitt]
shinnya has quit [Ping timeout: 252 seconds]
sfarley has quit [Remote host closed the connection]
bruno- has quit [Ping timeout: 244 seconds]
baweaver has joined #ruby
wildroman2 has joined #ruby
finisherr has quit [Quit: finisherr]