« Back to channel list

#ruby - 24 June 2015

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