« Back to channel list

#ruby - 13 July 2015

« Back 1 day Forward 1 day »
[00:00:16] Igorshp: has joined #ruby
[00:00:38] symm-: has joined #ruby
[00:00:46] havenwood: >> ['Frank Lloyd 123 Wright', 'Frank 123 Lloyd Wright', 'Frank 123 Robinson'].map { |addy| addy.sub /\s\d+/, '' }
[00:00:47] ruboto: havenwood # => ["Frank Lloyd Wright", "Frank Lloyd Wright", "Frank Robinson"] (https://eval.in/397236)
[00:01:10] havenwood: carpeliam: What if there are more than one set of digits?
[00:01:14] havenwood: carpeliam: Impossible?
[00:01:19] saadq: has joined #ruby
[00:02:08] carpeliam: havenwood: impossible :) or extremely unlikely - i???m trying to match against names, a name would have to stretch across 3 lines
[00:02:31] havenwood: >> ['Frank Lloyd 123 Wright', 'Frank 123 Lloyd Wright', 'Frank 123 Robinson'].map { |addy| addy.delete('0-9').sub ' ', ' ' }
[00:02:32] ruboto: havenwood # => ["Frank Lloyd Wright", "Frank Lloyd Wright", "Frank Robinson"] (https://eval.in/397237)
[00:02:38] sevenseacat: has joined #ruby
[00:02:47] carpeliam: i don???t know the possible names beforehand, so it could be ???Sarah 98 Jessica Parker???
[00:03:03] Scripore: has joined #ruby
[00:03:19] havenwood: carpeliam: Pretty fancy to have a digit in your name.
[00:03:40] carpeliam: havenwood: they???re line numbers
[00:04:07] havenwood: carpeliam: For better suggestions show some possible input data with the return values you'd like.
[00:05:15] carpeliam: so if your first name ???Henry??? is at the end of line 3 and your last name ???Fonda??? is at the end of line 4, it???d show up as ???Henry 4 Fonda???
[00:05:44] dfockler: has joined #ruby
[00:05:46] atomical: has joined #ruby
[00:06:02] carpeliam: input data would be any sentence with a name in it, where a number could be between any word, and the return value would be the name without a number in between
[00:06:23] havenwood: carpeliam: Example input would be nicer than a description if you have any.
[00:06:24] blackmes1: has joined #ruby
[00:06:39] havenwood: carpeliam: Like the real stuff.
[00:06:41] carpeliam: so ???hello my 6 name is Jim Smith??? would return ???Jim Smith???, and ???hello my name is Sarah 8 Jessica Parker??? would return Sarah Jessica Parker
[00:07:02] y0da: has joined #ruby
[00:07:28] havenwood: carpeliam: So you just want to remove any digits and the space either preceding or following them? Is that all?
[00:08:06] freerobby: has joined #ruby
[00:08:13] fabrice31: has joined #ruby
[00:08:21] havenwood: carpeliam: Are there any digits you don't want to remove?
[00:09:21] havenwood: carpeliam: Do you ever want double spaces?
[00:10:05] josh2: has joined #ruby
[00:10:13] kies^: has joined #ruby
[00:11:28] havenwood: >> 'Frank Lloyd 123 Wright'.delete('0-9').squeeze
[00:11:29] ruboto: havenwood # => "Frank Lloyd Wright" (https://eval.in/397238)
[00:11:32] carpeliam: havenwood: I can always do something like name.split.reject{|x| x =~ /\d+/ }.join(??? ???) if there???s no better way to do it, but i???m specifically asking how to remove text from a match group in a regular expression
[00:11:54] carpeliam: that works too
[00:12:59] havenwood: carpeliam: A positive lookahead or lookbehind.
[00:16:24] ndrei: has joined #ruby
[00:17:14] shock_one: has joined #ruby
[00:18:00] robbyoconnor: has joined #ruby
[00:20:12] Yzguy: has joined #ruby
[00:21:18] freerobby: has joined #ruby
[00:22:48] BStheHD: whenever I write a script or something it executes in the console.. but how do I build an interface for a program?
[00:23:00] BStheHD: ^again new to this stuff guys :p
[00:27:54] josh2: has joined #ruby
[00:30:11] havenwood: BStheHD: Usually you'd cut a gem to distribute, install and update your tool and pick a lib for option parsing.
[00:30:28] havenwood: BStheHD: OptionParser ships with Ruby but is a bit verbose: http://ruby-doc.org/stdlib/libdoc/optparse/rdoc/OptionParser.html
[00:30:50] havenwood: BStheHD: You might prefer the Slop gem: https://github.com/leejarvis/slop#readme
[00:31:25] arescorpio: has joined #ruby
[00:31:28] havenwood: BStheHD: Or if you really need a more complex, git-like command parsing maybe consider Thor: https://github.com/erikhuda/thor#readme
[00:32:29] pontiki: BStheHD: what do you mean by "interface"?
[00:32:57] pontiki: graphical? terminal-based? api? web?
[00:33:12] Synthbread: has joined #ruby
[00:33:40] havenwood: pontiki: said "console," so i assumed terminal-based
[00:34:20] havenwood: pontiki: Though I guess it could execute in the console and be any sort of thing. :O
[00:34:34] saadq: I think he wants to make something that isn't just terminal-based
[00:34:41] pontiki: i read the "but" in the back half of that initial query, havenwood
[00:34:54] havenwood: pontiki: ahhh
[00:35:03] havenwood: Yeah, I'm probably the one who read it wrong.
[00:35:05] havenwood: BStheHD: Clarify?!
[00:36:26] BStheHD: sorry was afk
[00:36:43] BStheHD: that was a lot of confusing vocab there
[00:37:35] bruno-: has joined #ruby
[00:37:43] BStheHD: I'm just asking like how you can create a window/interface for a program.. not just so that it runs in the console
[00:37:58] havenwood: BStheHD: So GUI?
[00:38:08] BStheHD: yes exactly
[00:38:23] havenwood: BStheHD: Then ignore my recommendations, I fail at reading.
[00:38:32] toretore: BStheHD: which os?
[00:38:45] BStheHD: no worries lol
[00:38:59] freerobby: has joined #ruby
[00:39:40] Igorshp: has joined #ruby
[00:41:19] BStheHD: this is an example.. I have this script here http://pastebin.com/W5V4CN9V
[00:41:20] ruboto: BStheHD, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/76bb6f9d13d4bda30e07
[00:41:20] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[00:42:15] BStheHD: When I run it it executes in the console perfectly, but I want a GUI for it
[00:43:56] pontiki: BStheHD: maybe this: http://shoesrb.com/ ?
[00:44:02] pontiki: caveat: i hate GUIs
[00:44:09] havenwood: BStheHD: Yeah, give Shoes4 a try: https://github.com/shoes/shoes4#readme
[00:44:20] Igorshp: has joined #ruby
[00:44:32] BStheHD: okay thanks, I'll check it out
[00:45:07] havenwood: BStheHD: If you go that route you'll want to install JRuby if you haven't already: http://jruby.org/
[00:46:17] weemsledeux: has joined #ruby
[00:47:11] CloCkWeRX: has left #ruby: ()
[00:47:28] BStheHD: Is JRuby an alternative to http://rubyinstaller.org/ --because I have that installed
[00:47:55] toretore: it's an alternative that is required to run shoes
[00:47:59] havenwood: carpeliam: Uhg, I always forget #squeeze doesn't default to " ", so: delete('0-9').squeeze(' ')
[00:48:16] havenwood: Just remembered.
[00:48:52] BStheHD: Should I uninstall the other one then? If they do the same thing that should be fine
[00:49:03] Igorshp: has joined #ruby
[00:50:37] havenwood: BStheHD: You might want both. Dunno, you should be able to use Shoes3 with the former but JRuby is required at the moment for Shoes4.
[00:50:48] saadq: BStheHD: You could also go the web route to create UI's
[00:52:23] s00pcan: has joined #ruby
[00:54:46] ellisTAA: has joined #ruby
[00:55:52] Oog: has joined #ruby
[00:57:43] zacstewart: has joined #ruby
[00:57:48] fullofcaffeine: has joined #ruby
[00:57:52] chipotle: has joined #ruby
[00:58:19] baweaver: has joined #ruby
[00:59:12] baweaver_: has joined #ruby
[00:59:28] fullofcaffeine: has joined #ruby
[01:01:29] serivich: has joined #ruby
[01:01:41] Igorshp: has joined #ruby
[01:01:51] nfk: has joined #ruby
[01:04:04] djbkd: has joined #ruby
[01:04:35] JeramyRR: has joined #ruby
[01:06:21] Thomas-0725: has joined #ruby
[01:08:57] simplyianm: has joined #ruby
[01:11:44] davedev24: has joined #ruby
[01:11:49] Igorshp: has joined #ruby
[01:13:17] Scroff: has joined #ruby
[01:13:33] simplyianm: has joined #ruby
[01:13:37] PeterHsieh: has joined #ruby
[01:14:29] aaeron: has joined #ruby
[01:14:55] eggoez: has joined #ruby
[01:18:10] Yzguy: has joined #ruby
[01:18:38] bungoman: has joined #ruby
[01:21:00] unreal_: has joined #ruby
[01:21:57] baweaver: has joined #ruby
[01:24:00] Yzguy: has joined #ruby
[01:24:48] cytoskeletor: has joined #ruby
[01:29:39] serivich: has joined #ruby
[01:29:47] carpeliam: has joined #ruby
[01:31:21] nateberkopec: has joined #ruby
[01:32:09] surs2: has joined #ruby
[01:33:51] GriffinHeart: has joined #ruby
[01:34:11] nathanstitt: has joined #ruby
[01:37:02] tkuchiki: has joined #ruby
[01:37:51] znn: has joined #ruby
[01:38:17] bruno-: has joined #ruby
[01:38:40] Spami: has joined #ruby
[01:40:54] baweaver: has joined #ruby
[01:42:56] Vile`: has joined #ruby
[01:45:04] atomical: has joined #ruby
[01:52:55] Stratege_: has joined #ruby
[01:53:34] Synthbread: has joined #ruby
[01:53:58] zacstewart: has joined #ruby
[01:55:53] strmpnk: has left #ruby: ()
[01:56:35] podman: has joined #ruby
[01:56:40] Xoro: has joined #ruby
[01:58:16] icebourg: has joined #ruby
[01:59:07] icebourg: has joined #ruby
[01:59:57] Sehryn: has joined #ruby
[02:00:15] Guest26398: has joined #ruby
[02:02:11] dopie: has joined #ruby
[02:02:51] jimmythehat: how should I mock a block? e.g. array.map { |v| v.some_method } How should I mock v and its some_method method? I'm using rspec
[02:05:15] Oog: has joined #ruby
[02:06:03] pengin: has joined #ruby
[02:06:52] freerobby: has joined #ruby
[02:06:54] Radar: would you want to do that?
[02:06:58] Radar: pray tell
[02:07:03] Scripore: has joined #ruby
[02:07:25] freerobby1: has joined #ruby
[02:07:51] baweaver: pssst: mock the array
[02:08:02] baweaver: or the some_method
[02:08:47] jimmythehat: baweaver I feel mocking some_method would make more sense. Not sure hot to reference 'v' in a mock though?
[02:09:01] fabrice31: has joined #ruby
[02:09:02] jimmythehat: Radar: I haven't created some_method yet
[02:09:14] Radar: jimmythehat: some us an example?
[02:09:40] baweaver: allow_any_instance_of(YourObject).to receive(:some_method) { return_value } # probably
[02:10:07] qiukun: has joined #ruby
[02:10:16] jimmythehat: baweaver yeah thinking of that but the rspec team dont use allow_any_instance_of
[02:10:28] jimmythehat: tis buggy apparently
[02:10:51] baweaver: then what's their suggestion otherwise?
[02:11:07] jimmythehat: baweaver yeah its why am i here :L
[02:11:28] baweaver: If their response is it's buggy, I'd tend to ignore it honestly, but that's just me
[02:12:19] baweaver: you could do something more confounded by throwing stubbed doubles in as the array but that's worse
[02:12:35] baweaver: I've never actually had a problem with it
[02:13:12] baweaver: Radar: Am I talking crazy, or have you seen the "don't use allow_any_instance_of" train as well?
[02:13:17] dopie: has joined #ruby
[02:13:22] Radar: baweaver: no you're right
[02:13:38] baweaver: speaking of which
[02:13:44] Radar: an example would help here to know what we're actually supposed to be testing
[02:13:45] baweaver: where's this statement? Looking for it.
[02:13:46] Radar: rather than making up shit
[02:13:59] GriffinHeart: has joined #ruby
[02:15:37] LMity: has joined #ruby
[02:15:50] baweaver: ACTION wanders back to agar.io
[02:15:55] baweaver: ACTION thinks he might have a problem
[02:18:19] surs3: has joined #ruby
[02:19:56] balazs: has joined #ruby
[02:20:39] mary5030: has joined #ruby
[02:21:01] serivich: has joined #ruby
[02:22:37] surs4: has joined #ruby
[02:24:21] sharpmachine: has joined #ruby
[02:26:43] prestorium: has joined #ruby
[02:31:28] kies^: has joined #ruby
[02:31:39] Musashi007: has joined #ruby
[02:31:53] casadei_: has joined #ruby
[02:31:58] radialneon: has joined #ruby
[02:35:10] serivich: has joined #ruby
[02:35:37] msnyon: has joined #ruby
[02:38:08] yfeldblum: has joined #ruby
[02:39:38] bruno-: has joined #ruby
[02:39:49] GriffinHeart: has joined #ruby
[02:40:13] Frem: has joined #ruby
[02:40:37] darkf: has joined #ruby
[02:42:54] Spami: has joined #ruby
[02:44:43] dopie: has joined #ruby
[02:44:50] pwnz0r_: has joined #ruby
[02:45:26] bronson: has joined #ruby
[02:47:01] serivichi: has joined #ruby
[02:47:15] ledestin: has joined #ruby
[02:47:19] kkeuning: has joined #ruby
[02:48:18] hoofed: has joined #ruby
[02:48:20] Channel6: has joined #ruby
[02:48:29] iateadonut: has joined #ruby
[02:48:31] josh2: has joined #ruby
[02:49:08] hashrocket: has joined #ruby
[02:49:16] hoofed: has left #ruby: ()
[02:49:44] Antiarc: any_instance_of is generally a code smell
[02:49:49] Antiarc: You should only use it if you have no other option
[02:50:05] Antiarc: v.some_method should be done by passing an array of mocks that behave like whatever v will be
[02:50:15] Antiarc: array of doubles rather
[02:57:01] jenrzzz: has joined #ruby
[02:58:30] kkeuning: has joined #ruby
[02:58:52] annihilannic: has joined #ruby
[02:59:00] arooni-mobile: has joined #ruby
[02:59:00] arooni-mobile__: has joined #ruby
[02:59:16] kkeuning: has joined #ruby
[03:00:04] annihilannic: hi, can anyone tell me which package/gem/whatever provides vm_core.h, please? I'm unable to install debugger-linecache due to the lack of this file.
[03:00:22] davedev24: has joined #ruby
[03:00:28] Aeyrix: if you paste "vm_core.h" into google
[03:00:31] Aeyrix: the first result will giev you a fix.
[03:00:36] Aeyrix: I just checked.
[03:00:40] kkeuning: has joined #ruby
[03:00:52] annihilannic: I tried, and it made no sense to me, let me double-check.
[03:01:46] krz: has joined #ruby
[03:01:47] Scroff: has joined #ruby
[03:02:32] kkeuning: has joined #ruby
[03:03:06] lele: has joined #ruby
[03:03:11] ecksit: has joined #ruby
[03:03:14] evanjs: has joined #ruby
[03:03:17] annihilannic: Aeyrix: so I tried the 'gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p290' command mentioned there, and it gave me the same error. I have installed ruby-2.1.2 though, do I need to adjust that path? and does it need to point to some ruby source that I may not have installed?
[03:03:43] eggoez: has joined #ruby
[03:03:51] davedev24: has joined #ruby
[03:04:09] annihilannic: Aeyrix: for e.g., if I 'locate src/ruby', I get no hits.
[03:04:12] pwnz0r: has joined #ruby
[03:05:00] kkeuning: has joined #ruby
[03:05:04] surs: has joined #ruby
[03:05:12] spuk: has joined #ruby
[03:05:24] Antiarc: is ruby installed via your system package manager?
[03:05:31] Antiarc: you may need to install the -dev/-devel package if so
[03:05:44] Antiarc: (which will contain the ruby headers)
[03:06:14] spuk: has joined #ruby
[03:06:53] kkeuning: has joined #ruby
[03:08:16] annihilannic: Antiarc: I had ruby-1.8.7 installed (RHEL6) via yum, but the package I'm trying to install (kandan) requires ruby-1.9.3 or higher. I located a 2.1.2 rpm via pbone.net and installed that. I couldn't find a source package initially, just found a ruby-devel which I'll try, although I'm not sure it matches the ruby- package exactly...
[03:08:48] Antiarc: annihilannic: you will need a -devel package that matches the version of Ruby that you have installed
[03:09:12] Antiarc: Consider using something like rvm or rbenvm though - they may be a bit cleaner. Though I know some folks like to stick to rpms.
[03:09:44] annihilannic: Antiarc: thanks, I'll read about what those are.
[03:10:11] Antiarc: If you're familiar with python, they're similar in concept to virtualenv
[03:10:17] Antiarc: Though IMO are far better at the job
[03:10:53] annihilannic: I'm not, I come from perl
[03:10:57] braincrash: has joined #ruby
[03:11:20] annihilannic: Well, going backwards, I found a binary RPM corresponding to that source package.
[03:11:37] annihilannic: However examining the contents of the source I see no vm_core.h either.
[03:12:18] Antiarc: vm_core is part of the Ruby source, FWIW
[03:12:46] thiagovsk: has joined #ruby
[03:12:47] Antiarc: Speaking as a fellow RHEL6 deployer, though, rvm will do quite nicely :)
[03:12:53] cytoskeletor: has joined #ruby
[03:13:21] Antiarc: (some folks don't like it because it messes with your shell, rbenv is less intrusive and slightly less full-featured, but does the job just as well)
[03:15:20] Scripore: has joined #ruby
[03:16:59] eggoez: has joined #ruby
[03:20:16] Thomas-0725: Integer.respond_to?(:+)
[03:20:21] Thomas-0725: > Integer.respond_to?(:+)
[03:20:30] Thomas-0725: Ok, that is evaluating to false for me. What am I doing wrong?
[03:20:53] jesterfraud: >> Integer.respond_to?(:+)
[03:20:54] ruboto: jesterfraud # => false (https://eval.in/397278)
[03:20:59] bungoman: has joined #ruby
[03:21:05] jesterfraud: >> Integer.new.respond_to?(:+)
[03:21:06] ruboto: jesterfraud # => undefined method `new' for Integer:Class (NoMethodError) ...check link for more (https://eval.in/397279)
[03:21:14] icebourg: has joined #ruby
[03:21:19] jesterfraud: ha, would have been too straightforward
[03:21:24] jesterfraud: >> 1.respond_to?(:+)
[03:21:25] ruboto: jesterfraud # => true (https://eval.in/397280)
[03:21:39] jesterfraud: so an instance of an integer responds to +, but the class itself does not
[03:22:25] Thomas-0725: OK, so without actually declaring an integer, how would I say "Instance of Integer".respond_to?(sym) ?
[03:22:34] surs1: has joined #ruby
[03:23:37] Thomas-0725: >> Integer.respond_to?(:+@)
[03:23:38] ruboto: Thomas-0725 # => false (https://eval.in/397281)
[03:23:47] Thomas-0725: >> Numeric.respond_to?(:+@)
[03:23:48] ruboto: Thomas-0725 # => false (https://eval.in/397282)
[03:24:01] Thomas-0725: Ok, so in the ruby doc, what does :+@ mean?
[03:24:11] Thomas-0725: http://ruby-doc.org/core-2.2.0/Numeric.html#method-i-2B-40
[03:24:22] bnagy: >> 3.respond_to? :+
[03:24:23] ruboto: bnagy # => true (https://eval.in/397283)
[03:25:02] bnagy: >> Integer.instance_methods.include? :+@
[03:25:03] ruboto: bnagy # => true (https://eval.in/397284)
[03:25:57] Thomas-0725: What does the @ mean here?
[03:26:05] bnagy: don't know :D
[03:26:20] bnagy: 19>> Integer.instance_methods.include? :+
[03:26:21] ruboto: bnagy # => false (https://eval.in/397285)
[03:26:29] bnagy: ?experiment
[03:26:30] ruboto: Please use your local irb or pry (see ?pry) to experiment, ruboto's eval functionality is for demonstration purposes only.
[03:26:36] Thomas-0725: oh, those are not add and subtract. Those are unary +/- for positive/negative
[03:26:57] Thomas-0725: So where are add/subtract? :-(
[03:27:19] raenk: has joined #ruby
[03:27:37] dellavg: has joined #ruby
[03:27:46] bnagy: >> 3.methods.grep /\+/
[03:27:47] ruboto: bnagy # => [:+, :+@] (https://eval.in/397286)
[03:27:50] GriffinHeart: has joined #ruby
[03:27:57] bnagy: +other and +
[03:27:59] Sehryn: has joined #ruby
[03:28:19] annihilannic: Antiarc: fast getting out of my depth here. so I gather installing rvm under a single user would be the "light touch" approach. but then would I be able to install a "bundle" simply under that? and if so, how would my web server know about it?
[03:28:34] bnagy: nothing about rvm is "light" imo
[03:28:50] Antiarc: annihilannic: You would "rvm use 2.2.2" and rvm will adjust your paths to that particular ruby install
[03:29:09] Antiarc: Then you would "bundle install" and it would execute the ruby currently on path and install it into a gempath for that ruby install
[03:29:29] Thomas-0725: mmm, ok. I guess I'll just use instance_methods.include?(sym)
[03:29:38] annihilannic: And everything it installs would be under ~rvmuser/.rvm somewhere?
[03:29:44] bnagy: Thomas-0725: what's the actual question?
[03:30:04] christiandsg: has joined #ruby
[03:30:11] Thomas-0725: bnagy, the actual question is: if I have some arbitrary symbol, sym, how do I determine whether or not I can use it on a Float?
[03:30:37] bnagy: ask an instance of Float if it minds
[03:30:47] bnagy: but don't ask Float
[03:30:58] Thomas-0725: And more usefully, how do I determine if, when used on Float, it accepts a Float as the argument?
[03:31:29] bnagy: uh.. dynamic typing
[03:31:48] bnagy: as in the answer won't be useful
[03:32:07] sevenseacat: 'can i use it on a float?' != 'does it make sense to use it on a flat in this circumstance'
[03:32:07] bnagy: what's the actual, actual question? ;)
[03:32:18] Antiarc: annihilannic: What application server are you using? If it's passenger, then you'll just install passenger with your target ruby active. Otherwise, you'll just install your app server and invoke it from that environment
[03:32:43] Antiarc: Under rvm, that could be `rvm 2.2.2 do ruby whatever.rb`, which would execute whatever.rb under your 2.2.2 install
[03:33:04] Thomas-0725: The actual actual question is, I'm trying to make a parser for an RPN calculator, and I would like to parse the string into floats and symbols, and then error check to establish whether any of the symbols are invalid. My first idea was to just make an array of valid symbols and check against that, and that seems to be the most practical solution now.
[03:33:10] Antiarc: I haven't used rbenv/chruby in a while though, so I couldn't tell you the equivalents there
[03:33:23] bnagy: Thomas-0725: that is definitely how I would do it
[03:33:34] bnagy: tokenise, parse, do stuff
[03:33:47] surs2: has joined #ruby
[03:34:12] annihilannic: Antiarc: I've installed nodejs and execjs as per the very undetailed kandan setup instructions. Is execjs the application server in this scenario?
[03:34:13] Thomas-0725: Cool. I just wasn't sure if there was some more handy way to ask Ruby "Does this method work on two floats?" Seems there is not. :D Thanks for the help!
[03:34:33] bnagy: imho ruby is too dynamic to be able to metaprogram your way to a sensible implementation in such a specific domain
[03:34:34] Antiarc: Oh, kandan. No, nodejs and execjs are almost certianly only used for asset compilation.
[03:34:37] Antiarc: Let me find the link you referenced
[03:35:20] Antiarc: annihilannic: sorry, I'm not seeing the install instructions referenced. Can you relink it?
[03:35:27] Thomas-0725: bnagy, yes, that makes sense. I'm still quite new at this, and the existence of repond_to? caused some overexcitement I suppose. :)
[03:35:35] annihilannic: Antiarc: Not yet linked. :-) https://github.com/ivanoats/kandan/blob/master/DEPLOY.md#standalone-server
[03:35:47] gix: has joined #ruby
[03:35:52] bnagy: respond_to? is awesome, and the heart of duck typing, which is also awesome
[03:36:09] NeverDie: has joined #ruby
[03:36:14] bnagy: I just have ptsd from leaky parsers
[03:36:15] cytoskeletor: has joined #ruby
[03:36:25] Antiarc: annihilannic: `bundle exec thin start` - thin is the application server there. So really all you need to do is install rvm, `rvm install 2.2`, `rvm use 2.2`, and then follow the rest of the instructions
[03:36:33] swgillespie: has joined #ruby
[03:36:37] M-Technic: has joined #ruby
[03:36:50] SylarRuby: has joined #ruby
[03:37:04] annihilannic: Antiarc: thanks muchly, I'll give it a try.
[03:38:35] Antiarc: (also, as a tip - if you ever feel that rvm has screwed stuff up, `rvm implode` will remove everything installed by RVM and return your system to a pre-rvm state)
[03:39:05] annihilannic: Antiarc: quaint!
[03:39:32] sevenseacat: run it once, then install something that doesnt screw stuff up
[03:39:38] Ropeney: has joined #ruby
[03:40:36] jesterfraud: has joined #ruby
[03:40:55] Antiarc: (I'm personally a fan of RVM, but I don't mind its shell shenannigans. Others I respect are far less bullish on it!)
[03:41:44] bnagy: *everything may not include actually everything
[03:42:35] saadq: has joined #ruby
[03:43:06] annihilannic: Antiarc: yes, well, as long as I can ringfence it under a specific user I doubt they will bother me
[03:44:59] mary5030: has joined #ruby
[03:45:23] carpeliam: has joined #ruby
[03:46:30] Musashi007: has joined #ruby
[03:49:28] Oog: has joined #ruby
[03:51:27] Thomas-0725: bnagy (or anyone else), do you mind looking this over and providing any suggestions you might have? https://gist.github.com/thomasbcolley/a595294ef4e21a2f1833#file-gistfile1-rb -- rpn calculator
[03:52:17] lessless: has joined #ruby
[03:55:31] davedev24: has joined #ruby
[03:57:25] bnagy: I only have minor comments... don't use brackets when they're not required by the parser
[03:57:51] bnagy: and imho don't use private like that
[03:57:59] Caius: has joined #ruby
[03:58:15] dgutierrez1287: has joined #ruby
[03:58:27] bnagy: oh, wow, you have private and public, I see.. personally I find that confusing.
[03:58:43] bnagy: most code has all the public methods, then private, the private ones
[03:58:56] bnagy: but private is less common in ruby than elsewhere
[03:59:07] Ox0dea: has joined #ruby
[03:59:15] bnagy: initialize is usually in the public section.
[03:59:15] Ox0dea: >> '6 3 / 8 7 + + 3 * 9 -'.split.map { |t| Integer t rescue t }.each_with_object([]) { |t, o| o << (t[1] ? t : o.pop(2).reduce(t)) }
[03:59:16] ruboto: Ox0dea # => [42] (https://eval.in/397288)
[04:00:07] Oog: has joined #ruby
[04:00:30] allcentury: has joined #ruby
[04:00:48] Ox0dea: bnagy: Does the visibility of #initialize ever actually matter?
[04:01:04] bnagy: I don't know :)
[04:01:08] Ox0dea: Heh, fair enough.
[04:01:17] super`: has joined #ruby
[04:01:20] bnagy: but it's illogical to have it private, even if you can't really make it private
[04:01:36] bnagy: like.. creating instances is a public function of a class in my world
[04:01:45] super`: has left #ruby: ()
[04:01:59] Ox0dea: Right, it certainly shouldn't be private, I just wondered whether it had any actual effect.
[04:02:20] bnagy: I guess not because Klass#new magic?
[04:03:05] Ox0dea: Thomas-0725: Pardon?
[04:03:21] Thomas-0725: So basically you just did in 1 line what I did in 80? :O
[04:03:28] Ox0dea: Yay, Ruby?
[04:03:32] bnagy: but uglier :)
[04:03:38] bnagy: and with less checking
[04:03:52] peter_paule: has joined #ruby
[04:04:04] Thomas-0725: so what does rescue do there?
[04:04:10] bnagy: Thomas-0725: it abuses the way reduce works, because it has a very liberal to_proc or something in there
[04:04:32] Ox0dea: bnagy: Nah, #reduce with a String "just works".
[04:04:36] mercwithamouth: has joined #ruby
[04:05:28] Ox0dea: Thomas-0725: Kernel.Integer will fail given non-numeric input; in this case, I'm catching that error and assuming it means the token was an operator.
[04:05:34] xkickflip: has joined #ruby
[04:05:47] jenrzzz: has joined #ruby
[04:06:09] Thomas-0725: Ox0dea does it fail on a 1.1 or does it simply truncate?
[04:06:16] Thomas-0725: >> Integer "r"
[04:06:17] ruboto: Thomas-0725 # => invalid value for Integer(): "r" (ArgumentError) ...check link for more (https://eval.in/397289)
[04:06:27] Thomas-0725: >> Inteer "1.2"
[04:06:28] ruboto: Thomas-0725 # => undefined method `Inteer' for main:Object (NoMethodError) ...check link for more (https://eval.in/397290)
[04:06:34] Thomas-0725: anyway, IRB I know.
[04:07:03] Thomas-0725: ok, so your cool little trick fails for floating input
[04:07:26] Ox0dea: Ah, it does, but there's also Kernel.Float. :)
[04:07:37] Thomas-0725: >> '6 3.0 / 8 7 + + 3 * 9 -'.split.map { |t| Integer t rescue t }.each_with_object([]) { |t, o| o << (t[1] ? t : o.pop(2).reduce(t)) }
[04:07:38] ruboto: Thomas-0725 # => String can't be coerced into Fixnum (TypeError) ...check link for more (https://eval.in/397291)
[04:07:51] Thomas-0725: Ah, ok. So just bad class choice
[04:08:01] Ox0dea: No, it's a method.
[04:08:04] sphex: Ox0dea: hey.. are you working on somekind of parser?
[04:08:35] Ox0dea: sphex: It's charitable to call it a "parser", but I'm working on converting any Ruby code to a non-alphanumeric "equivalent". :)
[04:09:02] pwnz0r: has joined #ruby
[04:09:42] Thomas-0725: OK, well thank you both for the input. I'm sure I'll be pestering often over the next few weeks.
[04:09:45] sphex: haha.. whoa..
[04:09:47] fabrice31: has joined #ruby
[04:10:13] davedev24: has joined #ruby
[04:11:11] Ox0dea: sphex: It was technically possible to write any conceivable program using non-alphanumerics, but Mon_Ouie showed me how to invoke #send, so now it's possible to write real, heavy-duty Ruby with no numbers or letters.
[04:11:18] Ox0dea: I figured I'd try to automate that process for giggles.
[04:14:14] Ox0dea: bnagy: rb_class_new_instance() calls rb_obj_call_init(), which (after jumping through quite a few hoops) calls vm_call0_body(), which does lots of checks, but none for visibility.
[04:15:03] sphex: Ox0dea: wow. man.. I don't even want to think about it. :p
[04:15:43] Ox0dea: sphex: It's actually kinda fun.
[04:15:56] Ox0dea: In an admittedly warped sort of way.
[04:17:13] xkickfl-1: has joined #ruby
[04:17:15] xkickfl-1: has left #ruby: ()
[04:17:44] xkickflip_: has joined #ruby
[04:19:18] bnagy: Ox0dea: hm.. I guess in theory initialize is actually always private
[04:19:26] bnagy: it just freaks me out to see it declared as such
[04:19:59] sphex: Ox0dea: I've been working on a ruby parser too. mostly to practice metaprogramming. I made a small DSL to help with operator precedence parsing... which I think works correctly. but there's a lot of stuff missing. I may be able to get it complete-ish in a few days.
[04:20:23] zacstewart: has joined #ruby
[04:20:42] shock_one: has joined #ruby
[04:24:51] Ox0dea: >> Class.new { public def initialize; end }.public_methods.include?(:initialize)
[04:24:52] ruboto: Ox0dea # => false (https://eval.in/397309)
[04:24:58] Ox0dea: bnagy: In practice, as well. I wonder what that's about.
[04:25:11] davedev24: has joined #ruby
[04:25:21] bnagy: cause you're supposed to call new
[04:25:39] Ox0dea: sphex: I trust you're not cheating by looking into how seattlerb and/or Rubinius are doing it?
[04:25:56] s2013: has joined #ruby
[04:26:24] sphex: I was going to try to make a small "meta-circular interpreter" after to see if I can get the class semantics right, but looks like this is going to be way too hard. I guess I would have to override *all* the introspection features of Object for the objects that get into the interpreter...
[04:26:29] tmtwd: has joined #ruby
[04:27:01] sphex: Ox0dea: no. mine is a pure recursive-descent "pratt" parser. will prolly be no more than 2000 lines of code when finished.
[04:27:04] ght: Question: if I want to halt execution but I want it to return a normal exit code, which I believe is 0, what should I use?
[04:27:14] ght: Normally I use abort but I believe that's an exit code 1, indicating error
[04:27:23] verto: has joined #ruby
[04:28:09] Ox0dea: ~ $ ruby -e 'exit 42'
[04:28:12] Ox0dea: ~ $ echo $?
[04:28:19] Antiarc: re: private initialize, you'd do that for a singleton class
[04:28:34] ght: Thank you 0x0dea. My question is, this SO article: http://stackoverflow.com/questions/4432506/stop-execution-of-ruby-script
[04:28:41] ght: Isn't clear as to whether or not exit exits cleanly.
[04:28:56] Ox0dea: Antiarc: It's just been demonstrated that privatizing #initialize is redundant.
[04:29:00] ght: Saying it raises a "SystemExit" exception, does exit also return a normal 0 error code?
[04:29:03] ght: I mean, exit code.
[04:29:11] ght: Like in bash, if I want to indicate an error, I exit 1
[04:29:13] Antiarc: Ox0dea: I'm gonna have to go look at how the singleton mixin does it!
[04:29:18] ght: If I simply call exit, that will exit cleanly?
[04:29:30] Antiarc: Oh, singleton undef's intialize, IIRC
[04:29:35] Ox0dea: ght: Do you not have a Ruby interpreter close at hand?
[04:29:44] ght: I'm surrounded by terminals, yes.
[04:29:45] d0lph1n98: has joined #ruby
[04:29:52] ght: How would I confirm whether or not a 0 exit code is returned?
[04:29:58] ght: In irb?
[04:29:59] Ox0dea: ght: I demonstrated that above.
[04:30:08] Ox0dea: Don't use irb for something like this.
[04:30:13] ght: Ahh, I see, so specify the number after exit.
[04:30:18] ght: Got it.
[04:30:22] ght: Thank you sir, appreciated.
[04:30:23] Ox0dea: Right, and print $? at the shell to check the value.
[04:30:26] Ox0dea: Happy to help.
[04:30:57] Spami: has joined #ruby
[04:31:31] arooni-mobile__: has joined #ruby
[04:31:31] arooni-mobile: has joined #ruby
[04:32:36] Ox0dea: >> Class.new.singleton_class.methods.include?(:initialize)
[04:32:37] ruboto: Ox0dea # => false (https://eval.in/397322)
[04:32:52] i8igmac: has joined #ruby
[04:32:59] Antiarc: I was wrong, Singleton changes the visibility on new, not initialize
[04:33:57] Ox0dea: I wonder what's going on that sclass.send(:initialize) raises a TypeError rather than a NoMethodError.
[04:34:48] charliesome: has joined #ruby
[04:35:31] saadq: has joined #ruby
[04:35:50] peter_paule: has joined #ruby
[04:35:55] devbug: has joined #ruby
[04:37:04] brianpWins: has joined #ruby
[04:37:50] al2o3-cr: has joined #ruby
[04:40:04] bruno-: has joined #ruby
[04:46:23] havenwood: has joined #ruby
[04:48:30] fullofcaffeine: has joined #ruby
[04:49:45] djbkd: has joined #ruby
[04:50:11] balazs: has joined #ruby
[04:50:29] balazs: has joined #ruby
[04:53:01] luriv_: has joined #ruby
[04:55:46] Oog: has joined #ruby
[04:55:47] jamesaxl: has joined #ruby
[04:55:58] surs3: has joined #ruby
[04:56:24] Gnubie_: has joined #ruby
[04:59:11] roolo: has joined #ruby
[05:00:01] allomov: has joined #ruby
[05:00:17] Dwarf: has joined #ruby
[05:01:02] simplyianm: has joined #ruby
[05:01:16] Scroff: has joined #ruby
[05:02:26] zack6849: has joined #ruby
[05:02:26] zack6849: has joined #ruby
[05:04:35] simplyianm: has joined #ruby
[05:06:12] haraoka: has joined #ruby
[05:06:30] riotjones: has joined #ruby
[05:07:14] simplyia_: has joined #ruby
[05:08:38] nahtnam: has joined #ruby
[05:11:04] sharpmachine: has joined #ruby
[05:12:57] Brainling: has joined #ruby
[05:15:22] michaeldeol: has joined #ruby
[05:16:04] dhjondoh: has joined #ruby
[05:17:33] zacstewart: has joined #ruby
[05:17:54] shock_one: has joined #ruby
[05:20:37] bashusr: has joined #ruby
[05:24:58] aryaching: has joined #ruby
[05:29:50] DoubleMalt: has joined #ruby
[05:30:08] fumihiro: has joined #ruby
[05:31:54] aganov: has joined #ruby
[05:31:58] revath: has joined #ruby
[05:32:07] chrissonar: has joined #ruby
[05:34:02] lampd1: has joined #ruby
[05:34:13] Oog: has joined #ruby
[05:34:34] Oog: i have decimal numbers with 3 decimal places - how can i cut the last one off without rounding?
[05:35:35] Oog: i guess (x * 100).to_i / 100 - ?
[05:35:52] GitGud: has joined #ruby
[05:35:53] Radar: example input + output plz
[05:35:59] sevenseacat: what Radar said
[05:36:11] mleung: has joined #ruby
[05:36:23] Oog: input 3.5999 i want 3.59
[05:37:05] Radar: why without rounding?
[05:37:09] lampd1: has joined #ruby
[05:37:48] Radar: >> require 'bigdecimal'; BigDecimal.new("3.5999").round(2, BigDecimal::ROUND_FLOOR).to_f
[05:37:49] ruboto: Radar # => 3.59 (https://eval.in/397394)
[05:38:02] Radar: Maybe you don't want the kind of rounding that you found firsdt?
[05:38:12] sevenseacat: or just round(2)
[05:38:21] Oog: good question - its like gas prices 3.599 - i actually dont knwo if gas stations round or not
[05:38:32] sevenseacat: i dont know why you would ever want 3.59 from 3.59999999
[05:38:35] Aeyrix: They round up.
[05:38:48] Oog: yeah i guess ill round up lol
[05:38:54] Aeyrix: >> "%3.3f" % 3.14159265358
[05:38:55] ruboto: Aeyrix # => "3.142" (https://eval.in/397395)
[05:39:07] sevenseacat: http://ruby-doc.org/core-2.2.0/Float.html#method-i-round
[05:39:30] GriffinHeart: has joined #ruby
[05:39:47] tagrudev: has joined #ruby
[05:42:28] xkickflip: has joined #ruby
[05:43:03] astrobun_: has joined #ruby
[05:44:23] Oog: all good with rounding thanks
[05:45:09] surs4: has joined #ruby
[05:45:37] yardenbar: has joined #ruby
[05:45:51] jesterfraud: good to see we're all helpful round here
[05:46:24] sevenseacat: ACTION pokes sarcasm detector
[05:46:29] revath: has joined #ruby
[05:46:41] sevenseacat: not sure if faulty
[05:47:15] jesterfraud: less sarcastic, more fun
[05:50:19] timonv: has joined #ruby
[05:50:32] djbkd: has joined #ruby
[05:51:28] shock_one: has joined #ruby
[05:54:06] howdoi: has joined #ruby
[05:54:47] jpfuentes2: has joined #ruby
[05:55:41] eggoez: has joined #ruby
[05:56:27] revath: has joined #ruby
[05:57:53] MarkTurner: has joined #ruby
[05:58:24] MarkTurner: has joined #ruby
[05:59:33] slucx: has joined #ruby
[06:01:37] araujo: has joined #ruby
[06:01:37] araujo: has joined #ruby
[06:01:45] KrzaQ: has joined #ruby
[06:03:40] Scroff: has joined #ruby
[06:04:10] zacstewart: has joined #ruby
[06:04:38] krz: has joined #ruby
[06:06:43] theery: has joined #ruby
[06:06:49] djbkd: has joined #ruby
[06:07:35] codecop: has joined #ruby
[06:07:58] bluOxigen: has joined #ruby
[06:09:40] dopieee: has joined #ruby
[06:10:39] fabrice31: has joined #ruby
[06:12:01] Oog: has joined #ruby
[06:12:24] Stan: has joined #ruby
[06:12:49] olistik: has joined #ruby
[06:14:26] atomi: has joined #ruby
[06:15:40] yh: has joined #ruby
[06:21:03] leat: has joined #ruby
[06:22:00] revath: has joined #ruby
[06:22:51] revath: has left #ruby: ()
[06:22:52] ndrei: has joined #ruby
[06:23:07] leat: can anyone help with oop? (:
[06:24:07] aryaching: has joined #ruby
[06:24:18] leat: okay, here is the question: how do you access core classes from a subclass? is it passible at all?
[06:24:35] skade: has joined #ruby
[06:24:40] certainty: what is a core class?
[06:24:45] certainty: a class of ruby core?
[06:24:53] leat: yeah, yeah
[06:25:06] _blizzy_: has joined #ruby
[06:25:11] certainty: what does access mean?
[06:25:27] leat: e.g. I'm trying to use File.exist inside a class and I get the nil error
[06:25:58] certainty: ok, so generally this is not a problem so you must be doing something weired. Show us the code please
[06:27:35] msgodf: has joined #ruby
[06:29:53] leat: something like this https://bpaste.net/show/104e69c7dd88
[06:29:59] riotjones: has joined #ruby
[06:30:20] leat: I see I'm doing something wrong
[06:30:32] leat: but how do I do it right?
[06:30:38] certainty: leat: alright, you have to make clear that you mean the ruby's file class. ::File.exist?
[06:30:42] surs1: has joined #ruby
[06:31:19] certainty: the problem is that the scope you're looking up the File constant has a different one from the core, but they share the name
[06:31:23] fumihiro: has joined #ruby
[06:31:41] certainty: hmm that was not helping i guess. Can someone please rephrase this xD
[06:33:07] leat: aw, it works now
[06:33:18] Gadgetoid: has joined #ruby
[06:33:18] pwnz0r: has joined #ruby
[06:33:19] leat: where can I read up on this ::?
[06:33:46] certainty: in the pickaxe for example.
[06:33:52] certainty: That's the scope operator
[06:34:19] nofxx: leat, module A; module B == A::B
[06:34:44] nofxx: B is inside A... that error you had you fixed with ::File ?
[06:34:56] hinbody: has joined #ruby
[06:36:30] fumihiro: has joined #ruby
[06:36:36] leat: thanks everyone who helped! (:
[06:37:09] Soda: has joined #ruby
[06:37:19] toretore: ::File just means you mean the File constant in the top-level scope
[06:37:42] toretore: otherwise, if you have another File constant in a closer scope, it will use that
[06:37:47] abuzze: has joined #ruby
[06:37:51] rht: has joined #ruby
[06:40:41] skade: has joined #ruby
[06:41:44] ryez: has joined #ruby
[06:43:37] Oog: has joined #ruby
[06:44:13] Pupeno: has joined #ruby
[06:44:33] surs1: has joined #ruby
[06:45:11] Emaker: has joined #ruby
[06:45:30] skade: has joined #ruby
[06:45:33] Pupeno_: has joined #ruby
[06:45:41] abuzze: has joined #ruby
[06:46:05] PaulCapestany: has joined #ruby
[06:46:48] aryaching: has joined #ruby
[06:47:29] fullofcaffeine: has joined #ruby
[06:48:09] GriffinHeart: has joined #ruby
[06:50:35] Musashi007: has joined #ruby
[06:50:37] njection: has joined #ruby
[06:51:21] djbkd_: has joined #ruby
[06:53:17] khebbie: has joined #ruby
[06:53:47] surs1: has joined #ruby
[06:57:17] skade: has joined #ruby
[06:57:52] baweaver_: has joined #ruby
[06:58:26] dgutierrez1287: has joined #ruby
[06:58:29] lxsameer: has joined #ruby
[06:58:29] lxsameer: has joined #ruby
[06:59:38] bosma: has joined #ruby
[07:00:23] wprice: has joined #ruby
[07:00:58] zacstewart: has joined #ruby
[07:01:21] gagrio: has joined #ruby
[07:02:28] arquebus: has joined #ruby
[07:03:04] eGGsha: has joined #ruby
[07:03:33] fullofcaffeine: has joined #ruby
[07:07:54] dumdedum: has joined #ruby
[07:08:53] Scripore: has joined #ruby
[07:09:16] MarkTurner: has joined #ruby
[07:12:45] arup_r: has joined #ruby
[07:12:50] Scroff: has joined #ruby
[07:14:35] MarkTurner: has joined #ruby
[07:15:44] niemcu: has joined #ruby
[07:15:49] fumihiro: has joined #ruby
[07:16:47] djbkd_: has joined #ruby
[07:18:26] khebbie_: has joined #ruby
[07:20:30] alphaatom: has joined #ruby
[07:20:54] keen__________17: has joined #ruby
[07:21:03] dfockler: has joined #ruby
[07:21:43] MarkTurner: has joined #ruby
[07:24:56] ruby-lang166: has joined #ruby
[07:25:04] foooobear: has joined #ruby
[07:25:15] ruby-lang166: has left #ruby: ()
[07:25:51] astrobun_: has joined #ruby
[07:26:49] Scroff: has joined #ruby
[07:33:29] revath: has joined #ruby
[07:34:13] haxrbyte: has joined #ruby
[07:34:59] revath: has joined #ruby
[07:35:18] MarkTurner: has joined #ruby
[07:38:03] allcentury: has joined #ruby
[07:38:11] Musashi007: has joined #ruby
[07:38:11] burgestrand: has joined #ruby
[07:39:38] RegulationD: has joined #ruby
[07:40:38] solars: has joined #ruby
[07:41:13] tesuji: has joined #ruby
[07:41:39] bruno-: has joined #ruby
[07:42:22] lotherk: has joined #ruby
[07:42:47] saadq: Is it seen as bad practice to explicitly declare `return` statements in Ruby?
[07:43:35] sevenseacat: if they're un-necessary, then yeah
[07:43:41] Timba-as: has joined #ruby
[07:43:59] aspiers: has joined #ruby
[07:44:27] apeiros: saadq: it's not bad practice but bad style
[07:44:46] apeiros: or disliked style
[07:44:54] saadq: Alright, I was just reading this post: http://stackoverflow.com/questions/1023146/is-it-good-style-to-explicitly-return-in-ruby
[07:45:00] lotherk: has joined #ruby
[07:45:08] saadq: I kind of liked what the first answer was talking about, but I don't really want to go against standard conventions in style
[07:45:26] apeiros: and when you have to use a return statement, then you've got an indicator for spaghetti
[07:45:27] sevenseacat: ACTION downvotes top answer
[07:45:31] GriffinHeart: has joined #ruby
[07:46:43] apeiros: ACTION too
[07:46:50] apeiros: you don't write code for people who don't know the language.
[07:46:56] apeiros: that's silly and no other language does it either.
[07:47:08] otzeloot: has joined #ruby
[07:47:13] otzeloot: has left #ruby: ()
[07:47:19] jimmythe1at: has joined #ruby
[07:47:29] apeiros: "let's not use >@> in haskell! it's not obvious to people who don't know haskell!"
[07:47:50] sevenseacat: (is that actually a haskell thing?)
[07:48:06] heftig: foo = (hash[bar] ||= baz)
[07:48:28] heftig: i surprisingly often forget [] ||= is possible
[07:48:54] apeiros: sevenseacat: yupp
[07:49:57] sevenseacat: but yeah, ruby has perhaps the strongest style conventions out of any language I've worked with - is silly to flaunt those for the fun of it
[07:50:04] apeiros: ACTION added a comment
[07:50:06] pontiki: two clients ago, their style *required* returns
[07:50:16] apeiros: pontiki: that's fine
[07:50:41] apeiros: *if* there is a styleguide, follow it. doesn't matter if it collides with your personal preferences. consistent style trumps personal preference.
[07:50:48] yh: has joined #ruby
[07:50:56] pontiki: in every case
[07:51:05] apeiros: weeeeeelll???
[07:51:16] pontiki: well, they sign the checks
[07:51:29] apeiros: nah, when I can, I'll convince people of my style preferences
[07:51:32] jenrzzz: has joined #ruby
[07:51:36] apeiros: but if I fail, I go with the project's style
[07:51:48] pontiki: i did get them to give up on enforcing single quotes
[07:51:56] blackmes1: has joined #ruby
[07:52:34] zacstewart: has joined #ruby
[07:52:35] Pupeno: has joined #ruby
[07:52:35] Pupeno: has joined #ruby
[07:52:42] apeiros: ACTION uses heredocs for all string literals
[07:52:56] maloik: I quite like single quotes
[07:53:11] maloik: it shows the intention of the string right away
[07:53:23] sevenseacat: i always use double quotes, because I find no-one else is consistent with them so I don't really care about following convention
[07:53:34] apeiros: I stopped using single quotes and use either " or %{}
[07:53:39] pontiki: i quite like using translation tokens.
[07:53:55] pontiki: they show the purpose of the string
[07:54:05] apeiros: what's a translation token?
[07:54:13] sevenseacat: its completely common in every codebase I've ever seen to use single quotes on one line and double quotes on the next, for no reason
[07:54:30] arturaz: has joined #ruby
[07:54:34] pontiki: generally symbol, or a string of dotted words
[07:54:47] apeiros: require "foo"; require 'bar' # yepp, to my shame, seen in my own code
[07:55:14] white_bear: has joined #ruby
[07:56:02] pontiki: TAM: when you're shoulder surfing over the lead dev's shoulder and they're trying to figure out why '#{var} ..' isn't working
[07:56:38] Hounddog: has joined #ruby
[07:56:46] ljarvis: "lead dev"
[07:56:53] apeiros: urban dict says: "Tam: extremely hot chick who is an animal in the sack and gives you a throbbing cock"
[07:57:00] apeiros: I'm now very confused as to what you said???
[07:57:03] maloik: I've found the same thing
[07:57:09] pontiki: that awkward moment
[07:57:09] maloik: looked it up as well
[07:57:24] jackjackdripper: has joined #ruby
[07:57:27] pontiki: now i am super embarassed
[07:57:32] vali: has joined #ruby
[07:57:38] pontiki: and i may now be pretty pissed off, too
[07:57:45] maloik: blame urban dictionary though
[07:57:53] maloik: that thing goes for the filthiest explanations first
[07:58:04] apeiros: so what does TAM mean?
[07:58:10] maloik: 13.09:57:08 < pontiki> that awkward moment
[07:58:19] sevenseacat: apeiros: thats the last thing I expected from you >_>
[07:58:43] apeiros: sevenseacat: that I didn't know TAM or that I use urban dict?
[07:59:03] vali: I'm trying to deploy some dnssec monitoring using the following plugin (https://github.com/opendnssec/dnssec-monitor). The problem is that I'm getting the following error -> (nagios_dnssec.rb:101:in `process_log': undefined method `each' for #<String:0x00000001b54bf8> (NoMethodError))
[07:59:08] sevenseacat: ACTION is sitting here giggling
[07:59:18] vali: using ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
[07:59:24] apeiros: UD is relatively good at slang. for technical acronyms I use acronymfinder.com
[07:59:27] maloik: ?code vali
[07:59:27] ruboto: vali, We can't help you without your code, please post it to https://gist.github.com
[07:59:38] apeiros: but maloik is right. UD goes for the filthies explanation first :-/
[08:00:27] apeiros: pontiki: how does somebody become lead dev if they don't even know that? o0
[08:00:50] apeiros: I can understand lead architect (still bad??? at least if they don't at least code in a similar language), but lead dev?
[08:01:00] vali: maloik: it seems that the problem is related to ruby2.1, the code works ok on ruby1.8
[08:01:00] maloik: maybe they know why, but just didn't spot it right away
[08:01:12] apeiros: vali: 1.8 had String#each
[08:01:22] apeiros: vali: 1.9+ no longer does. use String#each_line
[08:01:27] Oog: has joined #ruby
[08:01:33] vali: apeiros: aaa, ok
[08:01:36] apeiros: (since that's what String#each in 1.8 did)
[08:01:46] vali: so, could I replace the method by some chance and work ?
[08:02:10] apeiros: I don't understand what you mean "by some chance"
[08:02:11] ndrei: has joined #ruby
[08:02:28] apeiros: you can just replace .each with .each_line, if the receiver is always a string. no chance involved.
[08:02:32] vali: If try to use the new method is it going to work ?
[08:02:38] pontiki: apeiros: it's not that they didn't know it
[08:02:41] vali: than it should be ok
[08:02:53] aspiers: has joined #ruby
[08:02:56] vali: I'm going to try it in a min
[08:02:56] apeiros: pontiki: they didn't spot it?
[08:03:05] pontiki: apeiros: more that, yeah
[08:03:07] apeiros: ah well???
[08:03:24] apeiros: ACTION wonders what embarrassing mistakes he made during his lifetime
[08:03:24] pontiki: apeiros: but the awkward moment, do i point it out? in front of a room of devs?
[08:03:37] apeiros: pontiki: learn sign language
[08:04:00] adaedra: that can be useful
[08:04:04] eGGsha: has joined #ruby
[08:04:07] pontiki: i did finally lean in and say 'single quotes don't interpo..' "OH SHIT"
[08:04:21] pontiki: only if there's a recipient
[08:04:44] apeiros: poking is universally understood :)
[08:05:03] pontiki: i am not a physical person
[08:05:08] pontiki: you poke me i might scream
[08:05:27] apeiros: then just phrase it well
[08:05:39] adaedra: ACTION pokes pontiki
[08:05:39] apeiros: "oh, somebody used a single quote there, should be a double quote"
[08:05:40] pontiki: i thought i did
[08:05:56] Oog: has joined #ruby
[08:06:11] apeiros: (probably still badly phrased - it's monday morning???)
[08:06:16] apeiros: and I think I should start to work :D
[08:06:37] allomov: has joined #ruby
[08:06:48] vali: apeiros: https://github.com/opendnssec/dnssec-monitor/blob/master/lib/nagios_dnssec.rb, replace each with each_line and it'S complaining that it cannot find method each_line.
[08:06:59] bigkevmcd: has joined #ruby
[08:07:18] konsolebox: has joined #ruby
[08:07:48] maloik: did you correctly go back to 2.1?
[08:07:50] olistik: has joined #ruby
[08:08:00] zenspider: vali: what is complaining? does it say the type or inspect it?
[08:08:04] apeiros: vali: "it'S complaining that it cannot find method each_line" is not useful
[08:08:10] apeiros: vali: gist the precise exception you get.
[08:08:49] acke: has joined #ruby
[08:08:50] zenspider: output is an array
[08:08:55] zenspider: https://github.com/opendnssec/dnssec-monitor/blob/master/lib/nagios_dnssec.rb#L182
[08:09:09] vali: zenspider: true
[08:09:22] apeiros: vali: 10:02 apeiros: you can just replace .each with .each_line, ****if the receiver is always a string*****. no chance involved.
[08:09:26] apeiros: emphasis added
[08:09:43] anisha: has joined #ruby
[08:09:53] vali: ok, how can I make this work with rb2.1?
[08:10:06] vali: I don't want to downgrade just to use this script
[08:10:25] apeiros: did you just blindly replace all .each'es with .each_line?
[08:10:32] matp: has joined #ruby
[08:10:37] vali: yep, the noob way
[08:10:38] apeiros: because that seriously makes no sense and is totally not what I suggested.
[08:10:46] vali: but I see I can do only the process_log
[08:10:48] apeiros: ACTION sobs
[08:10:58] vali: and that should be a string all the time
[08:11:05] zenspider: there's only 2 each calls in that file
[08:11:07] apeiros: how you can make it work: read the code. understand where you'll have a string and call .each on it.
[08:11:09] zenspider: only one is relevant
[08:11:13] apeiros: replace *ONLY THOSE PLACES* with .each_line
[08:11:16] zenspider: and ONLY if it is always a string, which it isn't
[08:11:24] fabrice31: has joined #ruby
[08:11:29] zenspider: so make it ALWAYS be an array
[08:11:36] zenspider: do something like: output = output.lines if output.is_a? String
[08:11:41] zenspider: (array or enumerable)
[08:12:06] marr: has joined #ruby
[08:12:18] apeiros: ACTION prefers to put the onus to normalize on the caller
[08:13:09] vali: zenspider: thank you for the hints, I'll assign some brain power to it. :)
[08:13:19] zenspider: thinking always helps. :P
[08:13:31] lessless: has joined #ruby
[08:15:04] noname1: has joined #ruby
[08:15:10] vali: apeiros: thank you also for the help :)
[08:16:43] LMity: has joined #ruby
[08:19:24] blackmesa: has joined #ruby
[08:20:28] Musashi007: has joined #ruby
[08:20:46] astrobun_: has joined #ruby
[08:21:39] _blizzy_: has joined #ruby
[08:21:47] Oog: has joined #ruby
[08:22:37] TheHodge: has joined #ruby
[08:23:21] chinmay_dd: has joined #ruby
[08:23:33] khebbie: has joined #ruby
[08:25:47] Igorshp: has joined #ruby
[08:25:56] Stratege_: can someone recommend a good tutorial for ruby? Or something of the like?
[08:26:48] apeiros: Stratege: http://ruby-community.com/pages/links
[08:26:52] bayed: has joined #ruby
[08:26:53] apeiros: should probably add codeacademy
[08:27:09] Zai00: has joined #ruby
[08:27:48] apeiros: Stratege: http://www.codecademy.com/tracks/ruby
[08:28:14] rdark: has joined #ruby
[08:29:35] revath: has joined #ruby
[08:29:43] _blizzy_: has joined #ruby
[08:32:56] Oog: has joined #ruby
[08:33:44] yardenbar: has joined #ruby
[08:33:57] Oog: has joined #ruby
[08:33:58] kjs3: has joined #ruby
[08:35:09] yfeldblum: has joined #ruby
[08:36:03] revath1: has joined #ruby
[08:36:50] Stratege: apeiros thanks
[08:39:36] haxrbyte_: has joined #ruby
[08:40:01] adaedra: apeiros: do a PR
[08:40:17] apeiros: adaedra: I already added it
[08:41:56] adaedra: how did you do this reverse p
[08:42:02] lapide_viridi: has joined #ruby
[08:42:52] einarj: has joined #ruby
[08:43:17] maloik: Anyone here have some recommendations for api design documents/guidelines etc? Preferably
[08:43:20] apeiros: MIRROR_HORIZONTALLY_CHARACTER
[08:43:29] maloik: Preferably no books (for now, due to lack of time)
[08:43:45] maloik: I've found https://github.com/interagent/http-api-design which has been helpful so far
[08:43:58] apeiros: maloik: API as in JSON/REST API?
[08:44:14] apeiros: check steveklabnik's work
[08:44:24] apeiros: should be full of stuff wrt JSON/REST
[08:44:36] maloik: yes! I forgot about that
[08:46:22] platzhirsch: has joined #ruby
[08:46:49] zacstewart: has joined #ruby
[08:47:10] sebbers_: has joined #ruby
[08:47:24] Soda: has joined #ruby
[08:47:31] matcouto: has joined #ruby
[08:47:33] Feyn: has joined #ruby
[08:49:02] sebbers_: Can someone offer me advice on whether I should use Interfaces for this challenge or not? https://gist.github.com/anonymous/03ab2950cbbe9db17d70
[08:49:32] ljarvis: sebbers_: wrong channel
[08:51:15] dseitz: has joined #ruby
[08:52:01] arturmartins: has joined #ruby
[08:52:10] joonty: has joined #ruby
[08:52:10] SylarRuby: has joined #ruby
[08:52:12] shock_one: has joined #ruby
[08:54:26] mercwithamouth: has joined #ruby
[08:54:54] flughafen: moin shevy certainty
[08:54:59] auzty: has joined #ruby
[08:56:26] jottr: has joined #ruby
[08:57:16] tomphp: has joined #ruby
[08:57:52] apeiros: I would use an AbstractInterfaceFactory
[08:58:18] ljarvis: dont get that confused with an AbstractInterfaceFactoryBean
[08:58:39] Igorshp: has joined #ruby
[08:59:34] baweaver: has joined #ruby
[09:01:06] [k-: has joined #ruby
[09:01:09] platzhirsch: has joined #ruby
[09:01:36] platzhirsch: has left #ruby: ()
[09:01:38] [k-: Ox0dea existence confirmed
[09:02:11] quimrstorres: has joined #ruby
[09:03:54] revath1: has left #ruby: ()
[09:04:45] edwinvdgraaf: has joined #ruby
[09:05:20] TheBrayn: what's the standard way of reading a file if it exists? should I check with File.exist? and then read it or try to read it and then catch an exception?
[09:05:53] adaedra: check first
[09:05:57] [k-: if you want to be really sure, both ways
[09:07:00] quimrstorres: has joined #ruby
[09:07:10] ljarvis: I would just try to read it, unless there's some other logic you'd need if the file did or did not exist (i.e create it)
[09:07:35] [k-: that is for critical apps, where errors are death
[09:07:54] [k-: but you wouldn't be writing critical apps in Ruby
[09:08:27] [k-: as in doing both
[09:08:41] ljarvis: why wouldn't you write critical apps in Ruby?
[09:08:57] yorickpeterse: Yeah, you should be using Node.js for that
[09:08:58] maloik: it's not webscale
[09:10:04] maloik: before you turn this into a serious discussion, I was trolling :-) sorry
[09:10:10] adaedra: If /dev/null is webscale, I will use it
[09:10:23] Scrofff: has joined #ruby
[09:10:50] serivich: has joined #ruby
[09:10:56] ljarvis: you just need to fork the shards
[09:11:11] olistik: has joined #ruby
[09:12:00] Brainling: has joined #ruby
[09:12:50] startupality: has joined #ruby
[09:13:37] yorickpeterse: That makes no sense
[09:13:46] yorickpeterse: You're not supposed to fork, you're supposed to be running a cluster from the start
[09:14:03] ljarvis: but if you forked the cluster you would have more shards
[09:14:07] maloik: that's premature scaling, you're not doing lean startup right
[09:14:10] adaedra: > webscale
[09:14:12] sepp2k: has joined #ruby
[09:14:28] ljarvis: needs more agile
[09:14:42] Igorshp: has joined #ruby
[09:15:16] yorickpeterse: I hear the terms "agile" and "lean" pretty much on a weekly basis here at the office
[09:15:24] yorickpeterse: "We have to do things the lean and agile way"
[09:15:48] yorickpeterse: Unless it actually involves people doing backflips and what not it's not agile
[09:15:51] ljarvis: everyone in my office would lol all over the place if I said something like that
[09:16:53] yorickpeterse: did they not jump aboard the agile hype train?
[09:17:47] xkickflip: has joined #ruby
[09:17:49] adaedra: yorickpeterse: you need to invent a new buzzword and try to make them use it
[09:18:27] arup_r: has joined #ruby
[09:18:47] [k-: the Big O Scalation
[09:18:57] yorickpeterse: It has a scaling factor of P(Y)
[09:19:01] yorickpeterse: might be better
[09:19:18] ljarvis: but is the app supersynchronous?
[09:19:19] maloik: why peter? (my mind immediately jumped to family guy)
[09:19:34] maloik: ignore me
[09:19:43] ljarvis: ACTION hands maloik some coffee
[09:19:46] adaedra: it's okay, it's monday
[09:20:02] maloik: there's so many letters in his name, I never make it past "yor"
[09:20:07] yorickpeterse: and my spin on agile would be Yagile
[09:20:26] maloik: it's been a long weekend
[09:20:32] yorickpeterse: you're just getting old
[09:20:44] lkba: has joined #ruby
[09:20:56] maloik: well sure, but I'm also fitter than I have ever been :D
[09:21:06] ljarvis: you'll gain a few more years after arrrcamp too
[09:21:16] adaedra: tbh, I read it with the e and r switched, yorickpetrese
[09:21:26] maloik: actually, I think I may take a break from organizing
[09:21:39] maloik: and I have a feeling the others might too
[09:21:59] [k-: yorickpeter-erse
[09:22:01] yorickpeterse: adaedra: that sounds incredibly feminine
[09:22:04] ljarvis: you going to brighton, maloik?
[09:22:06] xkickflip: has joined #ruby
[09:22:26] maloik: nah, tomorrow is my last day at work, holiday time
[09:22:59] CloCkWeRX: has joined #ruby
[09:23:01] CloCkWeRX: has left #ruby: ()
[09:23:12] maloik: I think my only conf until the end of the year may be rocketconf in amsterdam
[09:24:40] yorickpeterse: man these conf names
[09:24:47] maloik: I know right
[09:24:54] maloik: they do have an astronaut in the lineup though
[09:25:01] maloik: so it's acceptable
[09:25:05] yorickpeterse: also why are all these conferences in November
[09:25:23] ljarvis: this year i will have gone to zero confs :/
[09:25:24] dgutierrez1287: has joined #ruby
[09:25:33] yorickpeterse: wait, they have Kuipers?
[09:25:35] maloik: it's not too late to get an arrrrrcamp ticket :D
[09:25:39] yorickpeterse: That's both really cool and really out of places
[09:25:39] ljarvis: actually i went to a Google thing but it doesn't count
[09:25:43] adaedra: ljarvis: to zeroconf?
[09:25:51] maloik: I'll get you an early bird if you want
[09:25:54] ljarvis: maloik: yeah I can't really afford it with the house purchase :(
[09:26:14] yorickpeterse: you bought a house?
[09:26:20] yorickpeterse: So lets see the checklist:
[09:26:23] yorickpeterse: [x] got married
[09:26:29] ljarvis: no no, got engaged
[09:26:33] ljarvis: still not married yet
[09:26:36] yorickpeterse: well close enough
[09:26:41] ljarvis: that's next year prolly
[09:26:43] yorickpeterse: might as well buy a motor bike while you still can
[09:26:57] adaedra: [ ] eat the dog
[09:27:02] eGGsha: has joined #ruby
[09:27:26] adaedra: [ ] eat the kid
[09:27:38] ljarvis: why am i eating everything
[09:27:46] yorickpeterse: not sure if baby fat is tasty
[09:27:51] adaedra: because you're hungry
[09:28:14] RegulationD: has joined #ruby
[09:29:21] yorickpeterse: shit that reminds me, I still need to submit a talk to RubyConf
[09:29:41] yorickpeterse: Yorick On Tour 2015
[09:29:52] adaedra: Tour de Ruby
[09:30:20] tomphp: has joined #ruby
[09:31:02] yorickpeterse: "Gender Identity"
[09:31:08] yorickpeterse: oooh I'm so filling that in with Airplane
[09:31:23] yorickpeterse: "Ethnicity" hmmm
[09:31:37] yorickpeterse: I'll go with "White and sexy"
[09:31:42] yorickpeterse: How to not get accepted
[09:31:45] yorickpeterse: in 2 easy steps
[09:32:06] bodgix_wrk: has joined #ruby
[09:33:15] haneen: has joined #ruby
[09:33:51] tomphp: has joined #ruby
[09:33:51] krz: has joined #ruby
[09:35:27] apeiros: yorickpeterse: isn't the answer to all those questions "Oga"?
[09:35:49] maloik: ljarvis: loco2 can't sponsor? :(
[09:36:19] ljarvis: maloik: I've used my conf budget (I think, I need to check)
[09:36:55] maloik: but but but, you did 0 confs? :D
[09:37:09] ljarvis: maloik: it didn't reset in jan :(
[09:37:33] yorickpeterse: I too already blew my budget on FOSDEM
[09:37:34] maloik: aha gotcha
[09:37:44] yorickpeterse: so I'm just going to apply everywhere as a speaker so I can get free tickets
[09:38:34] yorickpeterse: I really want a conference that's just 1 day, single track and only puns
[09:38:41] yorickpeterse: so basically tenderlove giving all the talks
[09:38:42] maloik: your "white and sexy" line reminded me of aziz ansari
[09:38:57] maloik: the guy from Parks & Recreations (Tom Haverford), also a standup comedian
[09:39:13] maloik: started watching a show of his last night, pretty good stuff
[09:39:14] yorickpeterse: well he's not white though
[09:39:25] maloik: I know, but it's the kind of joke he'd make :D
[09:39:25] meph: has joined #ruby
[09:39:51] yorickpeterse: there's this one episode where he borrows Ron's racoon hat and tries to seduce women with it
[09:39:54] yorickpeterse: needless to say it doesn't work
[09:40:12] maloik: hahaha :D and then ron puts it on for one second and gets a compliment
[09:40:13] yorickpeterse: https://www.youtube.com/watch?v=foNxKbp9lOM here it is at 15 fps
[09:40:26] maloik: oh shit that was quick
[09:40:52] maloik: "my friend over here was digging through your trash"
[09:41:46] Oog: has joined #ruby
[09:41:59] yorickpeterse: "There's a racoon on my head, he knows how to *****"
[09:42:19] platzhirsch: has joined #ruby
[09:42:43] tmtwd: has joined #ruby
[09:43:08] leat: has joined #ruby
[09:43:41] DefV: I love him in his P&R role, but don't like his show. ALSO: #ruby-offtopici
[09:43:43] DefV: I love him in his P&R role, but don't like his show. ALSO: #ruby-offtopic
[09:43:51] DefV: wow, this doesn't work like slack does :-)
[09:44:01] withnale_: has joined #ruby
[09:44:03] bluOxigen: has joined #ruby
[09:44:15] adaedra: yeah, irc's not slack.
[09:44:32] ljarvis: i dunno, i see lots of slacking
[09:45:18] DefV: It's become a habit that I can't seem to shake
[09:45:23] DefV: write smth with typo
[09:45:27] DefV: pointer up
[09:47:09] tvw: has joined #ruby
[09:47:18] VictorBjelkholm: has joined #ruby
[09:49:22] Pathfinder: has joined #ruby
[09:49:23] txdv_: has joined #ruby
[09:56:10] Papierkorb: has joined #ruby
[09:56:22] shredding: has joined #ruby
[09:56:24] lkba_: has joined #ruby
[09:56:48] surs2: has joined #ruby
[09:57:03] Tritone: has joined #ruby
[10:00:04] zacstewart: has joined #ruby
[10:00:44] nfk: has joined #ruby
[10:01:36] eGGsha: has joined #ruby
[10:03:57] n008f4g_: has joined #ruby
[10:06:19] arup_r: As Array#compact don't remove empty string objects like "" .. I am using my own `[popular.state, popular.country].tap { |o| o.delete("") }.join(", ")` ... I am on Rails platform.. But I didn't find there also any helper.. What you guys use to do the same ?
[10:07:08] ndrei: has joined #ruby
[10:07:34] yorickpeterse: If you're using Rails you can probably do `[....].reject(&:blank?)`
[10:07:51] haxrbyte: has joined #ruby
[10:07:57] koos303: has joined #ruby
[10:08:32] serivich: has joined #ruby
[10:08:42] jhass: or .select(&:present?) for some less negation
[10:08:57] shredding: has joined #ruby
[10:08:59] beef-wellington: has joined #ruby
[10:09:01] jhass: but this really is a #RubyOnRails question
[10:09:14] haxrbyte_: has joined #ruby
[10:09:33] arup_r: jhass: humm.. But more Rubyish
[10:09:46] arup_r: nothing specific to core Rails :)
[10:10:07] arup_r: yorickpeterse: didn't recall that..
[10:10:10] xkef: has joined #ruby
[10:10:12] arup_r: thanks to both of you
[10:10:15] yorickpeterse: for Ruby itself you'd need something like `[...].reject { |x| x.nil? || x.empty? }`
[10:12:16] fabrice31: has joined #ruby
[10:12:39] Oog: has joined #ruby
[10:13:29] gregf_: arup_r: a state would always have a country :/
[10:14:50] arup_r: gregf_: yes.. from UI we have a way to make it blank also.. The requirement is only US country need state(required).. for rest optional.. and that is causing problem :)
[10:15:20] arup_r: so managing it in presentation layer
[10:15:24] yorickpeterse: Just call it province already, darn Americanos thinking it's always called a state
[10:15:58] yorickpeterse: pet peeve: apps using "ZIP code" instead of "Postal code"
[10:17:48] apeiros: ACTION guilty of using zip code instead of postal code
[10:18:44] adaedra: that maybe why swiss post is so slow, they look for the wrong kind of code.
[10:19:11] apeiros: swiss post actually corrected their postal code file upon my feedback :D
[10:19:45] jaygen: has joined #ruby
[10:19:48] PpPyg: has joined #ruby
[10:20:28] rickmasta: has joined #ruby
[10:20:35] apeiros: I'm split on it. it's cool I found the broken data and they fixed it. it's not cool that data was broken in the first place.
[10:21:39] adaedra: now, fix all the other broken things
[10:21:59] ddv: postal_code ftw
[10:22:41] neanias: apeiros: things slip through the net sometimes :P
[10:24:27] SylarRuby: has joined #ruby
[10:24:53] xkef_: has joined #ruby
[10:25:58] zacstewart: has joined #ruby
[10:26:59] knu: has joined #ruby
[10:28:20] CatMartyn: has joined #ruby
[10:29:11] Blaguvest: has joined #ruby
[10:34:18] pwnz0r: has joined #ruby
[10:34:41] joshmyers: has joined #ruby
[10:34:45] waxjar: What would be a nice interface to update a list of integers over an HTTP API? I can think two options: 1) a single endpoint that accepts some sort of delta object (POST /list?add=1,2&del=3,4) or 2) multiple endpoints for each action (POST /list/add?ids=1,2 and POST /list/del?ids=1,2). Is there a standard way to do this (or something a bit nicer perhaps)?
[10:35:04] joshmyers: hola, anyone know how to sudo using Net::SSH? SO posts don't seem to be cutting it.
[10:35:25] adaedra: waxjar: you know that there are other methods than GET and POST?
[10:35:44] waxjar: adaedra: yes, i am aware
[10:36:05] jottr: has joined #ruby
[10:36:15] waxjar: substitute POST for PATCH if you fancy ;)
[10:36:22] adaedra: Could be POST to add new, PATCH to replace all, DELETE to remove, or something like that
[10:36:46] waxjar: DELETE is meant to delete the full resource, no?
[10:37:48] adaedra: if you say so
[10:40:17] mos: has joined #ruby
[10:40:37] jhass: PACTH /list with a {"ids": {"add": [], "remove": []}} payload probably makes the most sense
[10:41:26] agent_white: has joined #ruby
[10:42:13] startupality: has joined #ruby
[10:42:44] jhass: that is if you have to save requests, of course the "true" (but inefficient) way would be POST /list with {"id": 1} (no array) and DELETE /list/1
[10:44:28] waxjar: yeah, this is not an option unfortutely, i need to be able to add/delete multiple IDs at a time :)
[10:44:58] waxjar: I'll go with the single PATCH endpoint, thx guys
[10:46:51] serivich: has joined #ruby
[10:47:53] Stratege: say I got a function foo, how would I bind that function to a variable? Given that function invocation doesn't need () I'm not seeing an easy way to do so and search engines haven't been helpful
[10:48:10] Tempesta: has joined #ruby
[10:48:40] apeiros: Stratege: a method is always defined on an object. so you'd define the method on an object and assign that object to a variable.
[10:48:53] apeiros: Stratege: alternatively you use a proc object
[10:49:01] ruby-lang709: has joined #ruby
[10:49:17] jhass: or describe your actual problem / show your code
[10:49:21] apeiros: Stratege: what are you trying to achieve? i.e. NOT your abstract goal. your concrete goal.
[10:49:26] tuor: has joined #ruby
[10:49:36] tuor: hi, i want to set a parameter to undef by default. I tried like this, but it's wrong (syntax error, unexpected keyword_undef): http://paste.debian.net/281881/
[10:49:53] apeiros: tuor: there's no undef in ruby.
[10:50:02] jhass: tuor: you'll likely want nil
[10:50:16] tuor: apeiros, ah ok.
[10:50:28] Stratege: apeiros playing the ruby warrior game, decided "fuck trying to assemble clever logic" and now I'm just trying to create an array of instructions that it should go through one by one.
[10:51:02] adaedra: you can use method to get a callable object on which you can do .call()
[10:51:12] tuor: jhass, thx
[10:51:16] Stratege: okay, cool. thanks
[10:51:34] jhass: Stratege: or just use public_send and an array of symbols & parameters
[10:51:41] apeiros: or have an array of procs
[10:51:42] adaedra: if those are just method names, you can also just save the names as symbols and use send
[10:51:57] apeiros: adaedra: s/send/public_send/
[10:52:04] adaedra: the former is more useful if your method comes from different objects
[10:52:09] apeiros: always hone the good practices ;-)
[10:52:14] Stratege: hm, public_send sounds useful.
[10:52:59] unshadow: has joined #ruby
[10:53:35] Stratege: a friend of mine just pointed out to me that in ruby methods are not values, is that really true?
[10:53:58] leat: has joined #ruby
[10:54:03] adaedra: they're not directly values as they are in some FP languages, no
[10:54:56] Stratege: is there a particular reason why they aren't?
[10:55:11] jhass: you can get an object representing one though
[10:55:19] adaedra: is there a particular reason why they should be? :)
[10:55:34] olistik: has joined #ruby
[10:56:39] Stratege: adaedra yeah, because there is no fundamental difference between them.
[10:56:54] Stratege: it's like treating a string differently than an integer, on a fundamental level.
[10:57:12] but3k4: has joined #ruby
[10:57:41] Oog: has joined #ruby
[10:58:05] surs3: has joined #ruby
[10:58:15] jhass: that's purely viewpoint ;)
[10:58:21] PlasmaStar: has joined #ruby
[10:58:32] sdothum: has joined #ruby
[10:59:07] Stratege: I am, of course, open to hearing about the benefits of treating methods as not-values.
[10:59:10] jhass: where you declare atomicity is arbitrary, you declare it at function level, ruby declares it at object level
[10:59:58] Stratege: so numbers in ruby are actually objects as well? No distinction between object types and value types?
[11:00:09] adaedra: yep, numbers are objects
[11:00:13] adaedra: >> 42.class
[11:00:15] ruboto: adaedra # => Fixnum (https://eval.in/397548)
[11:00:35] Stratege: huh, okay. Well I guess that's sorta one way to obtain consistency.
[11:00:36] adaedra: there's no primitives
[11:00:48] jhass: classes are objects too
[11:01:01] Stratege: but methods aren't objects?
[11:01:16] CloCkWeRX: has joined #ruby
[11:01:18] adaedra: not directly, they belong to an object
[11:01:19] jhass: yes, as said you can get an object representing one
[11:01:37] jhass: but they belong to a Class or Module instance
[11:01:47] adaedra: you can get an object representing one through different ways for manipulation
[11:01:48] Zai00: has joined #ruby
[11:02:09] adaedra: procs are objects, too
[11:02:19] tuor: hi, this (http://paste.debian.net/281883/) is returning this error: `private': nil is not a symbol (TypeError)
[11:02:24] Stratege: well, I guess that's quite a principled way of doing OOP.
[11:03:56] apeiros: tuor: what's your ruby version?
[11:04:23] tuor: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[11:04:38] apeiros: too old for `private def foo`
[11:04:43] apeiros: in that version, def foo returns nil
[11:04:53] jhass: and that version is EOL, so upgrade
[11:04:54] apeiros: either upgrade your ruby, or use one of the other forms to mark the method as private
[11:05:04] apeiros: upgrading clearly preferred
[11:05:23] apeiros: if you're starting with ruby, there's no reason not to use the current version, 2.2.2
[11:05:33] ddv: lol debian has an ugly pastie
[11:05:51] adaedra: but it's stable at least
[11:05:57] revath: has joined #ruby
[11:05:59] yardenbar: has joined #ruby
[11:06:11] apeiros: there are unstable pastebins? o0
[11:06:19] ddv: apparantly....
[11:06:40] adaedra: debian stable joke
[11:07:06] ddv: this is a serious channel adaedra
[11:07:18] ddv: no jokes
[11:07:21] apeiros: it's monday! that's not a day for jokes!
[11:07:23] darkf: adaedra: I was going to make fun of arch not having one but they actually do. in french. http://pastebin.archlinux.fr/
[11:07:31] ddv: also im tired and cranky
[11:07:39] Stratege: I still don't see the benefit of methods requiring special treatment to be considered as objects. Something that not even php requires. What benefit does that provide?
[11:07:57] tuor: apeiros, I have to write it for debian wheezy ruby version. I'll use the "normal/old" way for "private"
[11:07:57] apeiros: Stratege: uh, what?
[11:07:58] adaedra: darkf: what an awful language, I wonder who even speaks it.
[11:08:14] apeiros: Stratege: how are methods first level objects in php?
[11:08:24] darkf: adaedra: Arch users! that's how they go fast, you know
[11:08:38] adaedra: Stratege: er, PHP has no method as values. You just store strings.
[11:08:54] apeiros: serious bullshit needs serious refuting???
[11:09:01] chipotle: has joined #ruby
[11:09:05] yorickpeterse: but PHP has type hinting!!!11
[11:09:11] yorickpeterse: and oh it doesn't work for scalars
[11:09:12] eGGsha: has joined #ruby
[11:09:20] adaedra: they even differentiate internal functions from user functions
[11:09:30] adaedra: using PHP to prove your point? kek.
[11:09:37] surs4: has joined #ruby
[11:09:43] lessless: has joined #ruby
[11:09:51] apeiros: adaedra: absolutely valid! "this is just as shitty as in php"
[11:10:12] apeiros: it's difficult to achieve that, though
[11:10:13] adaedra: php > function hello() { }; $a = hello;
[11:10:14] adaedra: PHP Notice: Use of undefined constant hello - assumed 'hello' in php shell code on line 1
[11:10:31] darkf: well it _is_ similar to PHP :p
[11:10:35] yorickpeterse: well, in Ruby that too would get you an error
[11:10:39] yorickpeterse: but at least it would be an error
[11:10:41] ddv: I feel sad for Stratege
[11:11:13] apeiros: Stratege: anyway - lets take a language where you actually can get at the function object without a special method call or syntax: javascript
[11:11:27] apeiros: Stratege: there it's like: x = some_obj.func_name
[11:11:45] apeiros: and you can do that because they require parens. so getting function vs. calling the function is unambiguous
[11:11:55] startupality: has joined #ruby
[11:12:24] Zai00: has joined #ruby
[11:12:30] apeiros: now ruby could either use special syntax to differ, e.g. reserve :: for the method object (x = obj::method_name), or it can do what it currently does: not introduce additional syntax but just provide a method
[11:12:52] apeiros: not using syntax has one big benefit: it's discoverable.
[11:13:02] apeiros: or rather: using methods has that benefit.
[11:13:28] apeiros: there are, of course, also downsides to it. but all in all it's a design decision.
[11:13:32] Asher: has joined #ruby
[11:13:51] polyrob_: has joined #ruby
[11:14:20] blueOxigen: has joined #ruby
[11:14:28] darkf: apeiros: perhaps you could enlighten me as to why Ruby thinks non-existent indices/keys on arrays/hashes should be 'nil' and not an error?
[11:14:35] yashinbasement: has joined #ruby
[11:15:11] adaedra: darkf: actually, they can be whatever you want to be
[11:15:18] apeiros: darkf: .fetch and it raises
[11:15:26] apeiros: darkf: it's a matter of which method you use
[11:15:50] apeiros: as for *why* they chose one over the other - ask the authors. I can only provide possible rationales.
[11:16:04] darkf: apeiros: well, most everyone is going to know about #[] which uses an IMO shitty-by-default 'return nil for default values'
[11:16:14] Stratege: ddv why feel sad for me?
[11:16:18] yashinbasement: hello rubishists , someone asked me what is the meaning of <%== %> , any idea , i have no idea
[11:16:21] darkf: I did not know about #fetch and it seems more heavyhanded than I'd want beyond just using #[] :/
[11:16:29] adaedra: "Ton ptit nom" "Combien de temps doit-on garder ce superbe post " ??? Lol archlinuxfr
[11:16:30] canton7: yashinbasement, look up erb syntax
[11:16:34] apeiros: darkf: *shrug*
[11:16:43] Oog: has joined #ruby
[11:16:46] apeiros: darkf: honestly, I haven't had an issue with [] returning nil
[11:16:54] apeiros: darkf: you can also create your hash with a default proc which raises
[11:16:57] yashinbasement: canton7: double equals
[11:17:16] apeiros: I do that in some rare places where I want to make sure neither I nor any co-developer accidentally fucks up
[11:17:20] adaedra: if you want to check for existance, they're .key?
[11:17:23] apeiros: (and where nil are valid values)
[11:17:24] darkf: apeiros: I do. nil is a value I would probably have as values, and if my code is buggy it will access some key/index that does not exist and I am erroneously getting a value I would expect :p
[11:17:33] darkf: and I would not know about it (much like JS' undefined, which is also shit)
[11:17:33] bruno-: has joined #ruby
[11:17:37] yorickpeterse: then use `if x.key?(...)`
[11:17:37] apeiros: darkf: as in all programming: use proper tools.
[11:17:39] yorickpeterse: problem solved
[11:17:41] apeiros: it's as simple as that
[11:17:51] apeiros: you can't blame the language for you not knowing the proper methods.
[11:18:00] darkf: apeiros: proper tools? so, not Ruby? /s
[11:18:12] apeiros: darkf: read again.
[11:18:32] ddv: just dont use programming languages I hate them all
[11:18:34] darkf: apeiros: I can blame the language for not doing things I'd expect, and when everyone uses #[] I cannot be expected to know that #fetch exists
[11:18:47] canton7: yashinbasement, read the erubis docs :P
[11:18:51] startupality: has joined #ruby
[11:18:56] darkf: believe it or not you can blame things for bad design
[11:18:59] apeiros: darkf: fine, don't use ruby. use mental-lang. it figures what you expect from it automatically.
[11:19:01] canton7: it's in there somewhere... trying to find where
[11:19:05] yorickpeterse: darkf: yes you can, it's called "Read the documentation"
[11:19:10] apeiros: sorry, but that's obtuse.
[11:19:14] yorickpeterse: Everybody using X is not an excuse for not knowing Y doesn't exist
[11:19:19] yorickpeterse: That's such bullshit it's not even funny
[11:19:40] yorickpeterse: "Everybody uses petrol powered cars, therefor I don't know electric cars exist"
[11:19:44] darkf: yorickpeterse: it's the most obvious way to access an item. why would i not expect that to do something sane?
[11:19:48] darkf: that is a bullshit cop-out
[11:19:55] darkf: "you can just use this other method, just RTFM!"
[11:19:56] yorickpeterse: darkf: what's not sane about returning nil?
[11:19:56] apeiros: darkf: it does something perfectly sane
[11:20:07] apeiros: darkf: you're all "oh my use case must be everybody's use case"
[11:20:11] apeiros: darkf: you. are. not. everybody.
[11:20:30] canton7: yashinbasement, http://www.kuwata-lab.com/erubis/users-guide.02.html#tut-escape
[11:20:36] dgutierrez1287: has joined #ruby
[11:20:38] Stratege: also yeah sorry about the php comment, for some silly reason I thought lambdas and methods would be treated the same... I shouldn't have made that silly assumption ^^
[11:20:43] yorickpeterse: nil is a value yes, but so is an integer or a string or anything else
[11:20:47] ddv: he has a point tho, asking for something that doesn't exist is an error right
[11:20:51] apeiros: anyway, pointless to continue that discussion. entitlement never hears arguments.
[11:20:52] darkf: apeiros: nor are you. clearly nobody has this problem because a few of you don't, right; everybody just RTFMs and uses #fetch instead
[11:20:57] yorickpeterse: so by that argument #[] returning anything else is equally wrong
[11:21:03] adaedra: Stratege: never make assumptions in PHP. This language was designed with a dice.
[11:21:10] apeiros: darkf: correct. we read the manual and don't run into the problem. great you see that.
[11:21:19] yorickpeterse: darkf: No, people use #fetch when they need to have custom behaviour or raise an error
[11:21:27] apeiros: darkf: we don't blindly expect the language to do whatever our imagination happens to come up with
[11:21:37] yorickpeterse: In the 10ks of LOC that I have #fetch is only used in a few places, #[] works fine everywhere else
[11:21:37] apeiros: darkf: we don't guess. we verify.
[11:21:48] adaedra: if you know how the tool work, you're better using it.
[11:21:55] darkf: I hope when you run into errors which cause you to lose hours of your time due to shitty default behavior you finally RTFM and find an obscure method which solves all of that by providing sane behavior ;)
[11:21:55] c355E3B: has joined #ruby
[11:21:55] yashinbasement: canton7: thankss
[11:22:04] yorickpeterse: #[] raising an error by default would be useful if a compiler could catch this prior to running the app
[11:22:10] Stratege: adaedra yeah ... my bad xD I normally don't xD
[11:22:18] yorickpeterse: darkf: is that not the core of programming?
[11:22:23] yorickpeterse: As in, find bug, find something better, use that?
[11:22:40] darkf: not when it's something the language could easily prevent, no
[11:22:55] apeiros: darkf: you refuse to accept that the language *does* easily prevent it.
[11:23:06] canton7: I think the lesson here is "don't try to use something you don't know how to use". If you say "I tried to drive a lorry but crashed it, that's the lorry's fault" people will laugh at you
[11:23:06] yorickpeterse: apeiros: yeah but imagine having to learn this new thing
[11:23:08] adaedra: I prefer having #[] returning nil rather than raising
[11:23:15] yorickpeterse: heavens forbid actually having to spend some time on your program
[11:23:18] Stratege: to me the core of programming is to think about what the problem requires and then express that in a way that captures the essence of the problem and takes care of the cornercases. And then go see if the compiler agrees with me or not.
[11:23:21] yorickpeterse: You know, that thing that might earn you lots of money
[11:23:24] canton7: ruby has a design philosophy that guides these sorts of decisions. they're consistent within that philosophy.
[11:23:40] darkf: well I am sorry if you get paid to learn ruby's flaws :)
[11:23:44] yorickpeterse: Here's a personal flow chart on how to solve this problem:
[11:23:53] yorickpeterse: 1) Do you need to get a key and raise an error? Use #fetch
[11:23:55] darkf: and then try to defend the language's shit-by-default behavior with "there are alternates... just hidden away!"
[11:23:58] yorickpeterse: 2) Do you not care about errors, use #[]
[11:24:00] leat: has joined #ruby
[11:24:03] yorickpeterse: problem solved
[11:24:05] apeiros: darkf: do us a favor. stop using ruby.
[11:24:10] ddv: thats a pretty simple flowchart
[11:24:15] yorickpeterse: ddv: Yeah, I patented it
[11:24:33] yashinbasement: has left #ruby: ("Leaving")
[11:24:48] adaedra: darkf: be our guest, go use your better designed language if you're not able to adapt other languages with other ways of thinking
[11:24:57] darkf: apeiros: nah, I think I will continue terrorizing you by pointing out flaws in the design
[11:25:05] darkf: while you incessantly try to defend it and how dare I
[11:25:13] darkf: have a chill pill
[11:25:13] apeiros: darkf: all you did was point out that you're unable to read docs.
[11:25:27] adaedra: oh, people think differently, how dare they!
[11:25:32] yorickpeterse: darkf _does_ have a point that #[] raising errors is more common, at least in statically typed languages
[11:25:40] darkf: no, also in dynamic ones
[11:25:40] yorickpeterse: but Ruby isn't statically typed, nor does the language itself have a compiler
[11:25:44] yorickpeterse: (that can check for this)
[11:25:45] darkf: "JS does it" is not an excuse
[11:25:58] darkf: yorickpeterse: that ... is irrelevant
[11:26:02] adaedra: "X does it" is not an excuse, whatever X is
[11:26:07] darkf: python raises an error, and tells you what you fucked up
[11:26:10] ndrei: has joined #ruby
[11:26:14] darkf: Ruby silently passes nil, which is a reasonable value
[11:26:19] darkf: it's stupid as shit
[11:26:32] apeiros: darkf: oh, funny, same applies otherwise: "X does it that way" isn't an excuse for expecting that behavior from Y
[11:26:33] yorickpeterse: based on what?
[11:26:34] adaedra: because they think it's an error, while ruby thinks it's not, it's another way of seeing it
[11:26:38] prestorium: has joined #ruby
[11:26:39] yorickpeterse: How is it stupid?
[11:26:50] apeiros: darkf: anyway, stop the inflammatory tone.
[11:26:52] darkf: yorickpeterse: _it is a value I would expect_. _nil does not tell me what I did wrong_.
[11:26:59] yorickpeterse: darkf: sure it does
[11:27:00] darkf: apeiros: you are the one doing that
[11:27:02] adaedra: you have #key? and #fetch for force checking, and Hash.new to change default value.
[11:27:16] darkf: yorickpeterse: imagine I return x[i] from a possibly complex method
[11:27:16] adaedra: And accessing a non-existing element is not always an error.
[11:27:20] darkf: it returns nil instead of what I expect
[11:27:25] darkf: where do I know where this nil came from?
[11:27:30] tmtwd: has joined #ruby
[11:27:36] yorickpeterse: Why do you need to know the origin? You only need to know its presence or not
[11:27:57] yorickpeterse: Why do you give a crap where the nil originates from?
[11:28:03] darkf: because I want to fix my code?
[11:28:08] canton7: darkf, again, this is "darkf doesn't know how ruby (or objective-c, or any other language which makes this decision) works", not "ruby is shit" :P
[11:28:09] darkf: or do you just not do that?
[11:28:26] Takumo: has joined #ruby
[11:28:26] Takumo: has joined #ruby
[11:28:26] yorickpeterse: darkf: why is returning nil a problem?
[11:28:39] yorickpeterse: oh and btw you can track where nil originates from just fine if it weren't a singleton
[11:28:53] yorickpeterse: IIRC brixen and I have been talking about adding location information to NilClass
[11:28:56] darkf: yorickpeterse: how would I track that?
[11:28:56] apeiros: debugging??? how does it work
[11:29:10] darkf: apeiros: who knows, you clearly don't do it
[11:29:17] apeiros: darkf: I don't have to
[11:29:18] adaedra: apeiros: you send the code to India and they fix everything
[11:29:26] yorickpeterse: nil being returned by accident is a problem yes, but #[] very clearly communicates it returns nil when a key is not found
[11:29:30] darkf: apeiros: right, you write a buggy mess ;)
[11:29:41] apeiros: !kick darkf told you
[11:29:41] helpa: apeiros: No.
[11:29:41] ruboto: ruboto kicked darkf: you
[11:29:41] ruboto: -o ruboto
[11:29:47] darkf: has joined #ruby
[11:29:49] darkf: yorickpeterse: it also returns nil for [nil][0]
[11:29:58] yorickpeterse: I'm pretty sure apeiros knows what he's doing Ruby wise
[11:30:02] darkf: am I just _not supposed to use nil_?
[11:30:10] yorickpeterse: darkf: Yeah....please actually read up on Ruby's documentation
[11:30:14] darkf: except as some magical sentinel value?
[11:30:15] yorickpeterse: because Array#[] says the exact same thing
[11:30:25] canton7: darkf, again, if you need a "sentinal" value, use #fetch
[11:30:37] yorickpeterse: "Returns nil if the index (or starting index) are out of range.
[11:30:41] yorickpeterse: boom there you have it
[11:30:43] darkf: yorickpeterse: you don't seem to understand what I find wrong so nevermind
[11:30:53] canton7: it's a debatable decision, but it is the way that it is.
[11:30:53] yorickpeterse: darkf: I do perfectly understand it and I heavily disagree
[11:31:04] canton7: given that, your place is to learn the langauge, not fight it :P
[11:31:27] yorickpeterse: There are plenty of cases where raising an error in #[] is super counter productive
[11:31:30] Zai00: has joined #ruby
[11:31:30] adaedra: if the language is not for you because you don't like it, there are so many others to use
[11:31:31] darkf: fyi the inflammatory tone you all took before me is not conductive to anything
[11:31:36] yorickpeterse: Same as there might be cases where returning nil is
[11:31:48] apeiros: darkf: wow
[11:31:53] yorickpeterse: The solution? Deal with it instead of trying to force one method over there other
[11:31:55] canton7: ACTION isn't sure how to tell darkf he's the inflammatory one here
[11:32:03] Takumo: has joined #ruby
[11:32:03] Takumo: has joined #ruby
[11:32:08] yorickpeterse: darkf: You're the one here who's making false claims about people
[11:32:08] darkf: canton7: if you cannot see yourselves being inflammatory then that is the issue
[11:32:10] [k-: I just read a kick and a buggy mess ;)
[11:32:23] canton7: darkf, I somewhat sympathise with you in principle
[11:32:30] Stratege: I've kept out of the conversation since it took a bit of a hostile turn, but while darkf has definitly been hostile, he has also had other people be hostile towards him.
[11:32:37] apeiros: !ban darkf !T 1h easy, we can calm the situation down for you.
[11:32:38] ChanServ: +b darkf!*@*
[11:32:38] ChanServ: ChanServ kicked darkf: easy, we can calm the situation down for you.
[11:32:40] canton7: darkf, but your attitude means I won't argue your case :P
[11:32:52] prestorium: has joined #ruby
[11:33:54] ldnunes: has joined #ruby
[11:34:11] adaedra: Stratege: I guess that's what happens when an unstoppable force encounters an unmovable object.
[11:34:19] fantazo: has joined #ruby
[11:34:59] yorickpeterse: but gais why does Ruby not let you do 1 + "1", PHP does that too
[11:35:01] yorickpeterse: it's so stupid
[11:35:32] apeiros: as I said, it's a case of entitlement
[11:35:35] krz: has joined #ruby
[11:35:40] yorickpeterse: Granted it would be nice if Ruby had an Option type and #[] returned an Option
[11:35:44] apeiros: "I'm entitled to the language behaving the way *I* expect"
[11:35:45] yorickpeterse: ACTION might've written too much Rust
[11:35:57] yorickpeterse: meh, rust is ok
[11:36:14] yorickpeterse: it's really verbose and the tooling around it is _super_ basic (given it's still very young)
[11:36:16] adaedra: I was disapointed when I was reading rust guide and got a "To be written later" chapter.
[11:36:16] Takumo: has joined #ruby
[11:36:16] Takumo: has joined #ruby
[11:36:18] Stratege: yorickpeterse oi, if my claim about php's abilities hadn't been false the question would have ben decent. ^^
[11:36:26] txdv_: you can't coerce ruby to coerce an integer into a string
[11:37:02] yorickpeterse: Stratege: well, your question isn't too bad to be honest
[11:37:03] Stratege: and apeiros has given a fairly nice answer to it.
[11:37:16] yorickpeterse: What I'm uncertain about is Ruby requiring #method and #instance_method to get a method object
[11:37:31] yorickpeterse: instead of referring to the method without parenthesis, although I know why _that_ is (so you can call it without parenthesis)
[11:37:38] apeiros: Stratege: yay! at least somebody today appreciates my replies :D
[11:37:53] Stratege: still, personally I think just requiring () to be used for method calls and method objects being obtained via leaving the () out would have been more consistent and nice
[11:38:06] [k-: technically you can coerce
[11:38:12] aderium: has joined #ruby
[11:38:18] yorickpeterse: Stratege: well, not requiring () allows you to write something like "foo if bar?" instead of "foo() if bar?()"
[11:38:25] yorickpeterse: which is a lot more pleasant on the fingers
[11:38:50] [k-: and eyes
[11:38:59] apeiros: in my toy language I chose the path of different syntax for invocation vs. getting the method itself
[11:39:12] xkef: has joined #ruby
[11:39:19] ndrei: has joined #ruby
[11:39:30] [k-: aka python
[11:39:41] apeiros: but there I have more syntax anyway. the syntax you choose decides whether you get the method, the method's result, or the receiver as return value
[11:39:58] Stratege: personally I love the idea of doing function application via whitespace and assignment working via = and never having (), so a nullary function and a value would be indistinguishable, but that requires purity.
[11:40:47] Stratege: (which, is, ofc, not something every language wants or would benefit from. Atleast not radical purity like that)
[11:40:50] [k-: sounds abit like Nim :o
[11:41:04] agent_white: Where is shevy ?
[11:41:29] but3k4: has joined #ruby
[11:41:53] olistik: has joined #ruby
[11:42:43] y0da: has joined #ruby
[11:42:57] Stratege: yorickpeterse yeah, guess that's a tradeoff. Personally I'm not comfortable with leaving () out yet, since I want to be able to see without a doubt wether what I'm doing is a method call or just accessing a value.
[11:43:22] yorickpeterse: Stratege: well, at least when using a receiver "foo.bar" is always a method call
[11:43:34] yorickpeterse: It gets a bit tricky when there's no receiver
[11:43:44] yorickpeterse: since you have to scan the surrounding code to see if there's a local variable with the same name
[11:44:07] yorickpeterse: also stuff such as "foo = foo" being valid and resulting in "foo" always being nil (even if there's a method called "foo") is stupid
[11:44:38] Stratege: foo = foo is valid and does not result in a non-terminating program? o.o
[11:45:20] ruboto: yorickpeterse # => nil (https://eval.in/397626)
[11:45:39] [k-: no recursive resolution here ;)
[11:45:42] Stratege: also, that sounds like it's impossible to access other objects values, only their methods?
[11:45:44] yorickpeterse: so you'd have to do "foo = self.foo" for that
[11:45:49] yorickpeterse: Stratege: correct
[11:45:58] yorickpeterse: You need getters for instance variables, that's actually a good thing
[11:46:04] adaedra: Encapsulation !
[11:46:17] Stratege: I did not expect ruby to be that hardcore OOP. Cool.
[11:46:37] yorickpeterse: It's pretty close to Smalltalk
[11:46:40] adaedra: (I thank the person bearing this nick so I can tab-complete this word.)
[11:46:44] yorickpeterse: except it botched a few things up
[11:47:09] yorickpeterse: Tooling for example, Smalltalk had way better tools
[11:47:21] yorickpeterse: Also the total lack of concurrency in the language itself
[11:47:25] yorickpeterse: leaving it up to implementations
[11:47:35] yorickpeterse: IIRC Smalltalk's runtime inspection was also much better
[11:47:36] zacstewart: has joined #ruby
[11:47:47] yorickpeterse: But I never wrote Smalltalk professionally so I might be talking out of my arse
[11:48:17] quazimodo: has joined #ruby
[11:48:18] quazimod1: has joined #ruby
[11:49:19] Stratege: huh okay, thanks
[11:50:36] PhantomSpank: has joined #ruby
[11:50:37] baweaver: has joined #ruby
[11:50:43] shevy: yorickpeterse you are talking out your arse yay! \o/
[11:51:18] [k-: Ox0dea has been idle for 7h :(
[11:53:22] Stratege: yorickpeterse did ruby do something particularly better than smalltalk though? (genuine curiosity)
[11:53:44] yorickpeterse: People actually used it
[11:54:24] Stratege: apart from that? ^^
[11:54:47] leat: has joined #ruby
[11:54:55] [k-: a strong and prosperous community
[11:54:58] yorickpeterse: can't think of any from the top of my head, other than it being source based instead of using a VM image
[11:55:31] adaedra: we prefer big talks
[11:55:35] adaedra: ACTION runs
[11:57:20] Stratege: ^^ fair enough.
[11:57:22] thiagovsk: has joined #ruby
[11:57:25] [k-: let's talk obfuscation!
[11:57:42] yorickpeterse: just use Base64
[11:57:57] mercwithamouth: has joined #ruby
[11:58:02] [k-: does anyone get my require problem from yesterday
[11:58:05] shevy: both jhass and adaedra say no
[11:58:46] [k-: everyone is frightened from the horrendousity of my code ;)
[11:58:58] [k-: hint that word doesn't exist
[11:59:47] shevy: [k- yes you are on your path to evil
[11:59:51] Oog: has joined #ruby
[12:00:04] [k-: I want to finish my library
[12:00:04] adaedra: # service [k- stop
[12:00:10] adaedra: hop, no more demonic [k- .
[12:00:22] shevy: adaedra wait
[12:00:24] shevy: is this systemd?
[12:00:31] jhass: worse, upstart
[12:00:50] aderium: aynone knows how to install a gem from a specific source ?
[12:00:57] aderium: we have a fork on github and its driving me nuts
[12:01:01] sp1rs: has joined #ruby
[12:01:08] jhass: didn't we answer this yesterday already?
[12:01:12] aderium: this is a mnaual gem installation not via cap
[12:01:17] aderium: did not work for me
[12:01:27] aderium: the response was a script of sorts
[12:01:31] jhass: how about you elaborate on that
[12:01:32] adaedra: get the gem, build it, install the .gem, drink a cup of tea.
[12:01:41] jhass: else you'll just receive the same answer again
[12:01:49] aderium: i though I could gem install name -s https://github.org/path
[12:01:58] [k-: I'll make sure adaedra sees it first!
[12:02:03] jhass: that's not what source is about
[12:02:32] aderium: ok.. so is there a simple way to specify a url for the fork ?
[12:02:34] nateberkopec: has joined #ruby
[12:02:45] aderium: from shell prompt obviously
[12:02:51] jhass: git clone url; cd foo; gem build foo.gemspec; gem install ./foo.gem
[12:03:47] [k-_: has joined #ruby
[12:03:54] shevy: Aderium in the worst case, whenever you have the .gemspec file, you can build a .gem from that, and then install it
[12:04:04] jamesaxl: has joined #ruby
[12:04:16] shevy: what is the URL to the github project?
[12:04:19] jhass: Aderium: before you're confused, what shevy said is just the verbose version of my commands
[12:05:16] shevy: what I said is the human readable version
[12:05:23] aderium: ok now I understand
[12:05:27] aderium: that did infact work :)
[12:05:42] jhass: Aderium: I made the exact same suggestion yesterday...
[12:06:03] aderium: I may have missed it sorry
[12:06:11] [k-_: im getting the require problem again
[12:06:13] rbennacer: has joined #ruby
[12:06:17] shevy: require properly!
[12:06:17] aderium: I cant seem to go back in history with Textual once I leave
[12:06:25] [k-_: so i tried require 'libobf'
[12:06:30] jhass: [k-_: you mean the problem that you don't understand $LOAD_PATH ?
[12:06:32] [k-_: require 'libobf.rb'
[12:06:46] [k-_: idc about $:
[12:06:57] [k-_: it should look in the current directory!
[12:07:06] adaedra: Aderium: there are public logs, see topic.
[12:07:08] shevy: well try either require './libofb.rb' or append Dir.pwd to $: I think it was, or even better, use everything relative to ruby site dir
[12:07:48] [k-_: well appending worked
[12:08:00] [k-_: ridiculous, i say
[12:08:50] [k-_: after popping $:, require './libobf.rb' works too
[12:09:03] shevy: I think in the 1.8.x era this step was not necessary
[12:09:35] shevy: then came the 1.9.x era with screaming warnings of world writable dirs that made bnagy lose his last hair!
[12:09:53] jhass: . in the $LOAD_PATH proved error prone, so it was removed and require_relative was added instead
[12:10:37] [k-_: this is strange, require_relative works now too
[12:10:42] [k-_: yesterday it didnt
[12:11:09] surs: has joined #ruby
[12:11:10] [k-_: could it be that ruby requires you to require something from the stdlib before requires actually work
[12:11:31] [k-_: mine was a new ruby from rbenv
[12:11:35] arup_r: has joined #ruby
[12:11:39] ddv: [k-: lesson 1 there is no coincidence in programming
[12:11:41] shevy: perhaps you had an old copy installed
[12:11:56] [k-_: wait, no, i got it from homebrew
[12:12:50] shevy: do things finally work [k-_
[12:13:03] fabrice31: has joined #ruby
[12:13:05] shevy: so that you can continue writing unreadable ruby code :)
[12:13:15] [k-_: yes they do work now
[12:13:25] [k-_: its a one off problem
[12:13:41] [k-_: i dont want to get banned from eval.in
[12:13:50] [k-_: i make so many pastes on my phone
[12:14:11] shevy: damn... you are typing on your phone?
[12:14:30] shevy: my fingers are too fat for smartphones
[12:14:51] JMoir: has joined #ruby
[12:14:53] Stratege: ddv doesn't said lesson 1 conflict with the existance of PHP? ^^
[12:14:56] jhass: that just means you haven't found a keyboard that works for you
[12:15:41] ddv: shevy: ur a fatty
[12:15:49] shevy: ddv yeah :(
[12:16:00] apeiros: note that require_relative and require './???' is NOT the same
[12:16:11] apeiros: require_relative works relatively from the file which uses it (__FILE__)
[12:16:30] apeiros: . in $LOAD_PATH / require './???' otoh work relative from the working directory
[12:16:32] shevy: Stratege php is weird... it is not really designed much, it's like a melting pot of things-for-the-www-put-together
[12:16:53] ddv: php is one big hack or many big hacks
[12:17:19] yorickpeterse: apeiros: you can extend that ban for darkf
[12:17:32] yorickpeterse: https://gist.github.com/YorickPeterse/b3c3ba298a8fa8754893
[12:17:54] shevy: php is simply weird
[12:18:10] Zai00: has joined #ruby
[12:18:10] shevy: >> 1 + '1'
[12:18:11] ruboto: shevy # => String can't be coerced into Fixnum (TypeError) ...check link for more (https://eval.in/397665)
[12:18:25] cytoskeletor: has joined #ruby
[12:18:26] [k-_: my __FILE__ is "(irb)"
[12:18:39] shevy: [k-_ I guess irb overrules it?
[12:18:41] [k-_: but it still works
[12:18:47] shevy: normally a __FILE__ should end with a .rb part or?
[12:18:56] [k-_: im using irb to require
[12:19:00] [k-_: so i can test my code
[12:19:03] shevy: oh ... what is __FILE__ ... that is not a constant is it?
[12:19:08] eGGsha: has joined #ruby
[12:19:17] [k-_: _LALALA is not a constant as well
[12:19:22] apeiros: shevy: since constants start with an uppercase letter - no :)
[12:19:31] apeiros: you could consider it a magical string literal
[12:19:36] shevy: it is indeed magical
[12:19:38] eggoez: has joined #ruby
[12:19:39] shevy: it pops up!
[12:20:06] shevy: I don't think I had a use case for reassigning to __FILE__ yet so that's fine by me
[12:20:10] leonardoajim: has joined #ruby
[12:20:19] rickmasta: has joined #ruby
[12:20:29] revath: has joined #ruby
[12:22:28] gagrio: has joined #ruby
[12:22:38] iooner: has joined #ruby
[12:23:49] [k-_: i have a strong itch to show Ox0dea my code to receive praises :<
[12:23:51] lessless: has joined #ruby
[12:24:05] bluOxigen: has joined #ruby
[12:24:48] livcd: #notruby does anybody have a clue how to set a default terminal's theme via cli ? :P
[12:24:57] jhass: ?ot livcd
[12:24:57] ruboto: livcd, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[12:25:02] voker57: has joined #ruby
[12:25:08] leat: has joined #ruby
[12:25:54] shevy: livcd via ruby? perhaps! you can call system()
[12:26:00] tuor: hi, my Method: http://paste.debian.net/281899/, I want to make it possible to give the rules as parameter (with a default) insteed of only harcoding them. Is this possible?
[12:26:10] Musashi007: has joined #ruby
[12:26:12] shevy: I can use ruby for fbsetbg or something like that in fluxbox
[12:26:18] _blizzy_: has joined #ruby
[12:26:22] jhass: ?gist tuor
[12:26:22] ruboto: tuor, https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[12:26:40] livcd: jhass: sorry :-)
[12:26:48] livcd: shevy: yes it can be via ruby as well lol :-)
[12:26:56] astrobun_: has joined #ruby
[12:27:28] tuor: https://gist.github.com/anonymous/6c851aea4a895fa6a2c5
[12:28:13] jhass: tuor: the standard strategy is to define the defaults hash and .merge the parameter into it
[12:28:23] livcd: shevy: though i would probably know how to do it with ruby if i would know what the hell should i do in the first place :S
[12:28:43] shevy: livcd what desktop is it?
[12:28:43] jhass: so foo(rules={}); default_rules = { ... }; default_rules.merge(rules) end
[12:28:53] jhass: however that's one dimensional
[12:28:57] livcd: shevy: standard yosemite :D
[12:29:01] nateberkopec: has joined #ruby
[12:29:10] shevy: I don't know what that means... is that gnome3? kde4?
[12:29:22] shevy: or is it the evil OSX
[12:29:23] jhass: if you want it to work for the nested hashes too, in this case you want to iterate over the defaults and .merge the subhashes
[12:29:29] livcd: shevy: evil OS X
[12:30:04] tvw: has joined #ruby
[12:30:32] victortyau: has joined #ruby
[12:31:33] Kully3xf: has joined #ruby
[12:31:40] jhass: livcd: there's ##apple and ##mac
[12:31:43] adaedra: livcd: come to #ruby-offtopic
[12:32:09] jhass: livcd: oh and #MacOSX
[12:32:29] tuor: I only need the "toplevel" hashes. So ex: :template. If the hash is not given as argument I need to take the default on. So if I right understood, I can do it with default_rules.merge(rules).
[12:32:37] ChanServ: -b darkf!*@*
[12:32:40] JoshL: has joined #ruby
[12:32:53] livcd: jhass: ok ok i'll obey the rulez :-)
[12:34:07] _blizzy_: has joined #ruby
[12:35:32] joonty: has joined #ruby
[12:35:49] [k-_: look, people come to the ruby-community for all sorts of things
[12:35:58] [k-_: this says very good of the community ;)
[12:36:09] shevy: I came for [k-_
[12:36:24] [k-_: you were already here before I
[12:36:30] [k-_: looooooooong ago
[12:36:42] george2: has joined #ruby
[12:36:57] MatrixBridge: has joined #ruby
[12:37:33] evanjs: has joined #ruby
[12:38:02] tomaz_b: has joined #ruby
[12:38:14] eshy: has joined #ruby
[12:38:30] adaedra: shevy: we don't care about your sexual life.
[12:38:46] shevy: now what was that
[12:38:54] tuor: jhass, like this?: https://gist.github.com/anonymous/631b07e90c3ce9589325
[12:39:01] [k-_: lel failed attempt at an insult
[12:39:19] gwendall: has joined #ruby
[12:39:44] jhass: tuor: .merge returns a new hash
[12:39:52] jhass: it doesn't modify the receiver
[12:39:54] jimmythehat: has joined #ruby
[12:39:56] tuor: jhass, ah ok.
[12:40:02] jhass: (nor the argument)
[12:40:40] Hounddog: has joined #ruby
[12:40:58] [k-_: to do that, you'd want merge!
[12:41:03] blackmesa: has joined #ruby
[12:42:02] tuor: jhass, https://gist.github.com/anonymous/c8367d7e27dfcbe625c4
[12:42:03] jhass: or just pass along the return value
[12:42:11] jhass: up, like that
[12:42:25] shredding: has joined #ruby
[12:43:02] nfk: has joined #ruby
[12:43:56] stantonnet: has joined #ruby
[12:45:08] stamina: has joined #ruby
[12:46:51] varunwachaspati: has joined #ruby
[12:47:16] DoubleMalt: has joined #ruby
[12:47:24] neanderslob: has joined #ruby
[12:49:29] charliesome: has joined #ruby
[12:51:29] dagda1: has joined #ruby
[12:51:43] njs126: has joined #ruby
[12:52:46] apeiros: charliesome: ping. not important, but eval-in seems to have a race condition when creating paste id's. yesterday two people evaled at the same time and both got the same id, the latter overriding the former.
[12:53:16] charliesome: it just uses mysql auto increment
[12:53:23] charliesome: it must be a bug in the bot
[12:53:55] konsolebox: has joined #ruby
[12:54:05] Scroff: has joined #ruby
[12:54:06] yorickpeterse: you're not using BSON object IDs?
[12:54:17] apeiros: but the bot uses the ID it gets from eval.in, no?
[12:54:24] apeiros: charliesome: http://irclog.whitequark.org/ruby/2015-07-12#13387453;
[12:54:43] apeiros: hm, I'll check the code
[12:54:51] apeiros: maybe it's indeed a bug there???
[12:54:53] allcentury: has joined #ruby
[12:55:16] charliesome: the next one down didn't skip an id
[12:55:27] charliesome: so it clearly looks like it duped the id on the app side? huh?
[12:55:51] jhass: just switch to postgresql ^.^
[12:55:56] lapide_viridi: has joined #ruby
[12:56:18] charliesome: i don't understand how this could be possible
[12:56:19] apeiros: maybe curl is not thread capable?
[12:56:29] apeiros: that'd be the bot-side explanation
[12:56:37] charliesome: hmm I don't think that's it
[12:56:38] charliesome: check the logs
[12:56:41] apeiros: one curl overrides state of another???
[12:56:43] charliesome: there's two pastes with the same id
[12:56:53] charliesome: and then the next paste has the next id, it doesn't skip the id
[12:57:11] charliesome: if it was a bot-side race then I think it'd have to skip an id
[12:57:19] charliesome: let me check the binlogs...
[12:57:21] apeiros: my suggestion is that the first eval is https://eval.in/397075
[12:57:34] apeiros: seems like I'm right
[12:57:40] apeiros: check the link
[12:57:59] charliesome: might be a bot-side bug then
[12:58:06] charliesome: is the bot open source?
[12:58:18] apeiros: so what I think happened: first eval curls, gets 397075 returned, second curls, gets 397076 returned, mutates some global state in curl of the first
[12:58:25] apeiros: it's still your code ;-)
[12:58:27] charliesome: that would explain it
[12:58:50] jhass: but wouldn't have that mutated the result too?
[12:58:55] apeiros: the bot isn't opensource atm. I aim to release non-critical parts until end of year.
[12:59:05] jhass: oh, right, we scrape Location, mmh
[12:59:14] apeiros: jhass: timing
[12:59:26] apeiros: we read the body first, header later
[12:59:27] charliesome: apeiros: yeah maybe just toss a mutex around the whole thing
[12:59:30] tkuchiki: has joined #ruby
[12:59:46] apeiros: ok, anyway. sorry for the noise. could have checked for bot-side bug first.
[12:59:48] JMoir: Does anyone know what I can't acces the sinatra session variable here? https://gist.github.com/jamalmoir/c3384a264fbdb2bb9ee7 I can access it fine in my routes file...
[13:00:01] n008f4g_: has joined #ruby
[13:00:10] apeiros: and yeah, just tossing a mutex around it. collisions will be rare.
[13:00:14] bougyman: i'm confused.
[13:00:29] apeiros: but it's a bit sad to see that curl isn't thread-safe.
[13:00:30] rwilcox: has joined #ruby
[13:00:36] jhass: apeiros: though I always thought the only thread unsafe thing in curl is the resolver and that got fixed with AsyncDNS support
[13:00:40] atomical: has joined #ruby
[13:00:43] bougyman: why would you use curl, though?
[13:01:06] jhass: I mean why would the bother to fix that part if the rest is unsafe anyhow
[13:01:07] apeiros: bougyman: don't blame me! I only copied that code :D
[13:01:52] neanderslob: has joined #ruby
[13:01:57] bougyman: i used cinch-evalso in my bot, which uses https://github.com/eval-so/ruby-evalso/blob/master/lib/evalso.rb underneath.
[13:02:01] bougyman: no thread probs.
[13:02:06] apeiros: charliesome: wrt open sourcing ruboto: I remember correctly that you said the eval code was fine to release?
[13:02:11] charliesome: yeah that's fine
[13:02:55] charliesome: also that bot's code goes back to like 2012
[13:03:13] charliesome: at the time I just went with curl but it's probably not necessary
[13:04:18] evanjs: has joined #ruby
[13:04:56] ujjain: is this ruby? <% scope['hazelcast::extra_libraries'].each do |extra_library| %><%= scope.function_template(<%= extra_library.template %>) %><% end %>
[13:05:10] shevy: ujjain the part inside the <% and %>
[13:05:12] apeiros: ujjain: looks like erb
[13:05:20] apeiros: ujjain: which is a template language embedding ruby
[13:05:22] ujjain: oh, I didn't know that was a seperate thing
[13:05:32] apeiros: it's part of ruby. not separate.
[13:05:33] ujjain: ah ok, interesting. It does not accept <%= inside of <%= though
[13:05:33] shevy: it's a bit like embedding php/html
[13:05:35] bougyman: i've not seen hazelcast used in ruby before
[13:05:45] ujjain: it's Puppet to deploy Hazelcast
[13:05:58] ujjain: <%= scope.function_template(<%= extra_library.template %>) %> - Complains about this syntax.
[13:05:59] umgrosscol: has joined #ruby
[13:06:06] apeiros: because it's not valid
[13:06:11] bougyman: you don'e need the <%= in the function call
[13:06:25] bougyman: <%= scope.function_template(extra_library.template) %>
[13:06:27] bougyman: do that instead
[13:07:06] tkuchiki: has joined #ruby
[13:07:34] ujjain: thanks, that looks a bit better, extra_library.template doesn't seem the way how to handle a named array though
[13:07:41] vyorkin: has joined #ruby
[13:08:12] ujjain: hazelcast::extra_libraries:
[13:08:13] ujjain: - template: "hazelcast_local_listeners.xml.j2"
[13:08:14] ujjain: let me google that one
[13:08:45] vyorkin: has joined #ruby
[13:09:08] freerobby: has joined #ruby
[13:10:51] JMoir: Apparently sinatra can only see the session object within a request, is there anyway to get around this and pass it to a function?
[13:11:07] DoubleMalt: has joined #ruby
[13:11:19] apeiros: JMoir: what stops you from passing the request object as an argument to a method?
[13:11:36] quimrstorres: has joined #ruby
[13:12:07] JMoir: Outside of requests it throws out an error saying session is undefined
[13:12:39] jhass: JMoir: how about passing the session along?
[13:12:42] ujjain: what is the name of the type of array I posted above?
[13:12:43] apeiros: what do you mean by "outside of a request"?
[13:12:51] apeiros: do you mean you invoke code when no request is happening?
[13:12:53] JMoir: outside of a get/post etc
[13:13:21] apeiros: JMoir: but that code outside of get/post is invoked from within a get/post, right?
[13:13:22] JMoir: https://gist.github.com/jamalmoir/c3384a264fbdb2bb9ee7 this is what I'm trying to do
[13:13:27] yorickpeterse: ffs, why are country names usually "Foobar, democratic republic of" instead of just "Democratic republic of Foobar"
[13:13:39] voker57: because sorting
[13:13:48] dhjondoh: has joined #ruby
[13:14:16] apeiros: also note how the more a nation claims democracy in its name, the more suppressing it is???
[13:14:41] adaedra: You want East and West Germany to be together in your list
[13:15:09] yorickpeterse: Because the E and W are so close right
[13:15:30] jhass: >> require "yaml"; YAML.load %(hazelcast::extra_libraries:\n - template: "hazelcast_local_listeners.xml.j2") # ujjain
[13:15:31] ruboto: jhass # => {"hazelcast::extra_libraries"=>[{"template"=>"hazelcast_local_listeners.xml.j2"}]} (https://eval.in/397697)
[13:15:35] leat1: has joined #ruby
[13:15:50] jhass: hash -> array -> hash
[13:15:55] bungoman: has joined #ruby
[13:16:21] yorickpeterse: oh great, there's apparently Congo and Democratic Republic of the Congo
[13:16:24] yorickpeterse: which have different ISO codes
[13:17:31] apeiros: different numeric codes or also different alpha2 codes?
[13:17:31] yorickpeterse: Different alpha 2 codes
[13:17:31] yorickpeterse: and alpha 3 codes
[13:17:31] Igorshp: has joined #ruby
[13:17:31] abuzze: has joined #ruby
[13:17:31] yorickpeterse: and even numeric one
[13:17:31] jhass: JMoir: you can't do that. period
[13:17:31] adaedra: There are also two koreas, yorickpeterse
[13:17:31] apeiros: well, the numeric ones change when a country is not considered to be the same
[13:17:31] shevy: unite now!
[13:17:37] yorickpeterse: adaedra: Yeah, except those are actually different countries
[13:17:48] yorickpeterse: http://www.nationsonline.org/oneworld/congo_roc.htm vs http://www.nationsonline.org/oneworld/congo_droc.htm
[13:17:59] JMoir: jhass: Sigh, I see. Thanks anyway
[13:18:03] njs126: has joined #ruby
[13:18:05] yorickpeterse: wait what the fuck
[13:18:05] adaedra: and it's not the case for congo?
[13:18:08] yorickpeterse: these are different countries?
[13:18:21] adaedra: To wikipedia!
[13:18:31] yorickpeterse: apparently they are
[13:18:35] tomphp_: has joined #ruby
[13:18:45] adaedra: Yep, two congos (one is ex-Zaire)
[13:18:57] yorickpeterse: people and naming, still hard
[13:19:14] stnly: has joined #ruby
[13:19:18] jhass: people and living together
[13:19:26] adaedra: The non-democratic is smaller
[13:19:41] dcarmich: has joined #ruby
[13:19:44] yorickpeterse: Hm that would be interesting, what if a website just says "Person X is from Congo", which one do you pick
[13:19:52] whippythellama: has joined #ruby
[13:19:56] adaedra: The pitchfork
[13:20:00] yorickpeterse: Though I've yet to actually see a review coming from somebody in one of the congos
[13:20:11] jhass: the one with the bigger population?
[13:20:22] yorickpeterse: Yeah that's completely meaningless
[13:20:37] yorickpeterse: that's like saying "Alex" is a male name because reasons
[13:20:38] ujjain: http://pastebin.com/JceZ7rih - I was expecting the value of the template to be printed, not a comment inside my loop.
[13:20:39] ruboto: ujjain, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/4c8c8887b77d699c8bdf
[13:20:39] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[13:20:51] Steve_Jobs: has joined #ruby
[13:20:57] neanias: He's alive!
[13:20:58] tagrudev: has joined #ruby
[13:21:01] neanias: It's a Christmas mircale
[13:21:47] jhass: ujjain: <% %> doesn't print, <%= %> does
[13:22:04] ddv: another devops guy who doesn't know programming?
[13:22:05] ujjain: thanks a lot jhass
[13:22:13] ujjain: haha true
[13:22:22] ujjain: I used ansible for 2 years though
[13:23:00] mercwithamouth: has joined #ruby
[13:24:26] bougyman: i wish devops people would stop writing devops tools.
[13:24:30] bougyman: they get worse every week.
[13:24:45] yorickpeterse: bougyman: you don't like your Gulp with your Docker and Ansible?
[13:24:57] bougyman: believe it or not we're still on chef.
[13:25:17] malconis: has joined #ruby
[13:25:17] bougyman: they all suck in many ways. we've wrestled our way around most of chef's suck by now, though.
[13:25:32] lele|w: has joined #ruby
[13:25:52] leat1: has joined #ruby
[13:26:05] yorickpeterse: oh fuck me, I also have to deal with people using "Belgie" for "Belgium"
[13:26:14] presto: has joined #ruby
[13:26:23] yorickpeterse: Instead of "Belgi??"
[13:26:31] adaedra: Don't forget Belgique
[13:26:45] shevy: cheese and chocolate
[13:26:49] shevy: just like switzerland
[13:26:57] bougyman: I don't differentiate between europeans.
[13:26:58] adaedra: I thought it were beer and fries
[13:27:07] adaedra: bougyman: too bad
[13:27:08] mesamoo: has joined #ruby
[13:27:59] shevy: beer and fries - isn't this the UK
[13:28:04] ujjain: then I guess it's also obvious why <%= scope.function_template(extra_library['template']) %> returns custom functions must be called with a single array that contains the arguments. For example, function_example([1]) instead of function_example(1) - Evaluation Error: Error while evaluating a Function Call
[13:28:14] vt102: has joined #ruby
[13:28:47] yorickpeterse: gah also the French of course calling it Pays-bas instead of The Netherlands
[13:28:55] jimmythehat: how do I mock an in-block variable using rspec? In this example, I want to mock the variable 'letter'. https://gist.github.com/anonymous/9e59b52c48dc3b6a15d3 how would I do this? Also, this is an rspec question and a learning excercsize so I'm not interested in how I'd change by codebase, only my testbase. Finally, allow_any_instance_of is discouraged https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance and I do pers
[13:29:04] yorickpeterse: (??????????)?????? multi-lingual support
[13:29:06] but3k4: has joined #ruby
[13:29:42] blackmesa: has joined #ruby
[13:30:04] centrx: has joined #ruby
[13:30:17] abuzze: has joined #ruby
[13:30:25] Scripore: has joined #ruby
[13:30:49] yorickpeterse: lol, I apparently have a review with the origin set to "71" by the reviewer
[13:30:57] jerius: has joined #ruby
[13:31:14] djbkd_: has joined #ruby
[13:31:29] tsvenson: has joined #ruby
[13:31:34] ujjain: I have no idea how to write the ?? on my keyboard, so it tricky
[13:32:00] vt102: has joined #ruby
[13:32:03] yorickpeterse: compose-key + shift + " then press e
[13:32:05] shevy: phone a cat for help
[13:32:06] yorickpeterse: at least on Linux
[13:32:39] quimrstorres: has joined #ruby
[13:32:39] crowell: has joined #ruby
[13:32:39] crowell: has joined #ruby
[13:33:16] Kully3xf: has joined #ruby
[13:33:41] ddv: just google it
[13:33:44] ddv: and copy/paste
[13:33:45] bmurt: has joined #ruby
[13:33:51] eGGsha: has joined #ruby
[13:34:03] ddv: think of word that uses it
[13:34:13] calleerlandsson: has joined #ruby
[13:35:29] rbennacer: has joined #ruby
[13:35:48] neanderslob: has joined #ruby
[13:35:49] hakunin: has joined #ruby
[13:35:59] LJT: has joined #ruby
[13:36:06] leat1: has joined #ruby
[13:36:54] jimmythehat: how do I mock an in-block variable using rspec? In this example, I want to mock the variable 'letter'. https://gist.github.com/anonymous/9e59b52c48dc3b6a15d3 how would I do this? Also, this is an rspec question and a learning excersize so I'm not interested in how I'd change by codebase, only my testbase. Finally, allow_any_instance_of is discouraged https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance and I do perso
[13:37:56] [k-_: i want to share my code with all of #ruby!
[13:38:13] shevy: [k-_ share your code and share your love!
[13:38:54] [k-_: im almost done
[13:39:04] millerti: has joined #ruby
[13:39:15] devdazed: has joined #ruby
[13:39:44] bungoman: has joined #ruby
[13:40:20] sgambino: has joined #ruby
[13:40:40] dblessing: has joined #ruby
[13:42:36] jimmythehat: awh, peopllee...
[13:42:47] jimmythehat: ive googled hard
[13:43:28] nateberkopec: has joined #ruby
[13:44:09] jhass: jimmythehat: why you monkey patch String :(
[13:44:11] Kully3xf_: has joined #ruby
[13:44:17] jhass: anyway, just string.method_2
[13:44:28] jhass: well, or method_1 even
[13:45:32] gagrio: has joined #ruby
[13:45:57] aspiers: has joined #ruby
[13:47:37] [k-_: << just bit me :(
[13:47:52] yorickpeterse: well shit, http://geocoder.opencagedata.com/demo.html is actually pretty solid
[13:47:57] yorickpeterse: plus it's supported by geocoder
[13:48:07] yorickpeterse: ???(???)??? time to get the boss' credit card
[13:48:18] yorickpeterse: because those 2500 reqs/day will be blown away in a few minutes
[13:49:03] mleung: has joined #ruby
[13:49:23] [k-_: A geocoder turns a geographic reference, such as an address, a place name or locality into geographic coordinates as latitude and longitude. The good folks at Wikipedia explain this far better than we can.
[13:49:28] bjornar: has joined #ruby
[13:49:35] yorickpeterse: I need more like, 20k/day
[13:49:38] davedev24: has joined #ruby
[13:49:59] [k-_: thats a lot
[13:50:04] [k-_: you have 20k customers per day? :o
[13:50:19] mos: has joined #ruby
[13:50:25] shevy: all dutch!
[13:50:40] otisZart: has joined #ruby
[13:50:47] shevy: [k-_ don't mess with them, they are the asians in europe, watch at their muay thai fighters
[13:51:20] Igorshp: has joined #ruby
[13:51:24] bronson: has joined #ruby
[13:51:46] yorickpeterse: [k-_: No, 20k reviews coming in on a daily basis
[13:51:56] yorickpeterse: though we've had peaks of 100k
[13:52:38] segfalt: has joined #ruby
[13:56:11] [k-_: time to freeze some values
[13:56:18] [k-_: so they dont get changed
[13:56:19] Kully3xf: has joined #ruby
[13:56:27] beef-wellington: has joined #ruby
[13:57:10] varunwachaspati: has joined #ruby
[13:57:22] hal_9000_: has joined #ruby
[13:58:37] julieeharshaw: has joined #ruby
[13:59:28] tvw: has joined #ruby
[13:59:33] pothibo: has joined #ruby
[13:59:40] codecop: has joined #ruby
[14:00:16] cpruitt: has joined #ruby
[14:00:43] paulcsmith: has joined #ruby
[14:00:51] stantonnet: has joined #ruby
[14:01:46] yorickpeterse: hrmpf, based on our current dataset this would take weeks to reprocess our data
[14:01:56] yorickpeterse: e.g. at 200k max per day this would take about 50 days
[14:02:10] yorickpeterse: That assumes an instant response from the server, if it takes 2-3 seconds that would be even longer
[14:02:32] casadei_: has joined #ruby
[14:04:01] jpfuentes2: has joined #ruby
[14:05:28] apeiros: parallelize!!!
[14:05:33] jschoolcraft: has joined #ruby
[14:05:35] apeiros: ACTION goes back under his rock
[14:06:17] JakFrist: has joined #ruby
[14:06:47] yorickpeterse: apeiros: well yeah, that we already do
[14:06:57] yorickpeterse: but even then I can still only request per day whatever the rate limit is
[14:07:06] ddv: pay more
[14:07:42] whippythellama: has joined #ruby
[14:07:45] nathanstitt: has joined #ruby
[14:07:48] apeiros: oh yorickpeterse - since you're all into xpath atm - if I have <foo><bar><baz>text</baz></bar></foo>, how would I write an xpath selecting <bar>, based on it having the child <baz> with text "text"?
[14:08:02] apeiros: yorickpeterse: get multiple accounts!
[14:08:17] apeiros: or yes, in essence: pay more :D
[14:08:37] apeiros: xpath is one of those technologies I re-learn every ~15 months.
[14:09:31] Scripore: has joined #ruby
[14:09:35] shevy: so powerful is it
[14:09:43] chouhoulis: has joined #ruby
[14:09:46] yorickpeterse: apeiros: foo/bar[baz[.="test"]]
[14:09:49] ddv: the invisible hand that guides us all
[14:09:56] shevy: imagine which other technology requires you to relearn it every some months!
[14:10:14] [k-_: more powerful than than my library ;-;
[14:10:22] charliesome: has joined #ruby
[14:10:22] [k-_: pretty soon my library will be on that list
[14:10:29] [k-_: assuming if people touch it
[14:10:48] phutchins: has joined #ruby
[14:10:49] ddv: java is pretty powerful->http://blog.trendmicro.com/pawn-storm-first-java-zero-day-attack-in-two-years-targets-nato-us-defense-organizations/
[14:12:01] shevy: you are poking fun at java ddv!
[14:12:05] chouhoulis: has joined #ruby
[14:12:10] Igorshp: has joined #ruby
[14:12:15] apeiros: yorickpeterse: nice. thanks. now on to figure out how to tell the xmlns???
[14:12:23] adaedra: you would prefer that we poke fun at you, shevy ?
[14:12:40] ddv: apeiros: didnt work huh?
[14:12:41] [k-_: https://gist.github.com/SkyBirdSoar/2d1267be7661d1ee0803
[14:12:51] apeiros: ddv: hm? it did work
[14:12:55] ddv: apeiros: ohohoh
[14:13:00] yorickpeterse: apeiros: you just smack it in front of the name
[14:13:02] [k-_: adaedra: you are being awful :(
[14:13:04] apeiros: but my real example has namespaces, so I have to figure out how to properly use them in the xpath
[14:13:11] yorickpeterse: e.g. for "<foo:bar />" that would be "foo:bar"
[14:13:13] adaedra: [k-_: I am?
[14:13:21] yorickpeterse: assuming the xmlns is registered
[14:13:22] apeiros: yorickpeterse: ah, k. in CSS it's | not :
[14:13:27] apeiros: (and I only remembered it was different)
[14:13:51] fabrice31: has joined #ruby
[14:13:59] adaedra: [k-_: what did I do again?
[14:14:14] dopie: has joined #ruby
[14:14:29] neanias: What didn't you do?
[14:14:36] fgo: has joined #ruby
[14:15:01] [k-_: 22:12:22 adaedra: you would prefer that we poke fun at you, shevy ?
[14:15:05] ddv: apeiros: i'm always screwing around with namespaces and nokogiri
[14:15:23] adaedra: neanias: coding in java. I never coded in Java.
[14:15:34] neanias: adaedra: probably for the best
[14:15:36] vyorkin1: has joined #ruby
[14:15:44] lavros: has joined #ruby
[14:15:55] adaedra: [k-_: it was an honest proposition.
[14:16:13] [k-_: therefore, awful
[14:16:18] neanias: [k-_: that gist is giving me headaches
[14:16:20] [k-_: awful as in mean
[14:16:30] [k-_: neanias: :>
[14:16:32] adaedra: right [k-_, let's say I'm awful.
[14:16:38] pfish: has joined #ruby
[14:16:48] shevy: don't poke me
[14:16:54] apeiros: ddv: you just have to pass them in on .css/.xpath
[14:16:57] aderium: is there a way to tell gem install which compiler to use ?
[14:17:02] adaedra: ACTION pokes shevy with [k-_
[14:17:10] aderium: I am down to one gem that will not compile
[14:17:13] apeiros: e.g. .css("ns|tag", "ns" => "fully qualified namespace")
[14:17:26] ddv: apeiros: I once had a xml file littered with dozens of namespaces
[14:17:31] pfish: is there a single c function that called when an object is edited?
[14:17:36] [k-_: if you are mean you should stop :c
[14:17:38] ddv: apeiros: and I registered all namespaces but still it wouldn't work
[14:17:39] shevy: Aderium hmm I think there is a way, but remember, you can always extract a .gem and enter the directory and then manually compile or modify anything there
[14:17:42] yorickpeterse: well sent these peeps an Email, lets see how they respond to my "can we do 30k on average with a burst of 100k and oh we also need 10 million initially" Email
[14:17:50] shevy: Aderium what gem is it?
[14:17:57] yorickpeterse: because I cbf writing city/country matchers myself
[14:17:58] aderium: Its one we have created
[14:18:14] adaedra: [k-_: okay, I'll stop being what you call mean and be what I call evil, is that ok? >:]
[14:18:19] aderium: I cloned it locally but it seems to always call cc instead of gcc during gem install
[14:18:25] shevy: http://stackoverflow.com/questions/4554837/how-to-specify-compiler-for-gem-install
[14:18:28] mos: has joined #ruby
[14:18:31] shevy: RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
[14:18:33] shevy: can that work?
[14:18:36] [k-_: as long as you are not mean
[14:18:37] RegulationD: has joined #ruby
[14:18:40] shevy: probably some settings in RbConfig altogether
[14:19:23] peter_paule: has joined #ruby
[14:19:25] aderium: do I need to irb gor that ?
[14:19:35] aderium: or just go to RbConfig file ?
[14:19:44] [k-_: i need to collect sentiments, eg what i should add (common practices of people) so my library wont cause them too much boilerplate
[14:20:25] eggoez: has joined #ruby
[14:20:35] shevy: Aderium hmm the above is ruby code
[14:20:57] shevy: Aderium there should be an extconf.rb yes?
[14:21:16] shevy: I actually never wrote a .gem that requires compiling C code
[14:21:22] aderium: let me check
[14:21:40] shevy: you should be able to check for lots of things... have a head ... have_header('linux/inotify.h')
[14:22:30] aderium: should I add something there ?
[14:22:33] aderium: I have require 'mkmf'
[14:22:34] aderium: create_makefile("dirscanner_ext/dirscanner_ext")
[14:22:39] SylarRuby: has joined #ruby
[14:23:28] shevy: hmm not entirely sure how they use it
[14:23:38] shevy: problem is I also don't know how to compile on solaris sorry
[14:23:56] evanjs: has joined #ruby
[14:24:59] havenwood: has joined #ruby
[14:25:04] [k-_: im sure shevy has learnt to ignore my code
[14:25:18] [k-_: shevy, there is a nicer translation of the code at the end!
[14:25:21] ddv: not just your code, [k-_
[14:26:16] [k-_: and what?
[14:26:43] [k-_: there is errata in square_root and cube_root. Should be (1/2r) and (1/3r)
[14:26:53] kies^: has joined #ruby
[14:27:05] eggoez: has joined #ruby
[14:27:51] shevy: [k-_ I still don't quite understand how you manage to surpass Ox0dea
[14:27:58] [k-_: i also used and, thats a first
[14:28:03] [k-_: i needed the lower precendence
[14:28:27] [k-_: i didnt surpass him, he wrote concise non-alphanum code
[14:28:30] shevy: Aderium oh that reminds me. if you have a autogenerated Makefile, can you not just modify the part where it grabs the C compiler?
[14:28:42] aderium: we use cmake
[14:28:48] [k-_: i write ugly and unconcise mostly non-alphanum code
[14:28:51] aderium: not sure how to tell cmake to use gcc
[14:29:15] Hobbyboy: has joined #ruby
[14:29:43] jonathanwallace: has joined #ruby
[14:30:11] t0rrieri__: has joined #ruby
[14:30:45] JMoir: I'm reading some code and I came across this: @now = session || Hash.new Am I right in thinking that this line sets @now to session if it is set, but if it is nil or false, it creates a new Hash?
[14:30:46] jimmythehat: jhass no its still undefined
[14:30:48] DaniG2k: has joined #ruby
[14:30:51] startupality: has joined #ruby
[14:30:52] iooner: has joined #ruby
[14:31:02] dudedudeman: has joined #ruby
[14:31:10] jhass: jimmythehat: paste some actual code and the error output
[14:31:23] ljarvis: JMoir: yes
[14:31:31] dudedudeman: has joined #ruby
[14:31:46] JMoir: ljarvis: Thank you! I just wanted to check, I've never seen it before
[14:31:49] vyorkin1: has joined #ruby
[14:31:50] jimmythehat: its not a method on the original string but a method on a different string. The inblock variable 'letter' is a new string for each loop (I think). It becomes a new string containing one letter of the original string
[14:31:54] aderium: https://gist.github.com/CirrusThink/6b60669bb2df87a54926
[14:32:17] Xiti: has joined #ruby
[14:34:03] iooner: has joined #ruby
[14:34:17] LMity: has joined #ruby
[14:34:23] _blizzy_: has joined #ruby
[14:35:59] Frem: has joined #ruby
[14:36:20] theery: has joined #ruby
[14:36:25] eGGsha: has joined #ruby
[14:36:29] werelivinginthef: has joined #ruby
[14:36:51] presto: has joined #ruby
[14:37:11] lapide_viridi: has joined #ruby
[14:37:28] rsty1: has joined #ruby
[14:38:03] decoponio: has joined #ruby
[14:38:24] sharpmachine: has joined #ruby
[14:39:50] aderium: ok adding extconf the ruby config worked
[14:41:01] aderium: yone knows this error ? gcc: error: unrecognized command line option ???-KPIC???
[14:41:06] rsty1: a JSON object that has many sets of {:notes=>"value", :key=>"value", :value=>"value}... how would i display the :value value, when :keys value = "ExpectedKey"
[14:41:14] shevy: Aderium I only know of -fPIC
[14:41:30] jhass: rsty1: you mean an array of hashes or?
[14:41:43] rsty1: i have JSON output
[14:41:44] Zamyatin: has joined #ruby
[14:41:45] [k-_: shevy: quick, throw me something easy to write in ruby (eg Run-length encoder)
[14:41:48] theery: has joined #ruby
[14:41:49] _blizzy_: has joined #ruby
[14:41:54] jhass: rsty1: no, what you posted is the inspect of a hash
[14:41:56] rsty1: and i have an object called :custom_fields, with the above 3 values in each
[14:42:04] jhass: ?code rsty1
[14:42:04] ruboto: rsty1, We can't help you without your code, please post it to https://gist.github.com
[14:42:35] Dreamer3: has joined #ruby
[14:42:44] shevy: [k-_ a random word insulter
[14:43:26] pietr0: has joined #ruby
[14:43:42] [k-_: no that would be too easy
[14:43:54] tkuchiki: has joined #ruby
[14:43:56] [k-_: something around the difficulty of rle
[14:43:58] mary5030: has joined #ruby
[14:44:18] felixr: has joined #ruby
[14:45:06] rsty1: jhass: http://pastebin.com/C6vNxhL2
[14:45:07] ruboto: rsty1, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/4d4a9e3d76bd8ea229b2
[14:45:07] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[14:45:10] rsty1: that is whta object looks like
[14:45:35] jhass: rsty1: that is an array of hashes, the answer to my question is yes
[14:46:05] rsty1: how would i return the color, which is purple in that example
[14:46:11] jhass: json_c[:custom_fields].find {|field| field[:key] == "ExpectedKey" }[:value]
[14:46:21] jhass: json_c[:custom_fields].find {|field| field[:key] == "Color" }[:value]
[14:46:26] rsty1: ahh, awesome!
[14:46:28] pabs: has joined #ruby
[14:46:34] ljarvis: better yet build your own objects from that hash
[14:46:57] aspiers: has joined #ruby
[14:47:19] ljarvis: tune in for more unscalable tips and tricks
[14:47:45] jhass: or at least .map {|field| [field[:key], field] }.to_h
[14:47:52] apeiros: adding ?jsonobject next???
[14:47:55] MagePsycho_: has joined #ruby
[14:47:59] rippa: has joined #ruby
[14:48:01] jhass: yes please
[14:48:57] apeiros: !fact add jsonobject there is no such thing as a JSON object. You either have a String containing serialized JSON, or you have ruby objects (usually Hashes/Arrays/Strings). Which is it?
[14:48:58] ruboto: apeiros, I will remember that jsonobject is there is no such thing as a JSON object. You either have a String containing serialized JSON, or you have ruby objects (usually Hashes/Arrays/Strings). Which is it?
[14:49:03] apeiros: good to go?
[14:49:04] [k-_: wait, he wants the key and the hash?
[14:50:00] TomyWork: has joined #ruby
[14:50:06] rsty1: thank you all, i have a solution now :)
[14:50:11] symm-: has joined #ruby
[14:50:13] apeiros: ACTION still ponders creating a JsonObject gem which would provide XML DOM like access to json data :D
[14:50:25] TomyWork: how can i pass a {} block on to another function?
[14:50:32] ljarvis: apeiros: jpath!
[14:50:39] jhass: TomyWork: def foo(&block) other(&block)
[14:50:52] jhass: TomyWork: where block is an arbitrary name
[14:50:58] tmtwd: has joined #ruby
[14:51:16] TomyWork: i'll stick with block though :)
[14:51:26] msnyon: has joined #ruby
[14:51:36] TomyWork: i tried various variations of that, but &block on both ends i didnt try
[14:52:15] dudo: has joined #ruby
[14:53:55] jottr: has joined #ruby
[14:53:56] mdarby: has joined #ruby
[14:54:00] mary5030: has joined #ruby
[14:54:39] agent_white: has joined #ruby
[14:55:28] davedev24: has joined #ruby
[14:56:26] bruno-: has joined #ruby
[14:57:32] presto: has joined #ruby
[14:58:02] presto: has joined #ruby
[14:58:10] sharpmachine: has joined #ruby
[14:58:51] sarkyniin: has joined #ruby
[14:59:45] programmerq: has joined #ruby
[14:59:54] gwendall: has joined #ruby
[14:59:54] fullofcaffeine: has joined #ruby
[15:00:42] mary5030: has joined #ruby
[15:00:45] charliesome: has joined #ruby
[15:02:06] Aswebb_: has joined #ruby
[15:02:14] presto: has joined #ruby
[15:04:26] snockerton: has joined #ruby
[15:04:52] symbol: has joined #ruby
[15:06:44] theery: has joined #ruby
[15:06:50] Mojo_Nixon: has joined #ruby
[15:07:29] swills: has joined #ruby
[15:08:36] IanV0rn2341: has joined #ruby
[15:10:44] gamename: has joined #ruby
[15:10:54] [k-_: http://www.codewars.com/kata/playing-with-passphrases
[15:11:08] [k-_: im going to do this with my library, :>
[15:12:48] dgutierrez1287: has joined #ruby
[15:13:14] dhjondoh: has joined #ruby
[15:13:17] startupality: has joined #ruby
[15:13:48] werelivinginthef: has joined #ruby
[15:14:22] gambl0re: has joined #ruby
[15:14:24] noobda: has joined #ruby
[15:14:54] ItSANgo: has joined #ruby
[15:15:39] noobda: Hi guys! So I read a POST request to a website, from the Chrome's network tab. How to replicate it and send using Ruby?
[15:15:54] jottr_: has joined #ruby
[15:16:24] jhass: by using a http client, the one shipped with ruby is called net/http
[15:17:08] noobda: postData = Net::HTTP.post_form(URI.parse(uriAdd), {'i' => 100})
[15:17:15] noobda: this is what I'm trying... but doesn't work
[15:17:28] jhass: did you try turning it off and on again?
[15:17:38] aalhamad: has joined #ruby
[15:17:59] jhass: (that's my default response to "doesn't work")
[15:18:10] noobda: Okay how do I include the request header? it's looking confusing....
[15:18:46] neanias: This is why I normally use httparty...
[15:18:53] jhass: you can't via the post_form method, you'll have to use one of the longer examples or a different client library
[15:19:32] jhass: neanias: I hate that include HTTParty recommendation though
[15:19:49] neanias: I normally just do HTTParty.blah
[15:20:14] noobda: http://pastebin.com/uQ9yjTC2 this is the header....
[15:20:15] ruboto: noobda, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/4f81f87fb8d3d4f10b53
[15:20:15] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[15:20:19] ljarvis: but it gives you a false sense of encapsulation!
[15:20:27] pfish: has joined #ruby
[15:20:38] strixd: has joined #ruby
[15:20:45] pfish: is there a c function that is used to set the value of an object?
[15:21:00] noobda: https://gist.github.com/anonymous/4f81f87fb8d3d4f10b53 here is the header....
[15:21:02] aalhamad: has left #ruby: ()
[15:21:18] jpfuentes2: has joined #ruby
[15:21:48] jhass: noobda: won't change my answer
[15:21:54] shevy: pfish everything in ruby is C behind the scene isn't it :D
[15:22:10] ljarvis: ?context pfish
[15:22:10] ruboto: pfish, 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.
[15:22:24] shevy: to set a hash, one would use rb_hash_aset()
[15:22:26] noobda: know any good client library that I can check out?
[15:23:02] CatMartyn: has joined #ruby
[15:23:03] adaedra: neanias told you about httpparty, I usually use curb, there are others, check ruby-toolbox
[15:23:05] jhass: noobda: http looks pretty neat, faraday hasn't failed on me either
[15:23:20] neanias: I didn't like that curb needed to step out of ruby
[15:23:31] noobda: okay thanks!!
[15:23:37] havenwood: neanias: just libcurl
[15:23:47] neanias: True, but HTTParty is all ruby
[15:23:47] havenwood: neanias: HTTPClient and Excon are two more pure-Ruby honorable mentions.
[15:23:53] neanias: And wraps Net::HTTP
[15:24:00] havenwood: neanias: It's actually a wrapper around Net::, yeah
[15:24:06] neanias: Close enough
[15:24:19] havenwood: neanias: Not so for HTTPClient and Excon
[15:24:21] jespada: has joined #ruby
[15:24:28] neanias: Are they independent solutions?
[15:24:42] havenwood: neanias: If you might want to switch your adapter, Faraday. I do like HTTP's chaining syntax personally.
[15:24:53] ljarvis: faraday is http.rb are my favs too
[15:24:58] ledestin: has joined #ruby
[15:25:01] neanias: I don't use Faraday
[15:25:06] neanias: I just use HTTParty
[15:25:16] treehug88: has joined #ruby
[15:25:18] JakFrist: has joined #ruby
[15:25:21] adaedra: When you HTTPParty, you must party hard!
[15:25:23] havenwood: neanias: Maybe give HTTP.rb a try.
[15:25:29] havenwood: If the partying gets to be too much.
[15:25:31] neanias: Might have a look
[15:25:36] arup_r: has joined #ruby
[15:25:49] Soda: has joined #ruby
[15:25:50] gizmore: has joined #ruby
[15:26:42] a346: has joined #ruby
[15:26:58] neanias: havenwood: looks p nice
[15:28:17] NeverDie: has joined #ruby
[15:28:45] rcvalle: has joined #ruby
[15:29:33] baweaver: has joined #ruby
[15:29:41] Cache_Money: has joined #ruby
[15:29:41] Pathfinder_: has joined #ruby
[15:30:19] Scripore: has joined #ruby
[15:30:20] NeverDie: has joined #ruby
[15:31:24] LJT: has joined #ruby
[15:31:38] lessless: has joined #ruby
[15:32:29] apeiros: hm, didn't I ask today "debugging??? how does it work?"? and right now this: http://www.rubyflow.com/p/j0j7lf-debugging-ruby-5-tips-to-help-you-fix-your-code
[15:32:41] apeiros: somebody is spying on me!
[15:33:23] icebourg: has joined #ruby
[15:34:28] wprice: has joined #ruby
[15:35:00] sdothum: has joined #ruby
[15:36:30] gwendall: has joined #ruby
[15:37:00] angelixd: has joined #ruby
[15:37:00] thang: has joined #ruby
[15:37:00] Ray`: has joined #ruby
[15:37:00] tommylommykins: has joined #ruby
[15:37:00] AustinMatherne: has joined #ruby
[15:37:01] SirCmpwn: has joined #ruby
[15:37:03] sdothum: has joined #ruby
[15:37:04] bhorn1: has joined #ruby
[15:37:04] olblak: has joined #ruby
[15:37:05] nomadic: has joined #ruby
[15:37:05] ex0ns: has joined #ruby
[15:37:05] cgrieger^away: has joined #ruby
[15:37:05] theahindle: has joined #ruby
[15:37:05] cout: has joined #ruby
[15:37:05] Biohazard: has joined #ruby
[15:37:05] pingveno: has joined #ruby
[15:37:06] queequeg1: has joined #ruby
[15:37:06] swistak35: has joined #ruby
[15:37:06] ptierno: has joined #ruby
[15:37:06] madhatter: has joined #ruby
[15:37:06] mosez: has joined #ruby
[15:37:06] skyjumper: has joined #ruby
[15:37:06] Nowaker: has joined #ruby
[15:37:06] DefV: has joined #ruby
[15:37:06] aninaki: has joined #ruby
[15:37:06] dostoyevsky: has joined #ruby
[15:37:07] Sp4rKy: has joined #ruby
[15:37:07] sash_: has joined #ruby
[15:37:07] raenk: has joined #ruby
[15:37:08] skakri: has joined #ruby
[15:37:09] ankhers: has joined #ruby
[15:37:10] flori: has joined #ruby
[15:37:10] nirix: has joined #ruby
[15:37:11] annihila1nic: has joined #ruby
[15:37:11] benatkin: has joined #ruby
[15:37:11] cappsio: has joined #ruby
[15:37:11] ebarrett: has joined #ruby
[15:37:12] quarcu: has joined #ruby
[15:37:12] exceion: has joined #ruby
[15:37:12] duckson: has joined #ruby
[15:37:13] ezra: has joined #ruby
[15:37:14] PierreRambaud: has joined #ruby
[15:37:14] redondos: has joined #ruby
[15:37:14] destructure: has joined #ruby
[15:37:14] redondos: has joined #ruby
[15:37:14] ssvss: has joined #ruby
[15:37:14] joevandyk: has joined #ruby
[15:37:15] ByronJohnson: has joined #ruby
[15:37:16] jzigmund: has joined #ruby
[15:37:17] jzigmund: has joined #ruby
[15:37:17] hectortrope: has joined #ruby
[15:37:18] mozzarella: has joined #ruby
[15:37:19] BiHi: has joined #ruby
[15:37:19] AccordLTN: has joined #ruby
[15:37:19] Senjai: has joined #ruby
[15:37:20] Dfoolz: has joined #ruby
[15:37:20] dhruvasagar: has joined #ruby
[15:37:22] yorickpeterse: has joined #ruby
[15:37:24] Kovensky: has joined #ruby
[15:37:24] finges: has joined #ruby
[15:37:24] preller_: has joined #ruby
[15:37:25] coffeeju1: has joined #ruby
[15:37:28] kitallis: has joined #ruby
[15:37:29] oddmunds: has joined #ruby
[15:37:31] AlexRussia: has joined #ruby
[15:37:32] ght: has joined #ruby
[15:37:33] moredhel: has joined #ruby
[15:37:33] Silex: has joined #ruby
[15:37:36] aytch: has joined #ruby
[15:37:38] diegok: has joined #ruby
[15:37:39] dabradley: has joined #ruby
[15:37:39] Riking: has joined #ruby
[15:37:39] njs126: has joined #ruby
[15:37:42] zonetti: has joined #ruby
[15:37:42] segv: has joined #ruby
[15:37:43] go|dfish: has joined #ruby
[15:37:55] maxmanders: has joined #ruby
[15:37:59] jeaye: has joined #ruby
[15:38:02] justinmcp: has joined #ruby
[15:38:03] eregon: has joined #ruby
[15:38:04] jxie: has joined #ruby
[15:38:06] Meeh: has joined #ruby
[15:38:06] deavid: has joined #ruby
[15:38:07] asi_: has joined #ruby
[15:38:07] apeiros: has joined #ruby
[15:38:12] icedp: has joined #ruby
[15:38:13] rindolf: has joined #ruby
[15:38:24] Esya-: has joined #ruby
[15:38:28] ujjain: has joined #ruby
[15:38:28] ujjain: has joined #ruby
[15:38:34] g3funk: has joined #ruby
[15:38:48] Adran: has joined #ruby
[15:38:49] [H]unt3r: has joined #ruby
[15:38:49] lguardiola: has joined #ruby
[15:39:06] Tristan-Speccy: has joined #ruby
[15:39:13] neanias: has joined #ruby
[15:39:18] sharpmachine: has joined #ruby
[15:40:25] sharpmac_: has joined #ruby
[15:40:35] riotjones: has joined #ruby
[15:40:49] jwaldrip: has joined #ruby
[15:41:29] TheMoonMaster: has joined #ruby
[15:41:40] sdothum: has joined #ruby
[15:42:16] t0rrieri__: has joined #ruby
[15:42:51] djbkd_: has joined #ruby
[15:42:51] zzak: has joined #ruby
[15:44:23] NeverDie: has joined #ruby
[15:44:23] Guest74302: has joined #ruby
[15:44:25] cardoni_: has joined #ruby
[15:45:08] Scrofff: has joined #ruby
[15:45:58] bruno-: has joined #ruby
[15:46:04] [k-_: awwwww submission timed out
[15:46:05] arup_r: has joined #ruby
[15:46:09] [k-_: looks like it takes too long
[15:46:21] [k-_: maybe i shouldn't obscure it
[15:46:31] amclain: has joined #ruby
[15:46:32] pietr0: has joined #ruby
[15:47:10] NeverDie: has joined #ruby
[15:47:14] apeiros: [k-_: you could apply at zenspider to maintain his ruby obfuscator
[15:47:15] [k-_: i think it was my connection, it works now :)
[15:47:16] sshuff: has joined #ruby
[15:47:17] Evans: has joined #ruby
[15:47:24] apeiros: seems you're accruing great knowledge for that :D
[15:47:25] [k-_: he has one?
[15:47:28] cpruitt: has joined #ruby
[15:47:30] apeiros: commercial even, yes
[15:47:33] [k-_: gimmegimme
[15:47:46] iamse7en: has joined #ruby
[15:47:50] varunwachaspati: has joined #ruby
[15:48:03] apeiros: aaahehe, not sure it still works: http://blog.zenspider.com/blog/2006/07/zenobfuscate-now-available.html
[15:48:18] iamse7en: I have a button that adds a filter: <%= link_to 'NFL', request.original_url + '&league[]=nfl', class: 'btn btn-default' %>, but how do I do the exact opposite, removing the filter or removes '&league[]=nfl' from the url?
[15:48:28] NeverDie: has joined #ruby
[15:48:33] apeiros: odd, I remembered it doing something else
[15:48:37] apeiros: maybe I'm confusing stuff again???
[15:48:47] apeiros: iamse7en: rails?
[15:48:52] neektza: has joined #ruby
[15:49:25] jhass: ?crosspost iamse7en
[15:49:25] ruboto: iamse7en, Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
[15:49:26] iamse7en: ok i'll check it out thanks
[15:49:26] apeiros: oh, crosspost and unresponsive. good riddance.
[15:49:29] allomov: has joined #ruby
[15:49:30] mroth: has joined #ruby
[15:49:33] apeiros: !kick iamse7en crosspost
[15:49:33] helpa: apeiros: No.
[15:49:34] ruboto: ruboto kicked iamse7en:
[15:49:34] ruboto: -o ruboto
[15:49:37] iamse7en: has joined #ruby
[15:49:39] [k-_: lel, that looks too complex for me
[15:49:43] iamse7en: has left #ruby: ("I'm out like a black kid in a spelling bee.")
[15:49:47] [k-_: i force people to write obfuscated code!
[15:50:14] frankS2: has joined #ruby
[15:50:14] fullofcaffeine: has joined #ruby
[15:50:26] Guest74302: has joined #ruby
[15:50:36] jimbeaudoin: has joined #ruby
[15:51:24] Marc_Aldrich: has joined #ruby
[15:51:53] Lloyd: has joined #ruby
[15:52:19] shinnya: has joined #ruby
[15:53:04] Kedare: has joined #ruby
[15:53:10] Marc_Aldrich: I've got a quick question about RubyInstaller: IRB is broken on setup, Ruby -v works. Path doesn't seem to be an issue. Win7-x64 machine. Anybody have a hint or advice on where to point my question?
[15:53:37] mary5030: has joined #ruby
[15:53:41] k3asd`: has joined #ruby
[15:53:58] jmcc: has joined #ruby
[15:54:00] Kedare: has joined #ruby
[15:54:32] niko: has joined #ruby
[15:54:43] dmoe: has joined #ruby
[15:54:49] mary5030: has joined #ruby
[15:55:04] rehat_: has joined #ruby
[15:55:16] havenwood: Marc_Aldrich: How is it broken?
[15:55:21] Kedare: has joined #ruby
[15:55:40] Marc_Aldrich: A cascading error: "rbreadline.rb:1097:in `<module:RbReadline>': HOME environment variable (or HOMEDRIVE and HOMEPATH)
[15:55:40] Marc_Aldrich: must be set and point to a directory (RuntimeError)"
[15:55:49] Marc_Aldrich: That is top error though
[15:56:05] Marc_Aldrich: Also thank you for your time
[15:56:08] bove: has joined #ruby
[15:56:10] cbetta: has joined #ruby
[15:56:18] shevy: try to set that var?
[15:57:16] Marc_Aldrich: I'm not entirely sure what var it wants to have set or where it want it to point. HOME is currently undefined. I could set it, just not sure what to point at and readme doesn't seem to list it
[15:57:22] im0b: has joined #ruby
[15:57:22] Guest85414______: has joined #ruby
[15:57:22] mleung: has joined #ruby
[15:57:24] Marc_Aldrich: ACTION is a Linux user stuck on windows for work
[15:58:12] quimrstorres: has joined #ruby
[15:58:41] shevy: well set it anyway to your home dir, perhaps it won't help but if it helps that would have solved that quite quickly
[15:58:47] shevy: I am also a Linux user :)
[15:58:58] Ilyas: has joined #ruby
[15:59:07] theery: has joined #ruby
[15:59:09] Marc_Aldrich: A fair recommendation. I'll give it a shot
[15:59:51] iamdevnul: has joined #ruby
[16:00:10] t0rrieri__: has joined #ruby
[16:00:24] Marc_Aldrich: Did not work when setting HOME or HOMEPATH to ruby install direction or ruby/lib
[16:00:33] yo61: has joined #ruby
[16:00:54] Antiarc: You probably want to set it to c:\Users\YourUsername
[16:00:56] Antiarc: or something like that
[16:01:04] neersighted: has joined #ruby
[16:01:47] snockerton: has joined #ruby
[16:02:07] Antiarc: Also if you're setting it via the env vars manager in advanced system settings, be sure to relaunch any command prompts so they'll pick up the change
[16:02:08] Marc_Aldrich: Thank you for the suggestion. Result-> Same error
[16:02:21] shevy: yeah let me look at that strange rbreadline.rb file ...
[16:02:48] shevy: btw on a sidenote, is Readline required on windows?
[16:02:48] Marc_Aldrich: Current procedure is using: setx HOME ..., then cmd, then irb
[16:02:53] lordkryss: has joined #ruby
[16:03:00] Marc_Aldrich: I added it with gem install rb-readline just in case
[16:03:15] Marc_Aldrich: But I honestly do not know.
[16:03:18] Agoldfish: has joined #ruby
[16:03:31] polpak: has joined #ruby
[16:03:42] shevy: when I installed ruby on my windows machine downstairs, it worked fine, irb too. I did not install readline though
[16:03:53] ggherdov: has joined #ruby
[16:04:04] shevy: guess it is this strange gem https://rubygems.org/gems/rb-readline
[16:04:04] Antiarc: (speaking as a windows user, if you can at all help it, avoid Ruby on Windows)
[16:04:25] Antiarc: Spin up a Linux VM and SSH into it/mount a samba share :P
[16:04:51] Marc_Aldrich: lol, the thought has crossed my mind
[16:05:13] Marc_Aldrich: Already have an overly complicated build system with multiple targets, tools and more
[16:05:19] blackmesa: has joined #ruby
[16:05:30] towski_: has joined #ruby
[16:05:30] Marc_Aldrich: The irony is that I only need ruby, because it is used heavily in the make system.
[16:05:33] IanV0rn2341: has joined #ruby
[16:06:04] Antiarc: If you aren't dependent specifically on MRI, you might consider jruby
[16:06:07] Antiarc: It tends to deploy well on Windows
[16:06:32] Antiarc: It starts up more slowly which would be a bummer in a make system with lots of Ru0by 0
[16:06:36] Antiarc: invocations
[16:06:40] Antiarc: sorry, toddler on lap hammering keys
[16:06:52] shevy: yeah yeah yeah
[16:06:53] Antiarc: But it should work without a ton of fiddling
[16:06:54] shevy: it was ALL YOU man :D
[16:07:04] sofija: has joined #ruby
[16:07:04] shevy: cat... toddles... earthquakes... we know those kind of excuses
[16:07:41] Antiarc: man typing while fending off a toddler who loves keyboards is IRC hardmode
[16:07:43] hololeap: has joined #ruby
[16:08:26] Marc_Aldrich: Pro tip: get a second keyboard and give it to the kid
[16:08:35] Marc_Aldrich: Has worked for me in the past
[16:08:41] MarkTurner: has joined #ruby
[16:08:51] shevy: all the dirty secrets get out to light now \o/
[16:09:22] yo61: has joined #ruby
[16:11:03] bricker: has joined #ruby
[16:11:14] revath: has joined #ruby
[16:11:25] zz_Outlastsheep: has joined #ruby
[16:12:08] niko: has joined #ruby
[16:12:29] Spami: has joined #ruby
[16:13:18] Marc_Aldrich: Thanks for the help gents! For the record, it seems simply arbitrary setting HOME made IRB happy along with the other tools.
[16:13:22] Rollabunna: has joined #ruby
[16:14:39] fabrice31: has joined #ruby
[16:15:08] simplyianm: has joined #ruby
[16:15:47] lampd1: has joined #ruby
[16:17:12] quimrstorres: has joined #ruby
[16:17:19] t0rrieri__: has joined #ruby
[16:20:06] mercwithamouth: has joined #ruby
[16:20:19] Torrieri: has joined #ruby
[16:20:19] Torrieri: has joined #ruby
[16:20:50] shevy: the simple way worked!
[16:21:01] quimrstorres: has joined #ruby
[16:21:14] shevy: now you can fully appreciate the power of the awesomeness that is windows
[16:21:26] CorySimmons: has joined #ruby
[16:22:01] adaedra: you can't associate awesomeness and windows like that
[16:22:33] pengin: has joined #ruby
[16:22:51] shevy: awindowsness
[16:22:55] shevy: awesomeness
[16:23:01] shevy: see! almost same amount of characters
[16:24:15] devbug: has joined #ruby
[16:24:16] werelivinginthef: has joined #ruby
[16:24:17] dfockler: has joined #ruby
[16:24:21] arup_r: In Ruby how can I get a unix timestamps from a DateTime object ?
[16:24:28] arup_r: any direct method ?
[16:24:51] adaedra: isn't it to_i?
[16:25:27] arup_r: didn't find such http://ruby-doc.org/stdlib-2.1.1/libdoc/date/rdoc/DateTime.html
[16:25:51] nfk: has joined #ruby
[16:26:10] cabreraM516: has joined #ruby
[16:26:55] douglasssss: has joined #ruby
[16:27:07] jhass: >> require "datetime"; DateTime.now.to_i
[16:27:08] ruboto: jhass # => cannot load such file -- datetime (LoadError) ...check link for more (https://eval.in/397918)
[16:27:16] jhass: >> require "date"; DateTime.now.to_i
[16:27:17] ruboto: jhass # => undefined method `to_i' for #<DateTime:0x42125498> (NoMethodError) ...check link for more (https://eval.in/397920)
[16:27:27] jhass: >> require "date"; DateTime.now.to_time.to_i
[16:27:28] ruboto: jhass # => 1436804848 (https://eval.in/397921)
[16:27:47] [Butch]: has joined #ruby
[16:28:27] aryaching: has joined #ruby
[16:28:35] rsty1: i thought it was just Time.new.to_i
[16:28:56] adaedra: arup_r asked from a DateTime
[16:29:01] RobertBirnie: has joined #ruby
[16:29:02] jhass: it is, if you're asking for the current
[16:29:48] lolmaus: has joined #ruby
[16:29:56] Notte: has joined #ruby
[16:29:58] dfockler: has joined #ruby
[16:30:10] luluapple: has joined #ruby
[16:30:11] DexterLB: has joined #ruby
[16:30:57] troulouliou_dev: has joined #ruby
[16:31:23] n008f4g_: has joined #ruby
[16:33:34] allomov: has joined #ruby
[16:33:35] Senjai: Good morning ruby
[16:33:36] lavros: has joined #ruby
[16:35:55] shevy: Good morning Vietjai!
[16:36:06] Igorshp: has joined #ruby
[16:36:37] dojobo: has joined #ruby
[16:36:51] dojobo: anyone have trouble getting cron and nokogiri to work together?
[16:36:58] jhass: nope, you're alone
[16:37:45] centrx: cron and nokogiri together? what?
[16:38:50] dojobo: yeah i've got a script that uses nokogiri to do some transformations on an rss feed and save it as a new file
[16:38:56] lavros: has joined #ruby
[16:39:12] dojobo: and i want to run it in cron so that it does it every few hours
[16:39:22] dojobo: (since the rss is continually updating of course)
[16:39:44] Alayde: has joined #ruby
[16:39:58] centrx: Good idea
[16:40:01] dojobo: i'm using rvm and i've done another script using the wrappers, so i don't think that's the problem
[16:41:00] solars: has joined #ruby
[16:41:03] dojobo: i'm getting the 'cannot load such file' error even though doing `rvm use 2.1.5` and `require 'nokogiri'` => true
[16:41:16] dojobo: (and i'm using the 2.1.5 wrapper obviously)
[16:41:27] arup_r: what should I do ?
[16:41:36] Senjai: dojobo: cron doesn't run as your user, or in your environment
[16:42:08] Senjai: You can use chruby, install rubies into a proper system wide folder, and use absolute paths to ruby in cron instead.
[16:42:19] Senjai: Or do something weird to get rvm to work system wide, which I can't remember
[16:43:38] dojobo: thanks Senjai, i'll look into this :)
[16:43:58] dojobo: i'm guessing having both rvm and chruby will cause problems?
[16:45:00] Senjai: No, but you should just get rid of rvm
[16:46:00] arup_r: jhass: little shorter http://stackoverflow.com/a/19754440/2767755
[16:46:05] arup_r: but thanks
[16:46:39] jhass: arup_r: not the same though
[16:46:46] Senjai: arup_r: No, just no
[16:46:50] Senjai: arup_r: Time.now.to_i
[16:46:54] jhass: arup_r: I mean, look at the votes
[16:47:03] Senjai: arup_r: That is just bad, don't do that
[16:47:51] arup_r: https://gist.github.com/aruprakshit/76758fb5613aef37e41b
[16:48:03] nofxx: has joined #ruby
[16:49:14] arup_r: ok.. Senjai which one is better? tell me I'll use that..
[16:49:29] Senjai: irb(main):001:0> Spree::Order.first.created_at.to_i
[16:49:32] Senjai: Spree::Order Load (0.4ms) SELECT "spree_orders".* FROM "spree_orders" ORDER BY "spree_orders"."id" ASC LIMIT 1
[16:49:33] Senjai: => 1436546329
[16:49:47] Senjai: arup_r: ^
[16:49:48] pengin: has joined #ruby
[16:50:04] HakN99: has joined #ruby
[16:51:28] Senjai: has joined #ruby
[16:51:32] bronson: has joined #ruby
[16:51:56] Senjai`work: has joined #ruby
[16:52:12] Senjai`work: has joined #ruby
[16:54:02] mary5030_: has joined #ruby
[16:54:48] mary5030: has joined #ruby
[16:57:42] towski_: has joined #ruby
[16:58:23] NeverDie: has joined #ruby
[16:59:04] alphaatom: has joined #ruby
[16:59:30] [k-_: i did it!
[16:59:31] PhantomSpank: has joined #ruby
[16:59:31] [k-_: http://www.codewars.com/kata/reviews/5595366bf4dd10a4b600001c/groups/55a3edfe73757a2a19000010
[16:59:31] fantazo: has joined #ruby
[16:59:41] baweaver: has joined #ruby
[16:59:47] niemcu: has joined #ruby
[17:00:38] acke: has joined #ruby
[17:01:17] NeverDie: has joined #ruby
[17:03:09] NeverDie: has joined #ruby
[17:03:15] MarkTurner: has joined #ruby
[17:03:33] quimrstorres: has joined #ruby
[17:03:41] fullofcaffeine: has joined #ruby
[17:04:04] luckyno7: has joined #ruby
[17:04:14] lavros_: has joined #ruby
[17:04:36] JimmyNeutron: has joined #ruby
[17:05:04] symm-: has joined #ruby
[17:06:20] eGGsha: has joined #ruby
[17:07:24] shevy: "You need to sign in or sign up before continuing."
[17:07:29] shevy: how can you [k-_ !
[17:07:37] charliesome: has joined #ruby
[17:07:59] [k-_: i need a ruby minifier :(
[17:09:51] Igorshp: has joined #ruby
[17:10:42] ascarter: has joined #ruby
[17:10:52] jhass: oh, let me downvote that
[17:10:56] lkba: has joined #ruby
[17:11:07] iateadonut: has left #ruby: ()
[17:11:53] lkba_: has joined #ruby
[17:13:15] _blizzy_: has joined #ruby
[17:15:26] simplyianm: has joined #ruby
[17:17:46] amargherio: has joined #ruby
[17:17:48] nettoweb: has joined #ruby
[17:18:09] [k-_: manual minification did not work so well....
[17:18:17] [k-_: you must upvote for cleverness!
[17:18:25] postmodern: has joined #ruby
[17:18:45] postmodern: has joined #ruby
[17:19:11] MatrixBridge: has joined #ruby
[17:19:55] [k-_: ok minified
[17:19:57] jpfuente_: has joined #ruby
[17:20:25] mrconfused: has joined #ruby
[17:20:36] shevy: ACTION downvotes [k-_ 
[17:20:51] MatrixBridge: has joined #ruby
[17:21:02] Senjai: ACTION downvotes whatever shevy downvoted
[17:21:35] [k-_: https://gist.github.com/SkyBirdSoar/2d1267be7661d1ee0803
[17:22:06] [k-_: the very last one is the one you want to read
[17:22:09] Senjai: [k-_: BSD License man...
[17:22:13] [k-_: wait, let me change the order
[17:22:31] [k-_: why do you favour BSD over Apache
[17:22:42] mercwithamouth: has joined #ruby
[17:24:03] shevy: from this day on
[17:24:05] Jackneill_: has joined #ruby
[17:24:18] shevy: you are the most obfuscating rubyist here [k-_
[17:24:22] [k-_: notice how $-o={};->{;_m works
[17:24:23] shevy: much more than hanmac and Ox0dea combined
[17:24:35] shevy: $? = {} # The root of all evil
[17:24:40] JakFrist: has joined #ruby
[17:24:41] shevy: what is this
[17:24:51] jottr_: has joined #ruby
[17:24:56] [k-_: the thing that causes obfuscation to be possible!
[17:25:07] shevy: why is ? even legal
[17:25:20] shevy: -> { # No Namespace Pollution
[17:25:22] shevy: and no surprise
[17:25:26] shevy: here is my old nemesis the ->
[17:25:33] Senjai: [k-_: You're labors only make lives terrible for open source purists :P
[17:25:39] Senjai: how2grammer
[17:25:47] roolo: has joined #ruby
[17:26:39] nfk: has joined #ruby
[17:27:16] sharpmachine: has joined #ruby
[17:27:36] [k-_: no one will actually use it ;-;
[17:27:43] [k-_: it is too difficult to learn and code in
[17:28:11] dfockler: until we get pure emoji keyboards
[17:28:17] [k-_: shevy: if you can read the minified example, you are an expert
[17:28:25] [k-_: a true expert
[17:29:10] [k-_: anyone who does that is a true expert!
[17:29:27] jmhmccr: has joined #ruby
[17:29:32] aderium: https://gist.github.com/CirrusThink/0fb76d1649d6b91284bb
[17:29:44] aryaching: has joined #ruby
[17:30:00] [k-_: im going to bed now after a fruitful day :)
[17:30:01] aderium: and https://gist.github.com/CirrusThink/b0fce5dfcc45851a39db
[17:31:06] alphaatom: has joined #ruby
[17:31:08] vdamewood: has joined #ruby
[17:33:52] jimmythehat: has joined #ruby
[17:34:29] presto: has joined #ruby
[17:35:40] Maletor: has joined #ruby
[17:36:14] Spami: has joined #ruby
[17:37:25] MagePsycho_: has joined #ruby
[17:37:26] fantazo: has joined #ruby
[17:37:49] yokel: has joined #ruby
[17:38:05] Scrofff: has joined #ruby
[17:39:30] quimrstorres: has joined #ruby
[17:39:59] zacstewart: has joined #ruby
[17:40:22] Rollabunna: has joined #ruby
[17:40:51] sdothum: has joined #ruby
[17:40:57] Rollabun_: has joined #ruby
[17:41:20] Spami: has joined #ruby
[17:41:41] Rollabunna: has joined #ruby
[17:41:57] dopie: has joined #ruby
[17:42:35] txdv: has joined #ruby
[17:42:50] Rollabun_: has joined #ruby
[17:43:57] werelivinginthef: has joined #ruby
[17:48:25] blaines: has joined #ruby
[17:48:51] BTRE: has joined #ruby
[17:48:52] _djbkd: has joined #ruby
[17:50:25] quimrstorres: has joined #ruby
[17:50:51] aderium: I have a lot of docs to write .....
[17:51:11] podman: has joined #ruby
[17:51:18] Mojo_Nixon: has joined #ruby
[17:51:30] dling`: has joined #ruby
[17:51:48] Pathfinder: has joined #ruby
[17:52:31] arup_r: Is this the correct approach of writing own custom exceptions ? https://gist.github.com/aruprakshit/99a0a085f77c9936df20#file-error-rb-L3 Or there is better ideas of doing it ?
[17:53:02] sonOfRa: has joined #ruby
[17:56:02] allcentury: has joined #ruby
[17:57:30] sarkyniin: has joined #ruby
[17:57:31] dfockler: arup_r: when you raise an error you can just pass a message to it
[17:58:07] peter_paule: has joined #ruby
[17:58:49] arup_r: In the line where am I raising... if I pass message it is becoming a long like.. so I push it there.. But I was not sure about my idea,,, thus asked
[17:59:49] lkba: has joined #ruby
[17:59:54] MarkTurner: has joined #ruby
[18:00:29] dfockler: You probably want to make each type of error you throw subclass from Standard error then you can raise it like
[18:00:35] arup_r: I deleted the gist by mistake.. here is the one again https://gist.github.com/aruprakshit/a00bb03f6d8b217dcd27
[18:00:49] yardenbar: has joined #ruby
[18:00:54] dfockler: raise NoPostDataError, "There was no data to post"
[18:00:55] malconis_: has joined #ruby
[18:01:50] dfockler: or raise ConnectionFailureError, "Failed to make connection"
[18:02:28] dfockler: for the most part they can just subclass StandardError unless you need custom behavior
[18:02:49] bungoman: has joined #ruby
[18:02:53] yfeldblum: has joined #ruby
[18:04:10] toretore: has joined #ruby
[18:04:17] jerius_: has joined #ruby
[18:04:17] dfockler: and you don't really even need to subclass if you just want to display a message like how you had it
[18:04:31] tomphp: has joined #ruby
[18:04:35] dfockler: just raise "Simple error here"
[18:04:46] genpaku: has joined #ruby
[18:04:48] quimrstorres: has joined #ruby
[18:04:50] _djbkd: has joined #ruby
[18:05:19] _djbkd: has joined #ruby
[18:05:36] arup_r: No.. I Need to do subclass because, I'll rescue those from my different controller and redirec to different urls as per the exceptions..
[18:05:58] veduardo_: has joined #ruby
[18:06:01] dfockler: arup_r: yeah if you want to catch those error types then you'll want to give them a class
[18:06:04] arup_r: that's why I am buliding custom exception classes
[18:06:19] arup_r: shevy: I am still porting :p
[18:08:20] adaedra: You could also, in your subclass, set the message there
[18:08:48] mary5030: has joined #ruby
[18:09:52] sp4rrow: has joined #ruby
[18:10:24] mary5030: has joined #ruby
[18:10:24] jhack: has joined #ruby
[18:10:24] arup_r: adaedra: didn't get you
[18:10:57] Axsuul: has joined #ruby
[18:11:31] reset: has joined #ruby
[18:11:40] werelivinginthef: has joined #ruby
[18:12:35] jottr_: has joined #ruby
[18:13:00] dgutierrez1287: has joined #ruby
[18:13:28] bronson: has joined #ruby
[18:14:39] aaeron: has joined #ruby
[18:14:52] Aswebb__: has joined #ruby
[18:15:30] fabrice31: has joined #ruby
[18:15:33] jobewan: has joined #ruby
[18:16:29] bklane: has joined #ruby
[18:18:28] dfockler: arup_r: when you subclass you can set the message in the class definition so you don't have to write the same message everytime
[18:20:17] HakN99: has joined #ruby
[18:21:07] s00pcan: has joined #ruby
[18:21:16] _djbkd: has joined #ruby
[18:22:50] aaeron: has joined #ruby
[18:24:25] mbeasley: has joined #ruby
[18:24:31] evanjs: has joined #ruby
[18:24:47] mbeasley: has left #ruby: ()
[18:25:19] bungoman: has joined #ruby
[18:25:59] saadq: has joined #ruby
[18:27:21] guest000014: has joined #ruby
[18:27:26] danzilio: has joined #ruby
[18:28:11] simplyianm: has joined #ruby
[18:28:36] tomphp: has joined #ruby
[18:29:40] marr: has joined #ruby
[18:29:41] zacstewart: has joined #ruby
[18:29:54] DLSteve: has joined #ruby
[18:30:07] riotjones: has joined #ruby
[18:30:30] kadoppe: has joined #ruby
[18:31:03] guest000014: Good day. I have some simple code in Ruby stored on web. Is there a way to use it offline, if I have only a flash-driver? Would you recommend me to use some addon for portable google-chome or find a portable compiler?
[18:31:20] aaeron: has joined #ruby
[18:31:30] Xaitec: has joined #ruby
[18:31:40] jhass: "stored in the web"? what does that even mean?
[18:31:55] vickleton: has joined #ruby
[18:32:48] ruboto: I don't know anything about pastebin
[18:32:53] simplyianm: has joined #ruby
[18:33:05] jhass: ?gist jimmythehat
[18:33:05] ruboto: jimmythehat, https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[18:33:13] guest000014: compileonline, codepad. But they compile only with internet
[18:33:17] jimmythehat: jhass haha thats it thanks
[18:33:33] jhass: guest000014: install ruby?
[18:33:35] _djbkd: has joined #ruby
[18:34:16] jhass: guest000014: https://www.ruby-lang.org/en/documentation/installation/
[18:34:21] presto: has joined #ruby
[18:34:23] guest000014: Is there a portable compilier? Which would you recommend?
[18:34:26] casadei_: has joined #ruby
[18:34:41] jhass: guest000014: see my link
[18:34:54] luriv: has joined #ruby
[18:35:03] baweaver: has joined #ruby
[18:35:23] bklane: has joined #ruby
[18:37:05] vickleton_: has joined #ruby
[18:37:37] spider-mario: has joined #ruby
[18:37:48] mrconfused_: has joined #ruby
[18:38:20] dudedudeman: when setting an instance variable to @variable = Class.new, do you have to call .new on it? or can you just go @variable = Class
[18:38:22] gix: has joined #ruby
[18:39:24] Soda: has joined #ruby
[18:40:24] jhass: dudedudeman: you can do both and they do rather different things
[18:40:38] jhass: class Foo is basically Foo = Class.new
[18:40:42] radialneon: has joined #ruby
[18:40:48] djbkd_: has joined #ruby
[18:41:24] jhass: so Class is just a class too, or in other words a constant that has an instance of the class Class assigned
[18:42:45] bklane: has joined #ruby
[18:44:49] fantazo: has joined #ruby
[18:44:55] thiagovsk: has joined #ruby
[18:45:02] nfk: has joined #ruby
[18:46:04] arup_r: dfockler: You mean using `@message = '...some messages..'` inside the initialize ?
[18:46:11] dfockler: arup_r: yeah
[18:46:28] cabreraM516: has joined #ruby
[18:46:36] pietr0: has joined #ruby
[18:46:46] Violent: has joined #ruby
[18:47:51] tcrypt: has joined #ruby
[18:48:04] Eiam: has joined #ruby
[18:50:56] poguez_: has joined #ruby
[18:51:26] m8: has joined #ruby
[18:51:33] olistik: has joined #ruby
[18:52:33] guest000014: has left #ruby: ()
[18:52:36] jenrzzz: has joined #ruby
[18:52:40] felltir: has joined #ruby
[18:52:54] Tritone: has joined #ruby
[18:53:24] blaines: has joined #ruby
[18:54:18] NeverDie: has joined #ruby
[18:55:33] davedev24: has joined #ruby
[18:55:55] jackjackdripper: has joined #ruby
[18:57:36] sypheren: has joined #ruby
[18:58:13] ivanf: has joined #ruby
[18:59:11] bklane: has joined #ruby
[18:59:24] werelivinginthef: has joined #ruby
[19:00:43] Violentr: has joined #ruby
[19:03:05] NeverDie: has joined #ruby
[19:03:06] kirun: has joined #ruby
[19:03:13] radialneon: has joined #ruby
[19:04:46] dblessing: has joined #ruby
[19:05:48] a346: has joined #ruby
[19:06:28] dudedudeman: jhass: thank you
[19:07:18] arup_r: Ruby is cute........... I like it very much, :)
[19:07:40] pullphinger: has joined #ruby
[19:08:05] pullphinger: has joined #ruby
[19:08:53] loc22: has joined #ruby
[19:11:32] ght: Question: With a Ruby date object, when calling mydate.month, if the month is < 10, it prints with a single digit, as in month 7 is simply 7, instead of 07.
[19:11:50] ght: Without having to convert it to an integer and check if it's less than 10, then add a leading zero as a string, is there any way
[19:12:01] ght: to get date objects to return .month or .day with leading zeros?
[19:12:08] ght: I've been reading the documentation and haven't seen anything.
[19:12:17] ght: Just curious if anyone here knew.
[19:12:33] jhass: ght: your problem is representation
[19:12:44] davedev24: has joined #ruby
[19:13:00] dagda1: has joined #ruby
[19:13:05] jhass: 07 and 7 is the same number, the same Fixnum (Integer) object
[19:13:14] loc22: ght: Use strftime to print them
[19:13:15] jhass: you care about its String representation though
[19:13:21] ght: loc22: Thank you
[19:13:23] jottr_: has joined #ruby
[19:13:25] jhass: so yeah ^, use strftime
[19:13:43] loc22: ght: You are welcome
[19:14:09] jhass: it helps to get clear on what representation and what value is though
[19:15:02] radialneon: has joined #ruby
[19:15:51] Torrieri: has joined #ruby
[19:15:51] Torrieri: has joined #ruby
[19:16:05] Aswebb_: has joined #ruby
[19:16:59] bklane: has joined #ruby
[19:19:14] RandyT: has joined #ruby
[19:19:46] syraxes: has joined #ruby
[19:20:24] ledestin: has joined #ruby
[19:22:12] werelivinginthef: has joined #ruby
[19:22:26] jaycee: has joined #ruby
[19:22:44] keen__________18: has joined #ruby
[19:23:41] schov: has joined #ruby
[19:23:53] jerius: has joined #ruby
[19:24:07] curses: has joined #ruby
[19:24:08] jpfuentes2: has joined #ruby
[19:24:30] syraxes: has left #ruby: ("Leaving")
[19:24:51] arup_: has joined #ruby
[19:25:48] Senjai: Who wants to see scary code
[19:25:49] Senjai: https://gist.github.com/Senjai/6a2b359ca7aa3463954d#file-gistfile1-txt-L4
[19:25:59] Narzew: has joined #ruby
[19:26:19] pothibo: has joined #ruby
[19:26:38] davedev24: has joined #ruby
[19:27:41] jwaldrip: has joined #ruby
[19:28:03] apeiros: must be scary if it can't be highlighted! :-p
[19:28:53] schov: hmm, I'm wondering why the following code doesn't work " if arr[i] > arr[i].downcase then puts "working" end " - when i type ABC then it should respond with "working" three times, but i get nothing?
[19:29:01] allcentury: has joined #ruby
[19:29:14] apeiros: >> "A" > "a"
[19:29:15] ruboto: apeiros # => false (https://eval.in/397981)
[19:29:22] apeiros: that's why
[19:29:33] apeiros: uppercase is not "bigger than" lower case.
[19:29:45] bklane: has joined #ruby
[19:29:49] apeiros: >> ["A".ord, "a".ord]
[19:29:50] ruboto: apeiros # => [65, 97] (https://eval.in/397983)
[19:29:58] arup_: has joined #ruby
[19:30:08] apeiros: string comparison is based on binary value. see above the values for A and a
[19:30:30] schov: but when you use the sort method it will treat "B" as bigger than "a"
[19:30:54] apeiros: >> ["a", "B"].sort
[19:30:55] ruboto: apeiros # => ["B", "a"] (https://eval.in/397984)
[19:31:05] apeiros: ^ no, it won't. how do you get that idea?
[19:31:06] schov: there u go
[19:31:20] apeiros: uuuuh, you do realize that *smallest* goes first, right?
[19:31:30] apeiros: you don't count from Infinity back to 0 either???
[19:31:41] felltir: >> [ 3, 2, 1].sort
[19:31:42] ruboto: felltir # => [1, 2, 3] (https://eval.in/397985)
[19:31:45] slash_nick: >> %w{ a b c d A B C D }.sort
[19:31:46] ruboto: slash_nick # => ["A", "B", "C", "D", "a", "b", "c", "d"] (https://eval.in/397986)
[19:32:11] MagePsycho__: has joined #ruby
[19:32:30] slash_nick: schov: were you epxecting something more like %w{ A a B b C c D d } ?
[19:32:31] arup_: has joined #ruby
[19:33:01] schov: no, that is correct
[19:33:16] schov: ["A", "B", "C", "D", "a", "b", "c", "d"]
[19:33:42] apeiros: schov: as said, smallest first. so B coming before a means it is smaller.
[19:33:56] apeiros: cf numbers, as felltir wrote
[19:33:57] jhass: >> "abcABC".map {|c| [c, c.ord] }.sort
[19:33:58] ruboto: jhass # => undefined method `map' for "abcABC":String (NoMethodError) ...check link for more (https://eval.in/397988)
[19:34:06] jhass: >> "abcABC".chars.map {|c| [c, c.ord] }.sort
[19:34:07] ruboto: jhass # => [["A", 65], ["B", 66], ["C", 67], ["a", 97], ["b", 98], ["c", 99]] (https://eval.in/397989)
[19:34:10] schov: right i see
[19:35:06] schov: yeah i get it..sorry my fault
[19:35:22] jhass: no worries, yw
[19:36:48] rikkipitt: has joined #ruby
[19:37:49] NeverDie_: has joined #ruby
[19:38:04] snockerton1: has joined #ruby
[19:39:21] radialneon: has joined #ruby
[19:40:50] arup_: I am using new client.. wohoooooooo
[19:40:57] bklane: has joined #ruby
[19:41:11] radialneon: has joined #ruby
[19:41:21] RandyT: has joined #ruby
[19:41:34] radialneon: has joined #ruby
[19:41:46] nettoweb: has joined #ruby
[19:41:49] Musashi007: has joined #ruby
[19:44:06] snockerton: has joined #ruby
[19:44:35] Aswebb__: has joined #ruby
[19:45:10] Notte: has joined #ruby
[19:46:04] edwinvdgraaf: has joined #ruby
[19:46:36] jerius: has joined #ruby
[19:46:50] Darkwater: has joined #ruby
[19:46:51] Darkwater: has joined #ruby
[19:47:16] radialneon_: has joined #ruby
[19:48:07] edwinvdgraaf: has joined #ruby
[19:48:55] evanjs: has joined #ruby
[19:49:19] n008f4g_: has joined #ruby
[19:49:33] DexterLB: has joined #ruby
[19:52:15] dopie: has joined #ruby
[19:52:20] Jarboe: has joined #ruby
[19:54:08] aaeron: has joined #ruby
[19:54:19] ivanf: has joined #ruby
[19:54:54] Marsupermammal: has joined #ruby
[19:55:25] bungoman: has joined #ruby
[19:55:36] spuk: has joined #ruby
[19:55:58] bklane: has joined #ruby
[19:56:54] nfk: has joined #ruby
[19:56:57] pengin: has joined #ruby
[19:57:06] alphaatom: has joined #ruby
[19:57:26] linuxboytoo: has joined #ruby
[19:59:33] baweaver: has joined #ruby
[19:59:52] RandyT: has joined #ruby
[20:00:25] radialneon: has joined #ruby
[20:00:46] Pumpkin-: has joined #ruby
[20:00:56] allomov: has joined #ruby
[20:01:51] _blizzy_: has joined #ruby
[20:02:00] mhib: has joined #ruby
[20:02:30] anthony__: has joined #ruby
[20:03:33] fullofcaffeine: has joined #ruby
[20:04:04] bklane: has joined #ruby
[20:04:28] eggoez: has joined #ruby
[20:04:46] DoubleMalt: has joined #ruby
[20:05:10] jimmythehat: How do I mock an in-block variable? In this case, I would want to mock match.contains_a_number? Also, this is a learning excercize, I am aware of the dangers of monkey patching I just want to know how you're meant to mock an in-block variable. Thanksies!!
[20:05:21] jimmythehat: https://gist.github.com/anonymous/8d652c630d83b6d6a73e
[20:05:27] qhartman: has joined #ruby
[20:05:46] jimmythehat: hold on I wasn't thinking, let me finish that gist...
[20:06:06] apeiros: ACTION has some weird d??j?? vu
[20:06:11] felltir: https://www.relishapp.com/rspec/rspec-mocks/v/2-6/docs/method-stubs/stub-on-any-instance-of-a-class
[20:06:18] apeiros: ACTION waits for jhass to reply
[20:06:27] adaedra: apeiros: calm down neo
[20:06:57] apeiros: adaedra: why? it's rare enough to observe an error in the matrix
[20:06:59] jhass: apeiros: there's some useless abstraction gone at least!
[20:07:44] jhass: jimmythehat: whenever you're ready...
[20:08:32] baweaver: has joined #ruby
[20:08:38] adaedra: apeiros: that's reasonable, I go back bending spoons.
[20:08:43] jimmythehat: jhass thanks :P btw I've been playing fallout 3 all day not spending all day on this haha https://gist.github.com/anonymous/d4abda87a8af366b5953
[20:09:38] JakFrist: has joined #ruby
[20:11:07] toretore: class String; def do_certain_parts_contain_a_number?
[20:11:11] jhass: jimmythehat: alright, two approaches. Either you stub out the return value of String#match there and return a stub
[20:11:25] jhass: or you stub it for any instance of MatchData
[20:11:45] jhass: toretore: well, doubt this is anything real world ;)
[20:11:58] but3k4_: has joined #ruby
[20:12:15] bklane: has joined #ruby
[20:12:20] iamse7en: has joined #ruby
[20:13:09] jhass: so, I'd favor the former: string = "foo"; allow(string).to receive(:match).and_return(stub(:contains_a_number? => true)); expect { string.do_certain_... }...
[20:13:31] ndrei: has joined #ruby
[20:13:52] jhass: jimmythehat: but I'd also consider to not stub at all here, the external dependency on MatchData is small enough to just let it fall through
[20:14:02] v0n: has joined #ruby
[20:14:12] jottr_: has joined #ruby
[20:14:13] jhass: and chose testcases with the desired results for it
[20:14:14] ValicekB: has joined #ruby
[20:15:42] toretore: jimmythehat: what's the purpose of this code?
[20:15:52] werelivinginthef: has joined #ruby
[20:16:18] fabrice31: has joined #ruby
[20:16:29] jimmythehat: toretore I'm just leaning how to mock, it's pretty useless :P
[20:18:48] iamse7en: hello, I have a simple #gsub question to anyone willing to help. thank you. https://gist.github.com/austinarchibald/906be9f1874a7977e516
[20:18:58] _djbkd: has joined #ruby
[20:19:01] quimrstorres: has joined #ruby
[20:19:28] _djbkd: has joined #ruby
[20:19:49] jimmythehat: jhass thanks, great responses. If I follow your advice and mock what match returns, how should I spec the regex? I liked seeing that the regex was working before and would lose that if I was mocking match. any_instance_of makes the most sense to me, but it's discouraged by the rspec team (note how its placed under the heading 'Working with legacy code'. Worrying - could be depricated. https://relishapp.com/rspec/rspec-mocks/docs/working-with-lega
[20:21:08] jimmythehat: so I guess...how should I test the regex? Or is it okay to use allow_any_instance_of() ?
[20:21:10] jhass: jimmythehat: well, you're assuming too much about the implementation either way I guess
[20:21:26] jhass: the example is pretty much one you want to observe only with input & return values
[20:21:31] toretore: iamse7en: gsub(/.foo/, '') will remove 'foo' preceded by 1 character
[20:21:34] jhass: since it's side effect free
[20:21:45] quimrstorres: has joined #ruby
[20:21:58] arturmartins: has joined #ruby
[20:22:04] GitGud: has joined #ruby
[20:22:58] jimmythehat: jhass I'm feeling allow_any_instance_of but it would suck if they drop it in future. Oh well :/
[20:23:16] jimmythehat: just cross that bridge if and when it does get dropped
[20:23:19] but3k4: has joined #ruby
[20:23:25] Maletor: has joined #ruby
[20:23:42] jhass: I doubt it'll be dropped, but it's true that you should avoid it as long as you can
[20:24:15] jhass: again, what troubles you is that it's a bad example for mocking and stubbing
[20:24:32] jhass: it's so much much better speced without
[20:26:00] jimmythehat: jhass Yeah I do see why. I wouldn't have this trouble if I was sending the string to another class of analysis. then I could mock that class easily. You should only mock other classes I guess?
[20:26:00] xkef: has joined #ruby
[20:26:12] jimmythehat: *for analysis
[20:26:20] jespada: has joined #ruby
[20:26:25] jhass: no, the real issue is that you assert implementation instead of behavior
[20:26:53] jhass: mocking & stubbing is for replacing expensive or impossible to run code in tests
[20:27:12] jhass: or recreating conditions that are otherwise hard to achieve
[20:27:15] rht: has joined #ruby
[20:27:49] jhass: you attempt to use it as a tool for asserting the method is implemented in certain manner
[20:28:18] jhass: you do not care of "it returns/causes X when Y" but "it does X when Y"
[20:28:42] Maletor: has joined #ruby
[20:28:48] jhass: but you shouldn't care about the how, just that it happens
[20:29:34] suffice: has joined #ruby
[20:30:19] T3: has joined #ruby
[20:31:05] jimmythehat: doesn't it give you better feedback if you isolate and then break something? only the code that's failing would turn up red. if I mocked less-so, wouldn't I get a whole set of red specs rather than justt the one that's actually failing? shouldn't behaviour and the end result only be tested in an integration spec?
[20:31:44] dopie: has joined #ruby
[20:32:09] Papierkorb: has joined #ruby
[20:32:36] jhass: not if your mocks go to the point of asserting a special implementation
[20:32:51] jhass: er, *specific
[20:33:33] MarkTurner: has joined #ruby
[20:33:47] jimmythehat: jhass not sure I follow :P
[20:33:59] jimmythehat: specific implementation?
[20:34:08] MarkTurner: has joined #ruby
[20:34:32] jimmythehat: I suppose I could just 'allow' rather than expect? That would be less brittle. is that what you mean?
[20:34:44] jhass: basically if your specs becomes a recipe of "this call with these parameters should happen and then on the return value this call should happen and then this call should happen" you're doing it wrong
[20:35:08] jhass: allow just changes the should to a may
[20:35:36] JakFrist: has joined #ruby
[20:36:06] pietr0: has joined #ruby
[20:37:15] postmodern: has joined #ruby
[20:37:25] sepp2k: has joined #ruby
[20:37:49] mleung: has joined #ruby
[20:38:38] MarkTurner: has joined #ruby
[20:38:41] jhass: after all a big part of your specs is to make refactoring easier. I've written specs like ^ and can tell you that they break with the slightest changes that don't actually change behavior as viewed from the outside
[20:38:46] peter_paule: has joined #ruby
[20:39:08] jhass: a small cascade in failures is less annoying and usually easily identified anyway
[20:39:49] tmtwd: has joined #ruby
[20:39:51] bb010g: has joined #ruby
[20:39:57] dgutierrez1287: has joined #ruby
[20:41:05] bronson: has joined #ruby
[20:41:24] leonardoajim: has joined #ruby
[20:43:13] jimmythehat: jhass you're right about a small cascade being easy to fix. I don't follow you 100% but mocking too much does make specs brittle. So I am not going to mock other methods of the same class, however I am going to mock other classes and their methods, and then have some integration specs that contain no mocks at all. I don't think I'll go too wrong doing that :P
[20:43:46] charliesome: has joined #ruby
[20:43:59] jhass: probably not, but following such rules religiously is often impractical
[20:44:10] LMity: has joined #ruby
[20:44:27] iamse7en: toretore, thanks. what about a string that has [] in it? how do I escape those? https://gist.github.com/austinarchibald/906be9f1874a7977e516
[20:44:56] toretore: a lot of the time mocking is a code smell - well-structured code is usually easy to test and doesn't need mocking of hard coded dependencies
[20:45:17] toretore: iamse7en: you should learn regular expressions
[20:45:29] toretore: regularexpressions.info
[20:46:08] howdoicomputer: has joined #ruby
[20:46:13] jerius: has joined #ruby
[20:47:40] baweaver: has joined #ruby
[20:48:07] T3: has joined #ruby
[20:48:38] jimmythehat: toretore awh this is sort of going in the face everything ive learned...to test classes in isolation and then test in integration. Or is that more of a rails thing?
[20:48:59] fullofcaffeine: has joined #ruby
[20:50:28] toretore: jimmythehat: those are also true, and the two aren't mutually exclusive
[20:50:34] Hanmac: has joined #ruby
[20:50:42] toretore: but you can achieve those things without mocking
[20:50:53] toretore: mocking is more of a last resort
[20:51:05] toretore: or if you're lazy
[20:51:20] olistik: one question related to ssl: https://gist.github.com/olistik/40e3ada4172610500357
[20:51:26] olistik: isn't it weird?
[20:51:47] olistik: google and filepicker.io fail, but facebook and another one don't
[20:51:51] jimmythehat: toretore haha okay. I'll just not go crazy with mocks basically :P
[20:51:52] olistik: I'm on osx
[20:52:27] Senjai: olistik: First of all, dont use SSLv3
[20:52:52] davedev24: has joined #ruby
[20:52:55] jhass: Senjai: SSLv3 is just OpenSSL being odd
[20:52:59] jhass: it includes TLS
[20:53:08] toretore: jimmythehat: don't focus too much on tools - focus more on improving your code
[20:53:13] Senjai: jhass: That's annoying
[20:53:43] toretore: people often get carried away with tools, and people are always pushing their favorite tools on beginners
[20:53:59] toretore: like rspec and mocking in your case
[20:54:26] evanjs_: has joined #ruby
[20:54:54] Notte: has joined #ruby
[20:55:22] but3k4: has joined #ruby
[20:55:25] olistik: Senjai: I've just brew install openssl and then used rvm
[20:55:34] graydot: has joined #ruby
[20:55:46] jhass: olistik: google.com and filepicker.io both use the GeoTrust root
[20:55:49] toretore: goddamn rusty again
[20:55:50] Senjai: I'm not on OSX, sorry, I thought it might have been w/ the sslv3
[20:55:55] jhass: maybe that's somehow missing in your CA bundle?
[20:55:58] ndrei: has joined #ruby
[20:56:46] platzhirsch: has joined #ruby
[20:57:52] jimmythehat: toretore good plan :) Can I ask about name spacing? I fail to see the benefit of this https://github.com/thoughtbot/shoulda-matchers/blob/master/lib/shoulda/matchers/action_controller.rb putting every matcher in a separate file than then requiring them all into one big file? Why not just have them in one big file to start with and do away with the requiring?
[20:58:10] Senjai: olistik: You can use s_client --connect sitename:port
[20:58:13] olistik: jhass: shouldn't rvm osx-ssl-certs update take care of everything?
[20:58:43] Senjai: olistik: It will help you debug the things
[20:58:45] jhass: no idea, I'm on linux and don't need such stuff
[20:58:47] Senjai: openssl s_client **
[20:59:10] Senjai: olistik: If the above command works for google.com:443, the problem is with ruby and not your computer
[20:59:29] jimmythehat: I think you call that name spacing anyway, they're all inside a ActionController module. But I fail to see the benefit. It would be easier if they were all in one file, searching for methods ect...
[20:59:38] raenk: I'm in the process of learning ruby (and rails). I'm excited about it and in a couple of weeks I'm going to start a project that basically would be a simple API that serves JSON data. I'm not sure if I should hold my excitement about ruby and just develop it with PHP considering it might be overkill going with ruby. What do you think?
[20:59:45] toretore: jimmythehat: yeah, i tend to see that as a smell too - when you have too much in one class/module that you have split it into several files
[20:59:57] toretore: jimmythehat: it's not actually namespacing
[21:00:05] olistik: https://gist.github.com/hiperpool/3c3fa5d5c968c3afc5fc
[21:00:09] olistik: it looks like it's working
[21:00:18] olistik: I'll try reinstalling ruby with rvm
[21:00:26] Senjai: olistik: Or use chruby
[21:00:33] Senjai: instead of rvm
[21:00:40] olistik: or rbenv :-)
[21:00:47] toretore: jimmythehat: it's just a way to make it look cleaner - cheating, if you will
[21:00:47] jhass: raenk: Ruby offers a ton of lightweight solutions for this that aren't rails
[21:01:13] Senjai: olistik: or... chruby :P
[21:01:49] Senjai: But yeah, any SSL issues, run that command before debugging, it helps you point out if its a system issue or a software one.
[21:02:01] jimmythehat: toretore Yeah I get that. Think I'll just have one file per module. If it gets to big, create another module entirely. It's funny how lenient ruby is an how restrictive(not a bad thing) rails is
[21:02:06] bungoman: has joined #ruby
[21:02:24] dfockler: rails RAILS!
[21:02:45] jimmythehat: dfockler indeed
[21:02:48] quimrstorres: has joined #ruby
[21:02:52] toretore: jimmythehat: though in the example you linked to i don't know of any better way to do it
[21:02:53] MagePsycho_: has joined #ruby
[21:03:09] toretore: sometimes you just need a whole lot of methods
[21:03:18] raenk: jhass: what would you recommend? Obviously I need something with a smooth learning curve considering It will be my first project
[21:03:19] dfockler: ruby never specified convention, and went for programmer happiness, which means lots of ways of doing the same thing
[21:04:08] toretore: "What make Programmer Brain Happy is What I Make To Ruby" - matz
[21:04:50] riotjones: has joined #ruby
[21:05:04] jhass: raenk: I know nothing about your requirements, my recommendation would be as good as rolling a dice
[21:05:30] bodgix: has joined #ruby
[21:05:39] jimmythehat: toretore just wondering, what would be wrong with one big (i.e. not split over multiple files) ActionController module in the example I linked you? Is it purely organizational?
[21:06:31] aaeron: has joined #ruby
[21:06:34] toretore: jimmythehat: yes in that case it's purely organizational
[21:06:43] werelivinginthef: has joined #ruby
[21:06:46] toretore: it's the same module in every file
[21:07:00] FernandoBasso: has joined #ruby
[21:07:23] leat1: has joined #ruby
[21:07:29] jimmythehat: toretore what I thought, thanks for your help :)
[21:07:35] jimmythehat: jhass thanks as well
[21:08:17] aderium: it seems to never end .. https://gist.github.com/CirrusThink/261fc40d99f82c3b425c
[21:08:22] Scroff: has joined #ruby
[21:08:26] blaines: has joined #ruby
[21:08:28] platzhirsch: has left #ruby: ()
[21:08:56] hololeap: has joined #ruby
[21:09:55] Musashi007: has joined #ruby
[21:10:53] casadei_: has joined #ruby
[21:10:53] danielpclark: has joined #ruby
[21:11:24] aaeron: has joined #ruby
[21:11:30] MarkTurner: has joined #ruby
[21:11:42] ytti: el'capitan still has 2.0.0
[21:12:09] but3k4: has joined #ruby
[21:12:35] LJT: has joined #ruby
[21:13:25] malconis: has joined #ruby
[21:13:51] adaedra: ytti: you're under El Capitan?
[21:13:54] nfk: has joined #ruby
[21:15:08] mjuszczak: has joined #ruby
[21:17:05] jonathanwallace: has joined #ruby
[21:17:44] davedev24: has joined #ruby
[21:17:49] chipotle: has joined #ruby
[21:17:57] ytti: adaedra, ye
[21:18:08] adaedra: ytti: can you check emacs version?
[21:18:10] ytti: got my mbp from shop today (display barfed)
[21:18:13] ytti: and went balls deep
[21:18:21] ytti: ios9, el'capitan, office2016
[21:18:22] charliesome_: has joined #ruby
[21:18:43] devbug: has joined #ruby
[21:18:45] ytti: adaedra, 22.1.1 of 2015-07-01 on osx002.apple.com
[21:18:58] bungoman: has joined #ruby
[21:19:02] adaedra: there are things which doesn't change
[21:19:26] dfockler: doesn't OSX ship with it's own version of MRI?
[21:20:09] Axsuul: has joined #ruby
[21:20:16] sharpmachine: has joined #ruby
[21:20:27] solars: has joined #ruby
[21:20:55] Axsuul: has joined #ruby
[21:22:00] SylarRuby: has joined #ruby
[21:22:17] bronson: has joined #ruby
[21:22:42] loc22: has joined #ruby
[21:22:58] paulcsmith: has joined #ruby
[21:23:35] adaedra: not anymore
[21:23:43] ascarter: has joined #ruby
[21:23:51] adaedra: ytti: patch level?
[21:23:55] phutchins: has joined #ruby
[21:24:13] jottr_: has joined #ruby
[21:24:26] adaedra: Yosemite: VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 5 2014 21:00:28)
[21:24:39] LJT: has joined #ruby
[21:25:22] ascarter: has joined #ruby
[21:26:05] ytti: adaedra, included patches 1-712
[21:26:08] ytti: so pretty new
[21:26:10] mjuszczak: has joined #ruby
[21:26:19] ytti: same as debian unstable
[21:26:23] dagda1: has joined #ruby
[21:26:29] adaedra: seems normal
[21:27:06] ruurd: has joined #ruby
[21:27:15] adaedra: I wonder if they stopped caring about emacs just because "LOL GNU" or for other reasons
[21:27:38] waseem_: has left #ruby: ("WeeChat 1.2")
[21:28:03] Scripore: has joined #ruby
[21:28:29] NeverDie: has joined #ruby
[21:28:47] allcentury: has joined #ruby
[21:29:05] saadq: Can someone help me understand this basic code? https://gist.github.com/anonymous/663724fc10283daee3c7
[21:29:09] adaedra: So both? :p
[21:29:23] saadq: Having a bit of trouble understanding the attributes = {} in the parameter
[21:29:37] adaedra: you know what is {}, saadq ?
[21:29:43] saadq: a hash right
[21:30:02] adaedra: and you know what it means, when you do parameter = value in the arguments of a method?
[21:30:04] saadq: Just not used to seeing an expression inside the parameter
[21:30:04] icebourg: has joined #ruby
[21:30:25] adaedra: not really an expression
[21:30:26] saadq: adaedra: I guess my answer to that question is no lol
[21:30:32] wasamasa: adaedra: gplv3 scares the shit out of lawyers
[21:30:32] shevy: saadq well, if you omit an argument, it will default to an "empty hash" - that is {}
[21:30:36] adaedra: it's a default value
[21:30:49] wasamasa: adaedra: so apple is careful not bundling anything licensed that way with os x
[21:31:02] saadq: oh interesting
[21:31:06] adaedra: so if you do just new, without parameters, it will use {} as value
[21:31:10] adaedra: wasamasa: yeah ok
[21:31:16] yfeldblum: has joined #ruby
[21:31:23] shevy: adaedra france should buy apple so we get french-named products
[21:31:27] Zackio: has joined #ruby
[21:31:27] shevy: le iphoeeene
[21:31:31] wasamasa: fun fact: they're not alone
[21:31:37] wasamasa: though, linux doesn't really count :P
[21:31:40] shevy: jimmythehat rescue!
[21:31:42] adaedra: shevy: you'll earn le coup de pied au cul soon
[21:31:48] wasamasa: it's just that linus doesn't see any reason in upgrading to gplv3
[21:31:54] shevy: yum... cordon bleu
[21:32:02] jimmythehat: shevy :P been a long day
[21:32:04] Ox0dea: >> def foo _ = _; end
[21:32:06] ruboto: Ox0dea # => /tmp/execpad-2fdd0e44001d/source-2fdd0e44001d:2: warning: circular argument reference - _ ...check link for more (https://eval.in/398014)
[21:32:09] adaedra: yeah, FreeBSD also tried to remove everything GPL
[21:32:19] shevy: gpl3 and gpl2 are not that much different except that gpl3 also fights an ideological fight at the same time
[21:32:43] arturmartins: has joined #ruby
[21:32:46] wasamasa: and there you go
[21:33:02] wasamasa: the anti-tivoization clause is probably the reason
[21:33:15] adaedra: the what now
[21:34:09] RegulationD: has joined #ruby
[21:34:11] Ox0dea: Which is the best license, and why is it the WTFPL?
[21:34:21] wasamasa: the wtfpl is just a bad joke
[21:34:36] wasamasa: use unlicense or better even cc0
[21:35:01] wasamasa: oh and listen to debian-legal or the fsf when it comes to license questions
[21:35:12] Tritone: has joined #ruby
[21:35:14] jhass: Ox0dea: because we have CC0 if you want to do it proper
[21:35:32] jhass: aw, too slow
[21:35:51] jokke: has joined #ruby
[21:36:10] pengin: has joined #ruby
[21:36:15] jhass: but I guess we should move this to -offtopic
[21:36:19] baweaver: has joined #ruby
[21:36:37] Ox0dea: wasamasa: You're not there...
[21:36:47] Igorshp: has joined #ruby
[21:36:48] wasamasa: Ox0dea: I'm on three offtopic channels already :P
[21:36:56] wasamasa: Ox0dea: no need for another one to idle on
[21:37:04] shevy: oh the french variant is so great... Faites ce que vous voulez, j?en ai RIEN ? BRANLER.
[21:37:04] jhass: but we got hangman!
[21:37:28] Ox0dea: wasamasa: But then where do I chastise you for favoring the Unlicense to the WTFPL?
[21:37:46] aaeron: has left #ruby: ()
[21:37:49] Ox0dea: But you're wrong on the Internet.
[21:37:52] ascarter: has joined #ruby
[21:37:54] rickmasta: has joined #ruby
[21:38:03] adaedra: shevy: that's vulgar and not really the place.
[21:38:26] shevy: I read it as a love letter!
[21:38:54] adaedra: you know what it means, right?
[21:38:56] shevy: I shall loudly chant it with a german-speaking accent
[21:39:09] bubbys: has joined #ruby
[21:39:09] shevy: I have absolutely no idea, you think I'd speak a single word of french :)
[21:39:31] zacstewart: has joined #ruby
[21:40:38] drewo: has joined #ruby
[21:40:44] adaedra: shevy: off topic
[21:41:20] MarkTurner: has joined #ruby
[21:42:07] graydot: has joined #ruby
[21:43:12] GnuYawk: has joined #ruby
[21:43:33] rbennacer: has joined #ruby
[21:44:47] shevy: ok I have here code written by someone else
[21:44:54] shadoi: has joined #ruby
[21:45:01] hj2007: has joined #ruby
[21:45:04] edwinvdgraaf: has joined #ruby
[21:45:11] shevy: class Error < StandardError; end
[21:45:11] shevy: class InvalidBla < Error; end
[21:45:15] shevy: is that here common??
[21:45:36] adaedra: I already saw that many times, yes
[21:45:47] Musashi007: has joined #ruby
[21:45:49] Ox0dea: I think Error = Class.new(StandardError) is better.
[21:45:50] adaedra: so you have a common root error to all your errors
[21:46:17] hj2007: I'm getting "Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2" while bundle install even though rbenv version returns 2.1.2.
[21:46:35] postmodern: hj2007, rbenv rehash?
[21:46:50] bklane: has joined #ruby
[21:47:02] postmodern: hj2007, also make sure you have bundler installed under that ruby
[21:47:09] jhass: Ox0dea: I disagree, it raises the barrier of entry to your code without reason
[21:47:13] hj2007: postmodern: rehash doesn't help, already did that.
[21:47:16] jhass: not that you would care...
[21:47:17] _ixti_: has joined #ruby
[21:47:42] Ox0dea: jhass: How, exactly?
[21:48:02] juanpablo_: has joined #ruby
[21:48:03] Ox0dea: I think the average Rubyist should know that Class.new takes an optional base class argument.
[21:48:07] jhass: Ox0dea: it requires some deeper knowledge about rubys object model to understand
[21:48:21] jhass: the average intermediate Rubyist, yes
[21:48:43] hj2007: postmodern: installed bundler, same issue :(
[21:48:56] jhass: but you'd be surprised of how many are unaware that class Foo is Foo = Class.new, and how long it takes to explain
[21:49:21] yorickpeterse: who wants to see fantastic Ruby code?
[21:49:23] jhass: and how confusing it is to many, especially coming from other programming backgrounds
[21:49:29] jhass: yorickpeterse: nobody
[21:49:40] adaedra: yorickpeterse: nobody
[21:49:48] shevy: someone here is nobody
[21:50:08] shevy: I learned that from a discussion between apeiros and jhass
[21:50:09] yorickpeterse: stop ruining my fun
[21:50:19] adaedra: ACTION steals yorickpeterse's fun
[21:50:37] yorickpeterse: https://gist.github.com/YorickPeterse/313501dc4713f861bfbb here it is anyway
[21:50:53] adaedra: aaaah, it looks like PHP
[21:51:10] yorickpeterse: that's auto generated btw
[21:51:24] yorickpeterse: normally it comes minus indentation too
[21:51:26] yorickpeterse: so even better
[21:51:29] shevy: I also have to deal with XML stuff right now :( doc = Nokogiri::HTML(open(uri)); path = doc.xpath("//link[@rel='shortcut icon' or @rel='icon']/@href").first
[21:51:45] jhass: waah, throw
[21:51:50] jhass: the hidden goto
[21:51:53] yorickpeterse: jhass: it actually makes perfect sense here
[21:51:56] yorickpeterse: I'm not even kidding
[21:51:58] mjuszczak: has joined #ruby
[21:52:18] yorickpeterse: It has to break out of potentially infinitely nested recursion
[21:52:26] yorickpeterse: and since it's in a lambda it can't use "return" at this point
[21:52:28] yorickpeterse: so yay throw/catch
[21:53:07] yorickpeterse: That only deals with the inner most recursion
[21:53:27] yorickpeterse: here the "node.children.each do |node|" bit could be repeated a lot of times
[21:53:33] eggoez: has joined #ruby
[21:53:36] adaedra: indent is misleading af
[21:53:49] yorickpeterse: Yeah it's a bit messed up
[21:53:58] duderonomy: has joined #ruby
[21:54:09] adaedra: but throw could have been avoided tbh
[21:54:27] yorickpeterse: https://gist.github.com/YorickPeterse/313501dc4713f861bfbb#file-predicate_without_indent-rb this is what it looks like as spat out by the compiler
[21:54:34] adaedra: what you're doing looks like a #find
[21:54:55] yorickpeterse: Any form of find/select/whatever only runs at most N times where N is the outer most values in the array
[21:55:20] shevy: we found a legit use case for throw!
[21:55:22] yorickpeterse: this also saves me from having to nest dozens of #find calls potentially
[21:55:29] yorickpeterse: Remember this is actually meant to be webscale
[21:55:35] yorickpeterse: as in, this will be faster than Nokogiri's xpath engine
[21:55:39] yorickpeterse: which is written in C
[21:55:55] baweaver: has joined #ruby
[21:56:00] Notte: has joined #ruby
[21:56:06] Ox0dea: >> (1..Float::INFINITY).find(&:zero?)
[21:56:09] ruboto: Ox0dea # => (https://eval.in/398019)
[21:56:12] Ox0dea: Come on! It's gotta be in there somewhere.
[21:56:37] adaedra: shevy: there is a legit use for throw: exceptional error cases.
[21:57:00] shevy: rescue TheWorld
[21:57:13] yorickpeterse: throw is not meant for exception handling
[21:57:31] jhass: adaedra: the fireworks made you all dizzy
[21:57:35] yorickpeterse: fuck yeah, this code is 5,5x faster than Nokogiri
[21:57:47] shevy: nokogiri is slower than a snail
[21:57:53] adaedra: so exceptions are not for errors now?
[21:58:00] yorickpeterse: shevy: tell that to all the nerds going "OMMGMGMG BUT C IS WEBSCALE"
[21:58:05] jhass: adaedra: you're confusing throw for raise
[21:58:11] yorickpeterse: adaedra: "raise" is for exception handling, "throw" is for recursion/flow-control
[21:58:14] shevy: there used to be .cgi written in C!
[21:58:19] adaedra: that's not the same now? o_O
[21:58:25] yorickpeterse: adaedra: correct
[21:58:27] yorickpeterse: they're different
[21:58:41] yorickpeterse: throw/catch is basically a goto
[21:58:43] shevy: throw is when you wanna throw someone out of the club
[21:58:49] yorickpeterse: raise is "fuck shit broke"
[21:58:57] yorickpeterse: plus an oxford comma
[21:58:58] wallerdev: has joined #ruby
[21:59:02] yorickpeterse: so "fuck, shit broke"
[21:59:13] adaedra: guess I'm mixing languages
[21:59:14] shevy: how descriptive
[21:59:35] yorickpeterse: adaedra: yeah, it doesn't help that pretty much every other language uses throw/try/catch
[22:00:15] jhass: raise Fuck, "shit broke"
[22:00:21] ruurd_: has joined #ruby
[22:00:25] jhass: gotta stick that somewhere
[22:00:48] yorickpeterse: rescue Exception => error
[22:00:51] arooni-mobile: has joined #ruby
[22:00:56] arooni-mobile__: has joined #ruby
[22:01:07] yorickpeterse: I think I actually have something like that somewhere
[22:01:07] jhass: s/lol/I'm an idiot/
[22:01:32] hj2007: I'm getting "Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2" while bundle install even though rbenv version returns 2.1.2. Any help?
[22:01:42] yorickpeterse: oh hm no, we actually do something with the error
[22:01:51] jhass: hj2007: what exact command are you running?
[22:02:07] hj2007: jhass: bundle install in a directory with a Gemfile
[22:02:18] jhass: hj2007: command -v bundle returns what?
[22:02:20] Ox0dea: yorickpeterse: That wasn't an Oxford comma, for what that's worth.
[22:02:35] ruurd: has joined #ruby
[22:02:42] hj2007: jhass: /usr/bin/bundle
[22:02:42] yorickpeterse: Ox0dea: close, enough
[22:03:01] jhass: hj2007: there you go, your Rbenv install doesn't have bundler installed
[22:03:11] ruurd: has joined #ruby
[22:04:21] hj2007: jhass: did gem install bundler, same issue
[22:04:33] jhass: rbenv rehash?
[22:04:47] jhass: command -v bundle changed?
[22:05:24] hj2007: jhass: no, command -v bundle still returns the same, did rehash as well.
[22:05:41] jhass: well, your rbenv install is borked then or whatever
[22:05:51] jhass: I don't use it, so *shrug*
[22:06:11] hj2007: jhass: I see, thanks anyway, let me reinstall and try
[22:06:19] Casty: has joined #ruby
[22:06:29] edwinvdgraaf: has joined #ruby
[22:06:43] ruurd_: has joined #ruby
[22:06:58] beef-wellington: has joined #ruby
[22:07:17] Casty: i'm pretty new, but can someone help me figure out a way to see how much memory a .rb file is using? on ubuntu
[22:07:35] shevy: Casty probably first way would be via htop
[22:07:36] JoshL_: has joined #ruby
[22:07:55] ruurd: has joined #ruby
[22:08:09] jhass: a modern /usr/bin/time shows that
[22:08:17] jhass: /usr/bin/time ruby foo.rb
[22:08:17] al2o3-cr: probablt need to install with `sudo apt-get install htop`
[22:08:45] adaedra: ^T does i??? ah no, Linux, nvm.
[22:08:48] Scroff: has joined #ruby
[22:09:01] bungoman: has joined #ruby
[22:09:02] shevy: adaedra ack! you are not on linux?
[22:09:04] victortyau: has joined #ruby
[22:09:26] al2o3-cr: adaedra: is this true?
[22:09:28] Casty: ok thanks i'll start with that. i appreciate the quick answers
[22:09:36] adaedra: shevy: not all the time. I also use Mac OS and FreeBSD
[22:09:42] adaedra: al2o3-cr: what is true?
[22:09:58] al2o3-cr: thought you may be using windows :p
[22:10:14] Scripore: has joined #ruby
[22:10:34] al2o3-cr: but everyone to their own
[22:10:41] Ox0dea: Except Windows users.
[22:11:16] adaedra: Come on, I'm mad, not insane.
[22:11:30] shevy: you use everything
[22:11:38] al2o3-cr: it's good to be both sometimes
[22:12:38] shevy: http://www.netmarketshare.com/operating-system-market-share.aspx?qprid=10&qpcustomd=0
[22:12:41] adaedra: shevy: noo, far from it.
[22:13:02] shevy: Linux share: 1.61%; OSX 4.54% - guess ruby runs on more machines that have OSX in total
[22:13:31] al2o3-cr: windows 7 needs to die!
[22:13:50] havenwood: has joined #ruby
[22:13:59] al2o3-cr: all microsoft shit
[22:14:02] adaedra: let Windows XP and Vista die first, we will talk about 7 after that.
[22:14:16] olistik: has joined #ruby
[22:14:36] duderonomy: has joined #ruby
[22:14:45] shevy: https://en.wikipedia.org/wiki/Usage_share_of_operating_systems reports an even higher share of OSX
[22:14:53] shevy: linux - same lowness :(
[22:14:56] ascarter: has joined #ruby
[22:15:25] al2o3-cr: now check web server OS's :p
[22:15:40] Ox0dea: al2o3-cr: Or supercomputers.
[22:15:50] quimrstorres: has joined #ruby
[22:16:01] jespada: has joined #ruby
[22:16:11] Ox0dea: It's 94% of the top 500, apparently.
[22:16:13] olistik: has joined #ruby
[22:16:17] bklane: has joined #ruby
[22:16:39] ascarter: has joined #ruby
[22:17:00] fabrice31: has joined #ruby
[22:17:14] al2o3-cr: wouldn't trust ms on a cray :D
[22:17:49] shevy: or google to drive your car
[22:18:06] al2o3-cr: not to sure i would :p
[22:18:39] yorickpeterse: well, 318 failing tests to fix
[22:18:45] yorickpeterse: before I can ship this new xpath compiler
[22:18:51] tomphp: has joined #ruby
[22:18:59] al2o3-cr: probably better than most drivers :)
[22:19:59] edwinvdgraaf: has joined #ruby
[22:20:01] freerobby: has joined #ruby
[22:20:13] al2o3-cr: i'd place a bet :p
[22:20:15] shevy: 99% use cases perhaps - but what if someone else drives into your car
[22:20:34] al2o3-cr: then it's not you fault
[22:20:35] evanjs: has joined #ruby
[22:20:51] jespada_: has joined #ruby
[22:20:53] shevy: I am sure I'll be very relieved of that upon impact time :P
[22:21:42] Darkwater: why does `bundle gem foo-bar` create Foo::Bar? Why not just FooBar?
[22:21:54] Ox0dea: > Chris Urmson, the head of Google's self-driving initiative, says 11 accidents in 1.7 million miles is a lot better record than most humans achieve.
[22:22:35] jhass: Darkwater: http://guides.rubygems.org/name-your-gem/
[22:22:59] jhass: it's simply the convention
[22:23:05] T3: has joined #ruby
[22:23:16] charliesome: has joined #ruby
[22:23:27] loc22: has joined #ruby
[22:24:12] bodgix: has joined #ruby
[22:24:12] moredhel: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[22:24:18] adaedra: Ox0dea: iirc, all of these accidents were 3rd party fault
[22:24:18] triangles2: has joined #ruby
[22:24:38] Ox0dea: I, for one, welcome a road full of "drivers" who've been properly instructed in how to use a fucking on ramp.
[22:25:18] al2o3-cr: bhahaha lol
[22:25:22] Igorshp: has joined #ruby
[22:25:53] adaedra: I work in Paris, I guess driving correctly is a concept
[22:26:03] olistik: has joined #ruby
[22:27:07] astrobun_: has joined #ruby
[22:27:18] Ox0dea: Y'all Yurop fellers got it so good in that regard.
[22:27:29] yorickpeterse: "Yurop fellers"?
[22:28:05] blue_deref: has joined #ruby
[22:28:09] al2o3-cr: sure that's meant to mean "Europe fellows" :p
[22:28:38] nateberkopec: has joined #ruby
[22:28:46] adaedra: what is gotten so good? Driving correctly?
[22:28:49] Ox0dea: The phrasing was intended as a self-deprecation of the American south.
[22:29:06] Ox0dea: adaedra: Yes. Floridian drivers are, on average, a shit.
[22:29:06] quimrstorres: has joined #ruby
[22:29:31] xkickflip: has joined #ruby
[22:29:34] al2o3-cr: taxi in england are the worst :(
[22:29:43] bklane: has joined #ruby
[22:29:53] adaedra: don't know how they compete with us, we have quite a bad driving habit here.
[22:30:02] adaedra: al2o3-cr: don't talk about taxis, thanks.
[22:30:08] al2o3-cr: they don't give a s***
[22:30:08] iamninja: has joined #ruby
[22:31:01] adaedra: but I guess the worst here are cyclists
[22:31:07] al2o3-cr: adaedra: ok sir!
[22:31:41] adaedra: "Red lamp? Stop? Curb? Pedestran crossing? Priority? Lanes? What are those?"
[22:32:10] al2o3-cr: adaedra: what are they?
[22:32:13] mjuszczak: has joined #ruby
[22:33:09] ruurd: adaedra where are you? Netherlands I guess :-)
[22:33:29] adaedra: not exactly.
[22:34:00] adaedra: I actally told it above.
[22:34:05] quimrsto_: has joined #ruby
[22:34:46] maknz: has joined #ruby
[22:34:53] duderonomy: has joined #ruby
[22:36:01] ruurd: adaedra ah well amsterdam bikers...
[22:36:24] ruurd: maybe paris is heaven compared to that in that respect. :-)
[22:36:25] alicanyilmaz: has joined #ruby
[22:36:45] alicanyilmaz: I need to write a code to calculating nth term of PI number in ruby
[22:36:47] kies^: has joined #ruby
[22:36:58] adaedra: ruurd: tbh, I really wished I could kick bikes in Paris sometimes
[22:36:59] alicanyilmaz: can someone help me for this ?
[22:37:20] adaedra: alicanyilmaz: you need an allgorithm to calculate PI if you want to go deep down, first.
[22:37:51] ndrei: has joined #ruby
[22:37:52] bklane: has joined #ruby
[22:37:53] ruurd: plus doing your homework for you costs $150
[22:38:42] GPrime: has joined #ruby
[22:38:48] alicanyilmaz: ruurd: its not a homework, sorry its an challenge for me to implement rest api. I need to solve the challenge for enter the company as an employee
[22:39:01] alicanyilmaz: adaedra: can you suggest me some docs ?
[22:39:18] jhass: alicanyilmaz: that's not any better than doing homework for you
[22:39:21] adaedra: google has all of that, I'm not really good at maths.
[22:39:43] jhass: if you can't do that without external help you probably should question why you apply
[22:39:57] jhass: after all the challenge is there to find candidates who can
[22:40:38] alicanyilmaz: jhass: you are totally right. This is the last part of the challenge but my math is not that good..
[22:40:47] jhass: as said, google
[22:41:01] alicanyilmaz: jhass: ok thank you..
[22:41:13] jhass: there will be algorithms for that you just have to implement
[22:41:21] Ox0dea: alicanyilmaz: There was an IOCCC winner that calculated pi using the "surface area" of the program itself. I think reading its source would be most instructive.
[22:41:39] jhass: Ox0dea: stop trolling :P
[22:41:54] Ox0dea: alicanyilmaz: http://www.ioccc.org/1988/westley.c
[22:42:59] Ox0dea: alicanyilmaz: I wasn't *completely* trolling, for what that's worth. I suspect being able to decipher that program really would teach you quite a bit about how to calculate pi.
[22:43:10] alicanyilmaz: Ox0dea: got it
[22:44:47] al2o3-cr: i am an ape man
[22:44:51] alicanyilmaz: Ox0dea: found an algorithm Gauss???Legendre algorithm
[22:44:56] alicanyilmaz: https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm
[22:45:36] alicanyilmaz: Ox0dea: its time to implement! :) thank you
[22:45:43] bklane: has joined #ruby
[22:45:48] Ox0dea: alicanyilmaz: http://bellard.org/pi/
[22:46:08] Ox0dea: Fabrice held the world record for most calculated digits of pi for quite some time, and he did it with a single machine.
[22:46:14] Ox0dea: There is much to learn from him on the matter.
[22:46:16] lkba: has joined #ruby
[22:46:57] alicanyilmaz: Ox0dea: absolutely
[22:47:01] duderonomy: has joined #ruby
[22:47:14] alicanyilmaz: Ox0dea: omg the algorithm is improved to find with o(n^2) complexity its amazing
[22:48:35] shevy: jhass perhaps both are :P
[22:49:54] dfockler: has joined #ruby
[22:51:01] bruno-: has joined #ruby
[22:51:20] Goldfish: has joined #ruby
[22:51:42] baweaver: has joined #ruby
[22:56:14] Encapsulation: this is where I'm talked about the most
[22:57:10] jhass: compared to?
[22:57:53] ruurd: http://www.wikihow.com/Calculate-Pi
[22:58:55] saadq: has joined #ruby
[22:59:04] shevy: Encapsulation oh you are here! encapsulate all of us!!!
[22:59:18] bklane: has joined #ruby
[22:59:54] ruurd: Gregory-Leibniz series
[23:00:24] JeramyRR: has joined #ruby
[23:00:25] ruurd: Just increase the number of terms until the n-th term stabilizes
[23:03:49] duoi: has joined #ruby
[23:04:06] duoi: has joined #ruby
[23:05:26] mary5030: has joined #ruby
[23:05:39] nfk: has joined #ruby
[23:06:43] rushed: has joined #ruby
[23:06:57] dgutierrez1287: has joined #ruby
[23:07:00] mikefulcher: has joined #ruby
[23:07:54] NeverDie: has joined #ruby
[23:07:56] bklane: has joined #ruby
[23:09:48] jhack: has joined #ruby
[23:09:54] hj2007: has joined #ruby
[23:10:00] Igorshp: has joined #ruby
[23:12:20] gambl0re: has joined #ruby
[23:13:41] gamename: has joined #ruby
[23:13:47] devbug: has joined #ruby
[23:15:50] bungoman: has joined #ruby
[23:15:55] juanpablo_: has joined #ruby
[23:16:11] ndrei: has joined #ruby
[23:18:44] bklane: has joined #ruby
[23:19:29] Ropeney: has joined #ruby
[23:19:36] grimly: has joined #ruby
[23:22:10] CloCkWeRX: has joined #ruby
[23:26:32] rushed: has joined #ruby
[23:28:46] iateadonut: has joined #ruby
[23:33:18] jhack: has joined #ruby
[23:33:45] jhack: has joined #ruby
[23:34:19] xkickflip: has joined #ruby
[23:34:29] sarkyniin: has joined #ruby
[23:34:41] arescorpio: has joined #ruby
[23:35:25] havenwood: has joined #ruby
[23:35:28] xkickflip: has joined #ruby
[23:39:22] bklane: has joined #ruby
[23:39:26] Renich: has joined #ruby
[23:40:56] baweaver: has joined #ruby
[23:42:08] evo2020: has joined #ruby
[23:42:48] fullofcaffeine: has joined #ruby
[23:42:51] eggoez: has joined #ruby
[23:43:22] atomical: has joined #ruby
[23:44:05] TheNet: has joined #ruby
[23:45:14] danielpclark: has joined #ruby
[23:49:20] d1n: has joined #ruby
[23:49:45] gamename: has joined #ruby
[23:51:21] quazimodo: has joined #ruby
[23:51:25] quazimod1: has joined #ruby
[23:51:53] voker57: has joined #ruby
[23:52:55] bungoman: has joined #ruby
[23:53:05] devbug: has joined #ruby
[23:54:02] nb_bez___: has joined #ruby
[23:55:29] RegulationD: has joined #ruby
[23:56:34] shevy: ruby ruby ruby
[23:57:50] Ox0dea: Which is the most sensible base class for named tuples: Hash, Struct, or BasicObject?
[23:59:29] bklane: has joined #ruby
[23:59:36] hj2007: has joined #ruby