« Back to channel list

#ruby - 03 July 2015

« Back 1 day Forward 1 day »
[00:00:14] Senjai: I'm fine with that, I just feel like its probably worth raising an issue on Teaspoon about it
[00:00:35] freerobby: has joined #ruby
[00:01:05] Niandalu: has joined #ruby
[00:02:21] Senjai: Niandalu: NO
[00:02:48] pengin: has joined #ruby
[00:03:51] crdpink2: has joined #ruby
[00:06:44] ruby-lang111: has joined #ruby
[00:13:39] Akagi201: has joined #ruby
[00:14:44] Axsuul: has joined #ruby
[00:14:53] millerti: has joined #ruby
[00:15:31] Niandalu`: has joined #ruby
[00:17:38] mrmargolis: has joined #ruby
[00:17:52] nateberkopec: has joined #ruby
[00:18:56] Ox0dea: Senjai: The C source indicates that only brackets are treated like they are in regular expressions, so you can't group or negate a whole string.
[00:19:40] Ox0dea: You could put together a character class that will match everything but "legacy", but that's gross.
[00:20:50] jtdoncas: has joined #ruby
[00:21:44] sevenseacat: has joined #ruby
[00:22:06] luckyno7: has joined #ruby
[00:27:10] Channel6: has joined #ruby
[00:27:46] s2013: has joined #ruby
[00:28:07] astrobunny: has joined #ruby
[00:28:22] michael_mbp: has joined #ruby
[00:28:39] baweaver: has joined #ruby
[00:29:49] drPoggs: has joined #ruby
[00:29:52] elektronaut: has joined #ruby
[00:30:08] Scripore: has joined #ruby
[00:30:21] _whitelogger: has joined #ruby
[00:32:34] s2013: has joined #ruby
[00:34:36] findaway: has joined #ruby
[00:34:39] axilla_: has joined #ruby
[00:34:55] mrmargolis: has joined #ruby
[00:37:13] Oog: has joined #ruby
[00:40:14] i8igmac: has joined #ruby
[00:42:40] Tarkers34: regex to match all numbers, regardless of how many decimal points are in them? I literally mean that, even if a "number" has 4 decimal points. So it would match: 3, 4.4, 5.554, 543. However, with this string ".." it would have 2 match groupsL and
[00:43:23] Tarkers34: my attempt was /[+-]?(?=\d*)(?=\.?\d)\d*\.?\d*(?:[+-]?\d+)?/, gone very arwy :(
[00:44:15] stoodfarback: Ox0dea: Could you? I tried for a few minutes, couldn't think of a way.
[00:44:44] jfarmer: Tarkers34 Decimal points can't follow each other?
[00:44:56] jfarmer: I assume like "2..4" is bad
[00:45:00] jaxxstorm: has joined #ruby
[00:45:14] Tarkers34: jfarmer, yeah that's it. Decimal points can't follow each other :)
[00:45:15] roryhughes: has joined #ruby
[00:45:23] iooner: has joined #ruby
[00:45:26] teotwaki: has joined #ruby
[00:46:16] Pupeno: has joined #ruby
[00:46:29] ruboto: I don't know anything about regexp
[00:46:40] Tarkers34: A test string could be ".45.5xei68.6g5554.4343.23232...43323...4"
[00:46:51] Tarkers34: no worries, it's tricky stuff regex haha
[00:47:08] zenspider: you might want to try on http://rubular.com
[00:47:39] zenspider: put all the data it could match in the text box, and your regexp in the regxp box, tweak until it looks right
[00:48:03] Dwarf: has joined #ruby
[00:48:38] Tarkers34: zenspider : Yeah thought I had it http://rubular.com/r/GEWyQU04Nc :( the match groups are all wrong though...those aren't isolated groups (rubular isn't showing the matches for some reason, at least not for me)
[00:49:56] Tarkers34: it's matching 'number' fragments, and they're right next to each other...it isn't working :/
[00:50:34] dfockler: has joined #ruby
[00:50:42] zenspider: wow. that quickref is useless
[00:50:46] ruboto: http://www.zenspider.com/Languages/Ruby/QuickRef.html
[00:51:10] zenspider: Tarkers34: (?=) zero-width positive look-ahead assertion
[00:51:16] zenspider: why are you using that?
[00:51:59] jfarmer: You souldn't need to.
[00:52:35] Tarkers34: yeah I'm not great at regex :P
[00:52:46] zenspider: no, just answer the question
[00:53:03] zenspider: self deprecation won't make you better. thinking about the problem will.
[00:54:24] sharpmachine: has joined #ruby
[00:54:40] zenspider: ruboto: regexp is Read http://www.zenspider.com/Languages/Ruby/QuickRef.html#regexen and use http://rubular.com to experiment
[00:55:53] willharrison: has joined #ruby
[00:57:13] Obfuscate: Tarkers34: Why not just \d+(\.\d+)*
[00:58:27] Obfuscate: If you really need something complex, then you might want to try negative look-ahead instead: e.g. \.(?!\.)
[01:00:19] workmad3: has joined #ruby
[01:00:41] Tarkers34: Obfuscate: I tried someonething like that earlier...match groups just don't work though regex = /\d+(\.\d+)*/ https://gist.github.com/anonymous/a7a037e7de6beb976062
[01:01:12] Tarkers34: hey I'm going to bed now, thanks very much for your help guys I'll look at it tomorrow
[01:02:13] Obfuscate: Tarkers34: Just wrap it in an extra set of parentheses.
[01:02:26] jfarmer: Tarkers34 You can reference match groups in the regex itself
[01:02:35] jfarmer: like (some_group).\1+
[01:02:41] jpfuentes2: has joined #ruby
[01:04:42] Obfuscate: There's no need for backreferences there (and one should try hard to avoid them when possible).
[01:05:33] nateberkopec: has joined #ruby
[01:05:45] Obfuscate: Tarkers34: /(\d+(?:\.\d+)*)/
[01:05:48] fgo: has joined #ruby
[01:06:20] Obfuscate: ACTION evaporates.
[01:07:05] toretore: has joined #ruby
[01:09:36] lolmaus: has joined #ruby
[01:12:23] arescorpio: has joined #ruby
[01:12:51] workmad3: has joined #ruby
[01:14:48] zenspider: Obfuscate: generally... we want people to try to solve their own problems, rather than just handing them it. helps them learn
[01:17:53] nodeworm: has joined #ruby
[01:18:44] sarkyniin: has joined #ruby
[01:19:22] robbyoconnor: has joined #ruby
[01:19:58] luckyno7: has joined #ruby
[01:20:58] bonhoeffer: has joined #ruby
[01:21:01] Obfuscate: zenspider: Fair enough. I could have handled it better.
[01:21:30] Helheim: has joined #ruby
[01:22:10] araujo: has joined #ruby
[01:22:45] gf3: has joined #ruby
[01:27:54] d0lph1n98: has joined #ruby
[01:28:07] jpfuentes2: has joined #ruby
[01:29:03] workmad3: has joined #ruby
[01:29:33] d0lph1n98: has joined #ruby
[01:30:33] Indian: has joined #ruby
[01:31:19] rickmasta: has joined #ruby
[01:31:53] akkad: has joined #ruby
[01:32:11] havenwood: has joined #ruby
[01:33:51] tkuchiki: has joined #ruby
[01:33:56] martinma4: has joined #ruby
[01:35:03] tkuchiki_: has joined #ruby
[01:35:14] brain_shim: has joined #ruby
[01:35:50] findaway: has joined #ruby
[01:35:59] Ox0dea: Obfuscate: No need for the outer parentheses, right?
[01:36:55] Obfuscate: Ox0dea: Correct, for ruby at least, since they seem to be implicit.
[01:40:50] JeramyRR: has joined #ruby
[01:40:53] _blizzy_: has joined #ruby
[01:43:53] fantazo: has joined #ruby
[01:44:21] bruno-: has joined #ruby
[01:46:55] Aswebb_: has joined #ruby
[01:46:55] Jamo_: has joined #ruby
[01:48:39] ooesili: has joined #ruby
[01:50:58] bigkevmcd: has joined #ruby
[01:51:05] Vile`: has joined #ruby
[01:52:07] agent_white: has joined #ruby
[01:55:02] bradleyprice: has joined #ruby
[01:59:20] charliesome: has joined #ruby
[01:59:21] arooni-mobile: has joined #ruby
[02:00:12] sporkmonger: has joined #ruby
[02:00:47] sporkmonger: has left #ruby: ()
[02:02:57] rickmasta: has joined #ruby
[02:05:25] baweaver: has joined #ruby
[02:06:08] swgillespie: has joined #ruby
[02:07:44] ryez: has joined #ruby
[02:10:52] bf4: has joined #ruby
[02:11:45] jpfuentes2: has joined #ruby
[02:12:42] Ox0dea: baweaver: With or without invocation?
[02:12:48] Ox0dea: Or do you reckon now's not the time?
[02:12:57] CloCkWeRX: has joined #ruby
[02:12:57] baweaver: Ping me later tonight when I get home
[02:13:04] Ox0dea: Copy that.
[02:13:04] baweaver: probably around 9 PST
[02:13:18] baweaver: Finishing up some code for review before I call in for a nice long weekend
[02:13:38] mleung: has joined #ruby
[02:16:28] bonhoeffer: has joined #ruby
[02:17:11] Indian: has joined #ruby
[02:19:24] Vile`: has joined #ruby
[02:21:07] idafyaid: has joined #ruby
[02:21:07] idafyaid: has joined #ruby
[02:21:07] mrmargolis: has joined #ruby
[02:21:49] gambl0re: has joined #ruby
[02:22:31] jack_rabbit: has joined #ruby
[02:25:26] hololeap: has joined #ruby
[02:28:27] rawtext: has joined #ruby
[02:29:52] symm-: has joined #ruby
[02:30:50] jenrzzz: has joined #ruby
[02:31:30] haudoing: has joined #ruby
[02:31:54] JeramyRR: has joined #ruby
[02:33:02] haudoing: anyone know how to use chef?
[02:33:11] haudoing: I have a newbie question..
[02:33:14] balazs: has joined #ruby
[02:35:08] sharpmachine: has joined #ruby
[02:35:17] _blizzy_: has joined #ruby
[02:36:03] Akagi201: has joined #ruby
[02:37:42] centrx: haudoing, See also #chef
[02:37:54] centrx: haudoing, Also, daytime America/Europe is more active in general
[02:37:56] bigkevmcd: has joined #ruby
[02:38:20] haudoing: centrx: hey thanks for reply!
[02:39:20] centrx: You are welcome
[02:39:23] haudoing: centrx: seems like there is very less chef on freenode..
[02:39:45] haudoing: centrx: so that's one of the reason I came :)
[02:40:05] cytoskeletor: has joined #ruby
[02:40:27] centrx: It's a quiet time on Freenode, 10:30PM here
[02:41:41] brain_shim: has joined #ruby
[02:42:00] devbug: has joined #ruby
[02:42:29] haudoing: centrx: it's 10:42 AM here Taiwan
[02:43:05] _blizzy_: has joined #ruby
[02:43:32] sevenseacat: timezones. how do they work?
[02:44:28] radialneon: has joined #ruby
[02:44:32] Akagi201_: has joined #ruby
[02:44:52] sevenseacat: as centrx said, it's a quiet time right now.
[02:46:09] amclain: has joined #ruby
[02:47:05] Pupeno: has joined #ruby
[02:50:03] m3_del: has joined #ruby
[02:52:20] darkf: has joined #ruby
[02:52:31] brain_shim: has joined #ruby
[02:54:34] haudoing: oh.. I thought your "they" imply to "timezones"
[02:55:08] haudoing: anyway gnsd
[02:58:17] cirn0: has joined #ruby
[02:58:53] mleung: has joined #ruby
[03:01:08] Axsuul: has joined #ruby
[03:04:02] bigkevmcd: has joined #ruby
[03:04:36] arup_r: has joined #ruby
[03:08:06] danielpclark: has joined #ruby
[03:08:18] Ropeney: has joined #ruby
[03:09:05] behrz: has joined #ruby
[03:10:05] braincras: has joined #ruby
[03:10:41] cytoskeletor: has joined #ruby
[03:10:43] CloCkWeRX: has joined #ruby
[03:10:49] willharrison: not ruby related but does anyone in here have rsi?
[03:11:21] devbug_: has joined #ruby
[03:11:45] ecksit: has joined #ruby
[03:13:42] lessless: has joined #ruby
[03:15:38] Deele: has joined #ruby
[03:15:57] devbug: has joined #ruby
[03:17:16] stoodfarback: has joined #ruby
[03:18:55] ItSANgo_: has joined #ruby
[03:20:34] balazs: has joined #ruby
[03:22:36] balazs: has joined #ruby
[03:23:01] pgatt: has joined #ruby
[03:27:04] gix: has joined #ruby
[03:27:48] iateadonut: has joined #ruby
[03:29:56] solocshaw: has joined #ruby
[03:30:58] mbff: has joined #ruby
[03:31:37] mbff: Question: Do I use "bundle/setup" when creating gems? Or is bundle/setup just for creating ruby applications
[03:32:30] nofxx: mbff, it's bundle install , or bundle update
[03:32:37] m3_del: has joined #ruby
[03:32:51] mbff: no like as an alternative to requiring all your gems
[03:33:02] mbff: you can just use bundle/setup I believe.
[03:33:58] nofxx: mbff, hmm.. didn't knew. as in require 'bundle/setup' ? guess it's not for gems as gems don't use a lock
[03:35:42] Aswebb_: has joined #ruby
[03:35:50] devbug_: has joined #ruby
[03:35:59] m3_del: has joined #ruby
[03:36:12] sharpmachine: has joined #ruby
[03:38:21] astrobun_: has joined #ruby
[03:39:13] auzty: has joined #ruby
[03:39:43] mleung: has joined #ruby
[03:40:13] skade: has joined #ruby
[03:43:37] renderful: has joined #ruby
[03:46:15] StephenOTT: has joined #ruby
[03:48:43] houhoulis: has joined #ruby
[03:49:46] yeticry: has joined #ruby
[03:50:12] sharpmachine: has joined #ruby
[03:50:29] Oog: has joined #ruby
[03:50:29] balazs: has joined #ruby
[03:51:57] fgo: has joined #ruby
[03:52:38] radialneon: has left #ruby: ("Leaving")
[03:53:13] havenwood: has joined #ruby
[03:53:58] radialneon: has joined #ruby
[03:56:35] Nuck: has joined #ruby
[03:58:53] balazs: has joined #ruby
[04:00:19] gix: has joined #ruby
[04:01:13] nodeworm: has joined #ruby
[04:02:13] devbug: has joined #ruby
[04:02:29] chouhoulis: has joined #ruby
[04:03:43] Oog: has joined #ruby
[04:06:59] baweaver: has joined #ruby
[04:07:22] michael_mbp: has joined #ruby
[04:08:40] sharpmachine: has joined #ruby
[04:09:40] rickmasta: has joined #ruby
[04:10:40] dgutierrez1287: has joined #ruby
[04:10:45] MEATCHICKEN: has joined #ruby
[04:12:45] oliver___: has joined #ruby
[04:17:10] vdamewood: has joined #ruby
[04:19:04] pepperbreath: has left #ruby: ()
[04:19:24] sharpmachine: has joined #ruby
[04:22:29] devbug_: has joined #ruby
[04:25:03] rushed: has joined #ruby
[04:27:16] Randroid: has joined #ruby
[04:28:44] psyprus: has joined #ruby
[04:29:53] michael_mbp: has joined #ruby
[04:33:32] revath: has joined #ruby
[04:34:00] skade: has joined #ruby
[04:34:56] revath: has left #ruby: ()
[04:35:06] chrisco: has joined #ruby
[04:35:44] blahwoop: has joined #ruby
[04:35:53] blahwoop: hi all, im writing a caesar cipher rot-13. i can get it to work for all the letters but i don't know how to ignore the spaces and keep the spaces or any other non characters
[04:36:07] Aeyrix: What's your current code?
[04:36:29] baweaver: Ox0dea: little later than I wanted to get home
[04:36:37] baweaver: What fresh hell have you brought me tonight?
[04:38:37] chrisco: has joined #ruby
[04:39:09] blahwoop: Aeyrix: https://gist.github.com/iRichLau/c5e76ebdc29f9a147cdc
[04:39:47] fgo: has joined #ruby
[04:39:54] blahwoop: basically i just need it to ignore the spaces or non letters
[04:40:16] jpfuentes2: has joined #ruby
[04:40:34] s2013: has joined #ruby
[04:43:21] devbug: has joined #ruby
[04:45:38] CloCkWeRX: has joined #ruby
[04:47:35] Al3ks: has joined #ruby
[04:47:48] Pupeno: has joined #ruby
[04:47:55] jenrzzz: has joined #ruby
[04:50:00] revath: has joined #ruby
[04:50:10] iamninja: has joined #ruby
[04:57:24] Aeyrix: blahwoop: eh
[04:57:36] Aeyrix: cipher(rotation)[letter] unless letter == ' '
[04:57:47] tyl: has joined #ruby
[04:59:04] tyl: Hi, Is having an activerecord object with less attributes more efficient? in irb when you type ObjectSpace.memsize_of("ActiveRecordObject") most of the activerecord instances are of the same size despite having less attributes
[05:00:19] pontiki: hello folks
[05:00:40] baweaver: tyl #RubyOnRails
[05:01:01] baweaver: short: it doesn't matter enough to care
[05:01:44] keen__________10: has joined #ruby
[05:01:47] blahwoop: Aeyrix: i went with return letter if /[^a-zA-Z]/.match(letter) right above that cipher method
[05:01:58] baweaver: If it does you either need to rethink your database or use a different framework
[05:02:21] Aeyrix: blahwoop: Slightly more efficient to only do the substitution if it's a letter
[05:02:31] havenwood: pontiki: hey
[05:02:39] Aeyrix: as opposed to doing the sub and only returning it if it's a letter
[05:03:08] tyl: baweaver I have asked rubyonrails but they don't seem to know how rails is loading the activerecord object, so I was thinking since this has more to do with the mem a ruby object holds I should just ask it here. in other languages like C++ i have found if an object instance is big it takes more cycles when it goes through the cpu
[05:03:50] baweaver: >> alpha = [*?a..?z,*?A..?Z]
[05:03:51] ruboto: baweaver # => ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", ...check link for more (https://eval.in/391392)
[05:03:52] blahwoop: Aeyrix: the problem is it wont decrypt properly
[05:03:57] Aeyrix: tyl: Is having an engine with less cylinders more efficient?
[05:04:04] peter_paule: has joined #ruby
[05:04:05] Aeyrix: blahwoop: Same on decrypt.
[05:04:06] baweaver: >> alpha = [*?a..?z,*?A..?Z]; alpha['a']
[05:04:07] ruboto: baweaver # => no implicit conversion of String into Integer (TypeError) ...check link for more (https://eval.in/391394)
[05:04:23] baweaver: >> alpha = [*?a..?z,*?A..?Z].join; alpha['a']
[05:04:24] ruboto: baweaver # => "a" (https://eval.in/391395)
[05:04:43] tyl: Aeyrix no assuming the cylinders are the same
[05:04:49] baweaver: >> alpha = [*?a..?z,*?A..?Z].join; alpha['1']
[05:04:50] ruboto: baweaver # => nil (https://eval.in/391397)
[05:04:52] Aeyrix: tyl: Unless... ?
[05:04:58] darlinger: has joined #ruby
[05:05:17] baweaver: tyl: There are far more important things to worry about. Of course larger objects are slower
[05:05:31] tyl: aeyrix you mean efficiency in terms of going from point a to b faster?
[05:05:50] Aeyrix: tyl: Economy.
[05:05:54] blahwoop: Aeyrix: i tried it. it just gives me all in one word no spaces
[05:06:24] baweaver: >> [*?a..?z,*?A..?Z].join =~ /c/
[05:06:25] ruboto: baweaver # => 2 (https://eval.in/391403)
[05:06:39] tyl: Aeyrix i guess smaller cc cars are always said to be more econimical
[05:06:43] Aeyrix: tyl: Unless?
[05:06:46] tkuchiki: has joined #ruby
[05:07:16] darlinger: hey I need a little help with a ruby exercise I'm doing. I'm building a towers of hanoi game as an object with instance variables as arrays representing the disks and pegs for the game. I can't think of a good way to take user input to designate the pegs.
[05:07:24] darlinger: I'll gist the code in a second
[05:07:30] baweaver: >> alpha = [*?a..?z,*?A..?Z].join; pos = alpha =~ /c/; alpha[(pos + 13) % 52]
[05:07:31] tyl: baweaver this kinda goes reverse from most of the computer languages i have learnt, usually we really care about the size of the object in the memory
[05:07:31] ruboto: baweaver # => "p" (https://eval.in/391404)
[05:07:46] baweaver: >> alpha = [*?a..?z,*?A..?Z].join; pos = alpha =~ /Z/; alpha[(pos + 13) % 52]
[05:07:47] ruboto: baweaver # => "m" (https://eval.in/391405)
[05:07:58] baweaver: rotating alphabet <3
[05:07:59] tyl: hmmm i'll have to just conduct some test to see i guess
[05:08:01] Aeyrix: tyl: You're caring about optimising the wrong thing entirely.
[05:08:03] darlinger: https://gist.github.com/c824a205ae13d6868c02
[05:08:08] Aeyrix: You're not answering my questions, which will help you answer yours.
[05:08:26] tyl: well i am not sure why it would not be less uneconomical
[05:08:27] baweaver: blahwoop: see my mad stream above
[05:08:28] Aeyrix: The "unless" is "unless you need the power". You can't run a minesite truck on a tiny four cylinder engine.
[05:08:35] tyl: i guess only if the person steps on the acceperator
[05:08:38] tyl: accelerator
[05:08:46] Aeyrix: [15:08:26] <Aeyrix> The "unless" is "unless you need the power". You can't run a minesite truck on a tiny four cylinder engine.
[05:08:51] niemcu: has joined #ruby
[05:08:54] darlinger: i just need to know how to take input from gets to specify instance variables in an object
[05:08:54] Aeyrix: If you need an AR object with 30 attributes
[05:09:01] Aeyrix: you need an AR object with 30 attributes
[05:09:05] pontiki: darlinger: without looking at the gist; what i would think of is the *only* input you have for TOH is from peg and to peg, all you should need is 1, 2 or 3, 1
[05:09:05] Aeyrix: you can't optimise that away
[05:09:19] tyl: Aeyrix i don't actually need all the attributes like all of them time
[05:09:21] jfarmer: tyl Comparatively speaking, among all the the things put into memory when you instantiate a new AR object, the number of attributes is insignificant
[05:09:28] sevenseacat: tyl: sounds like in the past you've been dealing with a lot lower-level languages
[05:09:31] tyl: some of them could be put into a different table
[05:09:39] sevenseacat: Ruby is a very high-level language
[05:09:50] Aeyrix: tyl: If it's related to one model
[05:09:52] Aeyrix: put them on that model
[05:09:58] Aeyrix: don't push them around places trying to save memory
[05:10:03] baweaver: which cares very little for memory economy
[05:10:05] sevenseacat: we care more about better ways to do things, than micro-optimizing every byte of memory
[05:10:18] jfarmer: tyl It's like you're looking at two bathtubs and wondering if the one that has a slightly dimpled floor is more water-efficient.
[05:10:20] baweaver: High level languages focus on solving problems themselves
[05:10:20] darlinger: pontiki: but how do i take that input and use it to designate the pegs within the object?
[05:10:35] sevenseacat: jfarmer: nice analogy.
[05:11:07] darlinger: pontiki: i was thinking possibly an if statement that just returns the identifier for the array depending on the input
[05:11:08] havenwood: jfarmer: what pattern are the dimples? bumping up or down?
[05:11:11] Wolland: has joined #ruby
[05:11:26] sevenseacat: who cares if one bathtub is foot shorter than the other, or made out of steel instead of ceramic
[05:11:33] rickmasta: has joined #ruby
[05:11:34] sevenseacat: or is missing a plughole
[05:11:37] Aeyrix: people who dislike steel?
[05:11:43] baweaver: the point is that while some would focus on getting memory efficiency up and keeping objects down, another could have a basic blogging site already done.
[05:11:51] pontiki: hum, darlinger, i thought the question was how to represent and request the input
[05:12:00] baweaver: some can do that in 15 minutes
[05:12:08] baweaver: god speed trying that in C++/C/Java
[05:12:10] pontiki: i apologize, i haven't got mental bandwidth to go deeper
[05:12:18] tyl: baweaver well the main app is finished already I am just looking at weaknesses in the code
[05:12:29] jfarmer: tyl Put another way: by the point you've decided to use an ActiveRecord object (or even Ruby, really), you're well past the point of caring about low-level memory optimizations.
[05:12:31] jfarmer: That ship has sailed.
[05:12:44] tyl: i usually do optimisation during the refactor stage
[05:12:48] baweaver: Focus on N+1 queries
[05:12:55] baweaver: that's going to be your biggest win
[05:12:56] sevenseacat: you've got bigger weaknesses to worry about than memory allocation of AR objects.
[05:13:02] mrmargolis: has joined #ruby
[05:13:03] tyl: jfarmer yeah i see the philosophy here
[05:13:08] sevenseacat: get something like bullet to detect common problems
[05:13:16] jfarmer: tyl I wouldn't call it a "philosophy" ??? it's a statement of fact.
[05:13:18] tyl: its a different type of mindset you have to have
[05:13:21] darlinger: pontiki: yes. i get that the user would use 1, 2, or 3 to designate pegs. but how do I take that strings from input and use them to designate variables?
[05:13:47] jfarmer: If you care about memory efficiency at that level then you shouldn't use Ruby (or Python or other high-level, interpreted, dynamically-typed languages).
[05:14:40] jenrzzz: has joined #ruby
[05:14:53] jfarmer: It's just the wrong tool if that's honestly your priority.
[05:15:35] speaking1ode: has joined #ruby
[05:15:39] tkuchiki: has joined #ruby
[05:16:15] baweaver: If you _really_ need speed, better frameworks are Yesod, Scotty, Play, and Phoenix
[05:16:47] baweaver: Warp in Haskell is extremely fast
[05:16:59] abuzze: has joined #ruby
[05:17:02] jfarmer: tyl I'll put it a third and final way: if you want to optimize the memory usage of your Ruby apps, the win you get by allocating one fewer object will dwarf virtually any optimization you could practically make to the memory usage of a particular class of objects.
[05:17:29] cirn0: has joined #ruby
[05:18:35] workmad3: has joined #ruby
[05:19:20] jfarmer: tyl If you're comfortable with C, you should go look at the stock Ruby interpreter's source code (https://en.wikipedia.org/wiki/Ruby_MRI)
[05:19:40] tyl: I'll have a look at it when i have a chance
[05:19:40] pipework: I would suggest measuring to determine what needs looking at. Only then should you consider how you should rectify it.
[05:19:42] SOLDIERz: has joined #ruby
[05:19:53] pipework: benchmarking and profiling.
[05:20:02] tyl: pipework thats what i intend to do later
[05:20:18] cirn0: has joined #ruby
[05:20:26] pipework: tyl: Ah then do it later and don't worry now.
[05:20:46] sharpmachine: has joined #ruby
[05:20:50] pontiki: steps to beautiful code: 1) make it work. 2) make it pretty. 3) make it fast.
[05:20:50] havenwood: tyl: In Rubyland Rails is quite a heavyweight in general. Compare for example with Roda and Sequel. Here're some non-db plain ole "Hello World" memory comparisons per request for various Ruby frameworks: https://github.com/luislavena/bench-micro#memory-allocationrequest
[05:21:06] baweaver: Amusingly Warp and Yesod give Phoenix a run for its money, if not leave it in the dust in some cases.
[05:21:11] baweaver: Though you have to learn Haskell
[05:21:25] jfarmer: Yeah. Every single request to a Rails app is going to generate hundreds of String and/or Symbol objects.
[05:21:40] havenwood: ngx_mruby smokes all of the above
[05:21:51] bruno-: has joined #ruby
[05:21:53] pontiki: yesod is kind of freaky
[05:21:56] havenwood: apples and oranges
[05:21:58] tyl: havenwood thanks for the link
[05:22:16] darlinger: is there an easy way to write a conditional like "if variable is equal to this or that"?
[05:22:23] havenwood: tyl: Do take a look at Roda, it's lovely to use. I've heard good things about Lotus but not used it personally.
[05:22:30] baweaver: Really all things being equal all of those above are within the same order of magnitude
[05:22:39] tyl: jfarmer according to this old 2.x rails report its about 8,500 objects per request
[05:22:42] baweaver: anything past that is splitting hairs honestly.
[05:22:42] tyl: http://merbist.com/2010/07/29/object-allocation-why-you-should-care/
[05:23:11] sevenseacat: yes, thats an old rails 2.x report
[05:23:23] jfarmer: tyl Anything about Rails 2 is irrelevant at this point, really.
[05:23:35] baweaver: tyl: We have two startup teams. One focuses on getting something out the door no matter how slow it is, the other focuses on making it fast. Who's going to win?
[05:23:41] tyl: yeah but it kinda gives you a ballpark figure
[05:23:45] pipework: tyl: Not really.
[05:23:49] pipework: Things have changed a lot since then.
[05:23:53] sevenseacat: no, it really doesn't.
[05:24:01] jfarmer: Rails 2 and Rails 3 are very different things internally
[05:24:01] pipework: Try to keep within 2 years.
[05:24:11] pipework: And ruby has changed since then.
[05:24:15] baweaver: The first team would destroy the second, hands down. Fast counts for junk if you're not the first out the door.
[05:24:15] sevenseacat: try to keep within at least the last major version
[05:24:33] tyl: baweaver the app is done already i am just looking at where code could be improved, yes I do realize the main goal of a startup is to get stuff out of the door asap
[05:24:36] pipework: baweaver: Win what?
[05:24:45] pipework: Getting to market first?
[05:24:53] sevenseacat: tyl: again, new relic, bullet. go. play.
[05:24:58] Aswebb_: has joined #ruby
[05:25:17] baweaver: getting to market is most of the battle. If you can crank new features faster than the other team can think you're going dominate
[05:25:33] baweaver: of course other factors abound, yes
[05:25:53] stoodfarback: has joined #ruby
[05:25:54] baweaver: then again you could also react substantially faster to said factors as well.
[05:26:39] tyl: rails 4 seems around 2740 compared to rails 2 1820 for the example quoted in this blog
[05:26:43] tyl: https://blog.newrelic.com/2014/04/25/ponies-rails-adequaterecord/
[05:26:54] tyl: sevenseacat yeah i am looking through
[05:26:57] brain_shim: has joined #ruby
[05:28:10] dhjondoh: has joined #ruby
[05:33:23] Oog: has joined #ruby
[05:35:23] Akagi201: has joined #ruby
[05:38:03] tyl: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[05:39:00] rushed: has joined #ruby
[05:39:21] duncannz: has joined #ruby
[05:39:49] krz: has joined #ruby
[05:41:08] lolmaus: has joined #ruby
[05:42:18] khebbie: has joined #ruby
[05:42:43] bluOxigen: has joined #ruby
[05:43:07] fgo: has joined #ruby
[05:43:07] apofis: has joined #ruby
[05:44:37] djbkd: has joined #ruby
[05:44:40] gianlucadv: has joined #ruby
[05:45:43] s2013: has joined #ruby
[05:46:18] Akagi201: has joined #ruby
[05:46:22] yfeldblum: has joined #ruby
[05:47:20] Royalb15: has joined #ruby
[05:47:53] yfeldblum: has joined #ruby
[05:49:18] shevy: ponies on rails!
[05:51:10] NightMonkey: has joined #ruby
[05:51:11] shevy: "Memory usage climbed to 131MB, confirming my hypothesis that a Rails version is worth approximately 7 floppy disks."
[05:51:22] dagda1: has joined #ruby
[05:52:11] ramfjord: has joined #ruby
[05:52:11] tvw: has joined #ruby
[05:53:12] Pupeno: has joined #ruby
[05:56:48] Radar: Hey, /variant|stock|barcode|(?<!feature\s)option/i <- What does the ?<! mean here in this regex?
[05:57:03] shaman42: has joined #ruby
[05:57:13] swiftynb: has joined #ruby
[05:57:23] swiftynb: is anyone alive?
[05:57:53] tekacs: has joined #ruby
[05:58:20] swiftynb: @radar what do you say to this
[05:58:35] swiftynb: http://pastebin.com/7ivPewuT
[05:58:36] ruboto: swiftynb, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/ea1324a0ef6991f1ad10
[05:58:36] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[05:58:40] Radar: Awww snap
[05:59:03] Radar: Someone is heavily invested in PHP / Asp.net :)
[05:59:25] swiftynb: lol, i have not done any php for like 6 years
[05:59:27] arup_r: has joined #ruby
[05:59:34] Radar: There's a good future in both Ruby + Python.
[05:59:37] swiftynb: but apperently ruby is "garbage" and i should pay him
[05:59:38] Radar: They're not dead.
[05:59:42] Radar: No, he's an idiot.
[05:59:51] Radar: That's just like my opinion
[05:59:52] Oog: has joined #ruby
[06:00:13] swiftynb: lol, i just don't want to relearn php and would rather pay someone to use a language i have exp with >_>
[06:00:22] Trynemjoel: has joined #ruby
[06:00:24] swiftynb: cause php sucks ballz
[06:00:44] tbuehlmann: "is not so secure" brought a big smile to my face
[06:00:58] pontiki: [citation needed]
[06:01:14] Oog: has joined #ruby
[06:01:40] swiftynb: he wants like $500 to make a simple 5 page wordpess site...... no login functions or anything like that
[06:01:40] ta: has joined #ruby
[06:02:00] Radar: How many hours do you expect it to take?
[06:02:04] tbuehlmann: totally agreeing with radar. that person has a strong opinion here, not reflecting reality accurately
[06:02:50] chinmay_dd: has joined #ruby
[06:03:23] howdoi: has joined #ruby
[06:03:33] swiftynb: lol well all i wanted was a simple 5 page professional site, i could build the entire thing minus the graphics in about an hour.....
[06:04:39] pontiki: then just use jekyll or middleman...
[06:04:42] arup_r1: has joined #ruby
[06:04:50] swiftynb: the oonly thing i was looking for was someone good with graphics and clean layouts and able to write professionally
[06:05:24] pontiki: then you don't want a developer at all!!! LOL
[06:06:00] m3_del: has joined #ruby
[06:07:08] swiftynb: meh, didn't have time to do it myself, now i do/work with a visual artist that is also free that i will pawn most of it off to. Just though that was quite the opinion about ruby any python
[06:07:11] shevy: hire pontiki
[06:07:23] shevy: let her use MS paint
[06:07:33] swiftynb: PAInt IS AMAZING!!!
[06:07:37] pontiki: i don't have MS Paint :(
[06:07:45] swiftynb: I tried adobe stuff and it is hardz
[06:07:46] pontiki: i have to use shit like Corel Painter n stuff
[06:08:04] swiftynb: NO! Microsoft paint is the only option!
[06:08:07] chouhoulis: has joined #ruby
[06:08:20] pontiki: i no have anys MS :(
[06:08:51] swiftynb: NOOB u should be using vista with php like the rest of us
[06:09:12] pontiki: *sniff*sniff*
[06:09:41] pontiki: ACTION weeps in her wheaties
[06:10:51] swiftynb: pontiki: Unignore <_>
[06:11:15] lictor36: has joined #ruby
[06:11:41] pontiki: oh, i'm +g
[06:12:24] swiftynb: idk what that is lol
[06:12:28] pontiki: ok, give it a go, swiftynb
[06:12:48] pontiki: it sets your user so you get to control who can PM
[06:13:35] eGGsha: has joined #ruby
[06:13:50] tagrudev: has joined #ruby
[06:13:59] MatthewsFace: has joined #ruby
[06:15:12] sphex: bah. at this point, the only reason PHP still exists must be because outsourcing PHP web development to India is really cheap.
[06:15:32] riotjones: has joined #ruby
[06:15:48] Stan: has joined #ruby
[06:15:50] shevy: well legacy code
[06:15:55] shevy: phpBB forum and mediawiki
[06:16:09] sevenseacat: *cough wordpress
[06:16:48] shevy: sphex on a game, they were using moin-wiki, which I think is in python; I hated to use it compared to mediawiki, it really was a usability disaster. only phpwiki is worse haha, but it is also simpler in usage
[06:18:13] serivich: has joined #ruby
[06:18:48] Scripore: has joined #ruby
[06:20:52] sphex: eh, yeah.. I guess. the good PHP web apps tend to be *really* good; insane amounts of (cheaper) developer dev time went in them...
[06:21:30] sphex: and when people need them modified they know it can be outsourced easily
[06:21:54] sharpmachine: has joined #ruby
[06:22:45] baweaver: Ox0dea: O_O
[06:24:12] yfeldblum: has joined #ruby
[06:25:03] roolo: has joined #ruby
[06:26:18] tyl: has joined #ruby
[06:29:25] tyl: has left #ruby: ()
[06:29:29] uptownhr: has joined #ruby
[06:32:55] workmad3: has joined #ruby
[06:33:57] khebbie: has joined #ruby
[06:36:27] bigkevmcd: has joined #ruby
[06:37:11] revath: has joined #ruby
[06:37:24] bigkevmcd: has joined #ruby
[06:37:25] jlast: has joined #ruby
[06:39:21] yfeldblum: has joined #ruby
[06:42:37] micmus: has joined #ruby
[06:43:07] ta: has joined #ruby
[06:43:29] skade: has joined #ruby
[06:44:06] Oog: has joined #ruby
[06:44:19] codecop: has joined #ruby
[06:50:16] Dopagod: has joined #ruby
[06:51:24] anisha: has joined #ruby
[06:51:26] lordkryss: has joined #ruby
[06:53:25] rdark: has joined #ruby
[06:54:37] tesuji: has joined #ruby
[06:55:12] dhjondoh: has joined #ruby
[06:55:37] fabrice31: has joined #ruby
[06:55:38] olistik: has joined #ruby
[06:57:22] fabrice31: has joined #ruby
[06:57:47] crdpink: has joined #ruby
[06:59:48] rht: has joined #ruby
[07:01:03] GnuYawk: has joined #ruby
[07:01:51] mrmargolis: has joined #ruby
[07:02:13] crdpink2: has joined #ruby
[07:04:12] fabrice31: has joined #ruby
[07:04:38] Oog_: has joined #ruby
[07:05:15] Sehryn_: has joined #ruby
[07:05:59] fabrice31_: has joined #ruby
[07:06:31] pabs: has joined #ruby
[07:07:09] m3_del: has joined #ruby
[07:07:13] fabrice31_: has joined #ruby
[07:07:52] GnuYawk: has joined #ruby
[07:07:53] GnuYawk: has joined #ruby
[07:07:55] brain_shim: has joined #ruby
[07:08:09] blueOxigen: has joined #ruby
[07:09:38] corecode_: has joined #ruby
[07:09:50] petems_: has joined #ruby
[07:10:29] Freijo: has joined #ruby
[07:10:33] dhjondoh1: has joined #ruby
[07:10:34] sphex_: has joined #ruby
[07:10:50] perrier_: has joined #ruby
[07:10:59] rvchangue_: has joined #ruby
[07:11:01] funnel_: has joined #ruby
[07:11:08] skyjumper: has joined #ruby
[07:11:08] skyjumper: has joined #ruby
[07:11:15] izzol: has joined #ruby
[07:11:16] petems_: has joined #ruby
[07:11:17] drizz: has joined #ruby
[07:11:18] stylus: has joined #ruby
[07:11:21] marens: has joined #ruby
[07:11:25] n1ftyn8_: has joined #ruby
[07:11:29] Helheim_: has joined #ruby
[07:11:30] d0lph1n99: has joined #ruby
[07:11:30] Prira: has joined #ruby
[07:11:40] rdark: has joined #ruby
[07:11:59] certainty: has joined #ruby
[07:12:00] drzel: has joined #ruby
[07:12:19] Heero: has joined #ruby
[07:13:27] Aswebb_: has joined #ruby
[07:14:07] andikr: has joined #ruby
[07:14:21] spleeze: has joined #ruby
[07:16:32] niemcu: has joined #ruby
[07:16:57] terlar: has joined #ruby
[07:17:41] Polysics: has joined #ruby
[07:17:50] eGGsha: has joined #ruby
[07:19:08] alex88: has joined #ruby
[07:19:38] Oog: has joined #ruby
[07:22:42] sharpmachine: has joined #ruby
[07:23:09] klingeldraht: has joined #ruby
[07:23:49] arup_r: has joined #ruby
[07:25:02] xcesariox: has joined #ruby
[07:27:02] khebbie: has joined #ruby
[07:28:07] d0lph1n98: has joined #ruby
[07:29:39] iamninja: has joined #ruby
[07:30:13] tkuchiki: has joined #ruby
[07:32:04] glowcoil_: has joined #ruby
[07:32:16] pjaspers_: has joined #ruby
[07:33:24] daxroc1: has joined #ruby
[07:33:35] glowcoil_: has joined #ruby
[07:34:00] krz: has joined #ruby
[07:36:57] Shoutsid: has joined #ruby
[07:38:33] revdan: has joined #ruby
[07:38:51] blackmesa: has joined #ruby
[07:39:56] senayar: has joined #ruby
[07:40:12] sandelius: has joined #ruby
[07:41:32] coetry: has joined #ruby
[07:41:49] coetry: What are your guys' thoughts on Ruby targeting wasm (web assembly)?
[07:42:21] coetry: and potentially allow ruby to replace javascript as a client side programming language?
[07:43:05] bnagy: there was a big goaround the day of the wasm announce
[07:43:11] coetry: do you guys see this as a new page for the ruby community and more specifically the rails community?
[07:43:13] bnagy: upshot was "maybe mruby"
[07:43:48] coetry: taking the principles of mruby and going even further though, building on that inspiration
[07:44:07] coetry: do you feel the advancements in the web platform can also impact the development of the ruby language and other languages as well?
[07:44:34] dionysus69: has joined #ruby
[07:45:22] doerteDev: has joined #ruby
[07:45:28] jfarmer: has joined #ruby
[07:45:40] contradictioned: can anybody help me with bundler? i am developing on two gems A and B in parallel, thus i have in A's Gemfile an entry 'B', path: '/some/where/B'
[07:46:00] contradictioned: but somehow updates in B are not visible in A
[07:46:18] _blizzy_: has joined #ruby
[07:47:33] contradictioned: i.e. if i add stupid `puts "blabla"` code in B, it is not output when I call the according method in A. is there something i'm loosing sight of?
[07:48:15] towski_: has joined #ruby
[07:48:17] mister_solo: has joined #ruby
[07:49:11] dhjondoh: has joined #ruby
[07:49:36] Nirgali42: has joined #ruby
[07:49:39] aep: has joined #ruby
[07:49:40] scottymeuk: has joined #ruby
[07:49:49] coffeeju1: has joined #ruby
[07:50:01] uptownhr: has joined #ruby
[07:50:07] Aswebb_: has joined #ruby
[07:50:27] apeiros: contradictioned: did you gist your code? (don't have the backlog, so I can't look)
[07:50:27] hagabaka: has joined #ruby
[07:53:28] spectra: has joined #ruby
[07:54:43] coffeecupp: has joined #ruby
[07:55:01] RazorX: has joined #ruby
[07:55:50] unshadow_: has joined #ruby
[07:55:58] k3asd`: has joined #ruby
[07:56:24] Joufflu: has joined #ruby
[07:56:36] brain_shim: has joined #ruby
[07:57:49] konsolebox: has joined #ruby
[07:59:38] konsolebox: has joined #ruby
[07:59:41] contradictioned: apeiros: there's not much code to show ;)
[08:00:10] apeiros: contradictioned: ok. can't help you without code.
[08:00:27] toretore: has joined #ruby
[08:00:47] pontiki: do you bundle update A to get B's updates?
[08:02:14] contradictioned: I've tried, but bundler didn't show any changes
[08:02:27] joonty: has joined #ruby
[08:03:03] ruby-lang693: has joined #ruby
[08:03:18] contradictioned: okay, I bumped the version of B's gemspec, now it works
[08:03:20] fgo: has joined #ruby
[08:04:08] ruby-lang693: Hello, sorry i'm french, Is this tutorial available for ruby 2 ? http://ruby-doc.org/docs/beginner-fr/xhtml/
[08:04:29] contradictioned: but this means, i have to do a version bump for every little code change
[08:04:59] langlands: has joined #ruby
[08:05:11] ruby-lang693: It's a french tutorial
[08:05:21] ruby-lang693: but i don't if it is good for ruby 2
[08:06:05] whiteline: has joined #ruby
[08:06:17] baweaver: 2003 is too old
[08:06:26] Matthews_: has joined #ruby
[08:06:37] baweaver: seeing if I can find anything
[08:06:38] IanV0rn2341: has joined #ruby
[08:07:09] baweaver: though honestly (and take as you will) you would be better served by going with the english versions as they're far more likely to be up to date.
[08:07:12] ton31337: has joined #ruby
[08:07:20] tvb: has joined #ruby
[08:07:21] adaedra: ruby-lang693: bonjour
[08:07:25] ton31337: anyone is using gem 'zk' for zookeeper?
[08:07:34] adaedra: as baweaver said, you will have more luck with english resources
[08:07:35] ruby-lang693: Un francais !
[08:07:35] mikecmpbll: has joined #ruby
[08:07:42] tvb: Hi, I need some help with exception raising and rescueing
[08:07:49] m3_del: has joined #ruby
[08:07:53] ruby-lang693: thank you, have you got a good english tutorial
[08:08:01] revdan: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[08:08:18] sphex: ruby-lang693: everything in that tutorial looks compatible with ruby 2 to me
[08:08:27] adaedra: ruby-lang693: looked at the offical guide? https://www.ruby-lang.org/fr/documentation/quickstart/
[08:08:46] ruby-lang693: Yes but is just for 20 minutes
[08:08:56] baweaver: http://www.dreamincode.net/forums/topic/339753-bestwhich-books/page__view__findpost__p__1968668 - I'd compiled this a bit back, but still useful.
[08:08:57] adaedra: tvb: we can help you if you state your issue
[08:08:58] tvb: got this piece of code: http://pastebin.com/cPXimP7C
[08:08:59] ruboto: tvb, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/ac5e6f0209857bbcfd23
[08:08:59] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[08:09:01] adminc: has joined #ruby
[08:09:03] sphex: ruby-lang693: oh wait.. I didn't check right.
[08:09:16] tvb: adaedra: https://gist.github.com/ac5e6f0209857bbcfd23
[08:09:24] eGGsha: has joined #ruby
[08:09:30] baweaver: sphex: It might be, but 2003 is pushing your luck a bit. Best to stay within 3 years just to avoid fun little gotchas.
[08:09:49] tvb: adaedra: the raise is working if x is 0 but the code is not contineuing
[08:09:56] IanV0rn2341: has joined #ruby
[08:10:13] ruby-lang693: Okay, it's not a good tutorial for ruby 2
[08:10:22] tvb: and if x = 1 or higher I won't get any errors but the result after will be null
[08:10:30] tvb: what am I doing wrong?
[08:10:53] ruby-lang693: But have you got a good english tutorial
[08:11:17] jeanlinux: has joined #ruby
[08:11:22] baweaver: ruby-lang693: see that above link for book recommendations
[08:11:30] bnagy: tvb: don't do anything you're doing in that code :)
[08:11:42] baweaver: past that, look into try-ruby or 'learn ruby the hard way'
[08:11:43] bnagy: if you raise, just raise "whatever"
[08:11:54] sphex: baweaver: yeah.. I would have assumed so. but I don't notice anything deprecated in it.. looks surprisingly good to me. it doesn't seem to cover encodings at all though.
[08:11:55] ton31337: has left #ruby: ()
[08:11:58] bnagy: because mostly you want to be using StandardError
[08:12:09] ryba: has joined #ruby
[08:12:10] baweaver: most people won't touch them honestly.
[08:12:12] bnagy: tvb: also, don't use rescue to set default
[08:12:34] adaedra: ruby-lang693: please note that channel rules state that you shouldn't pm someone without asking first.
[08:12:34] baweaver: semantics, but more specific errors are better for later reference
[08:13:04] tvb: bnagy: "don't do anything you're doing in that code :)" you mean all is wrong?
[08:13:22] baweaver: all is Zuul
[08:13:36] bnagy: tvb: pretty much, yeah, sorry :/
[08:13:56] baweaver: try instead:
[08:13:57] tvb: ok it is my first day of ruby, so what do I need to do different?
[08:14:06] bnagy: tvb: I just explained all that :)
[08:14:11] RazorX: has joined #ruby
[08:14:14] baweaver: >> x = 0; x = x < 0 ? 1 : x
[08:14:15] ruboto: baweaver # => 0 (https://eval.in/391576)
[08:14:21] ruby-lang693: I have this tutorial http://learnrubythehardway.org/book/
[08:14:25] baweaver: >> x = -1; x = x < 0 ? 1 : x
[08:14:26] ruboto: baweaver # => 1 (https://eval.in/391578)
[08:14:35] baweaver: ah, backwards
[08:14:39] bnagy: baweaver: o_0
[08:14:46] adaedra: ruby-lang693: it is often considered as a good resource, yes :)
[08:15:00] blackmesa: has joined #ruby
[08:15:15] bnagy: tvb: x = 1 if x.zero?
[08:15:16] baweaver: >> x = 0; x = if x > 0 then x else 1
[08:15:17] ruboto: baweaver # => /tmp/execpad-ad7c191cdd37/source-ad7c191cdd37:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/391582)
[08:15:19] senayar: has joined #ruby
[08:15:20] baweaver: >> x = 0; x = if x > 0 then x else 1 end
[08:15:21] ruboto: baweaver # => 1 (https://eval.in/391583)
[08:15:27] baweaver: fine, no ternaries.
[08:15:58] baweaver: >> true ? :true : :false # but this is what they do
[08:15:59] ruboto: baweaver # => :true (https://eval.in/391584)
[08:16:03] tvb: bnagy: zero or should not be allowed
[08:16:04] baweaver: >> false ? :true : :false # but this is what they do
[08:16:05] ruboto: baweaver # => :false (https://eval.in/391585)
[08:16:28] bnagy: tvb: oh my bad, I read the logic wrong
[08:17:15] tvb: so should I not raise if the given argument is 0 or lower?
[08:17:35] bnagy: no, because you're rescuing it immediately
[08:17:44] baweaver: tvb: https://gist.github.com/anonymous/ac5e6f0209857bbcfd23
[08:17:46] bnagy: so what's the point? Just check.
[08:17:46] tvb: on the cli the given argument is an option parameter
[08:17:58] baweaver: option(al)?
[08:18:03] bnagy: don't use exceptions as a standin for obvious flow control
[08:18:20] tvb: optional, as in if not given 1 should be used
[08:18:27] tvb: bnagy: ok
[08:18:33] baweaver: >> def method(a=1) a end; method
[08:18:34] bnagy: well you can use defaults for that
[08:18:34] ruboto: baweaver # => 1 (https://eval.in/391588)
[08:18:37] baweaver: >> def method(a=1) a end; method(3)
[08:18:38] ruboto: baweaver # => 3 (https://eval.in/391589)
[08:18:57] bnagy: but your example is sanitising arguments
[08:19:13] tvb: ah define (a=1) in the method
[08:19:25] bnagy: so you would have a default and also x = 1 if x <= 0
[08:19:32] tvb: and I have a default in the option parser, but it is not used with rspec
[08:19:41] baweaver: or x = 1 unless x > 0
[08:19:53] flughafen: shevy: nothing has taken off today
[08:19:59] tvb: ok let me change the code a bit and repaste to check
[08:20:36] baweaver: fair warning, to_i coerces types instead of checking validity
[08:20:38] lkba: has joined #ruby
[08:20:41] baweaver: >> 'a'.to_i
[08:20:42] ruboto: baweaver # => 0 (https://eval.in/391590)
[08:20:49] baweaver: >> Integer('a')
[08:20:50] ruboto: baweaver # => invalid value for Integer(): "a" (ArgumentError) ...check link for more (https://eval.in/391591)
[08:21:07] baweaver: If you need to coerce them that is.
[08:21:44] Ox0dea: >> _=$$/$$;@_=[$.]*(($_=[*' '..?{]*'')=~/$/);(@__=->__,___{(__=~/$/)!=(___=~/$/)?!$_:(@_[$_=~/#{__[$.]}/]+=_;@_[$_=~/#{___[$.]}/]-=_;__[$.+=_]?@__[__,___]:!!(@_*'')[/^#{_-_}+$/])})['obscurantist', 'subtractions']
[08:21:45] ruboto: Ox0dea # => true (https://eval.in/391592)
[08:21:49] tvb: bnagy: baweaver https://gist.github.com/anonymous/ac5e6f0209857bbcfd23#comment-1485563
[08:22:26] tvb: uhm got the unless wrong tho
[08:22:32] baweaver: AWS sdk then eh
[08:22:50] baweaver: ah hi Ox0dea
[08:23:06] baweaver: t1.small is an AWS instance type at least.
[08:23:24] baweaver: anagrams eh?
[08:23:26] sharpmachine: has joined #ruby
[08:24:07] tvb: baweaver: it is but im not using the SDK. It is just some little test im writing
[08:24:17] baweaver: fair enough
[08:24:23] baweaver: Ox0dea: give me a bit
[08:24:35] Ox0dea: Of course. Mind, that's not the hard one. :)
[08:24:42] Ox0dea: I did a variadic one as well.
[08:24:48] Ox0dea: >> @_,$_,@__=->_,__{_==''?_:(__[_[$_-$_]]?_[$_-$_]:'')+@_[_[$_..-$_],__]},$$/$$,@__=->_{__,___=_[$_-$_],_[$_..-$_];_==''?_:@__[@_[___,->_{_<__}]]+__+@__[@_[___,->_{_>=__}]]};($__=->*_{__=@__[_[$.]];$*[$_-$_]==__ ?_:$*<<__;_[$.+=$_]?$__[*_]:!$*[$_]})['allergy', 'gallery', 'largely', 'regally']
[08:24:49] ruboto: Ox0dea # => true (https://eval.in/391595)
[08:24:51] baweaver: 'the' infers more than
[08:25:05] baweaver: do you want both muggled?
[08:25:13] Ox0dea: The latter, if you're only doing one.
[08:25:21] baweaver: this late probably that
[08:25:21] Ox0dea: It's got something fancy in it.
[08:26:06] baweaver: I wait with bated breath to find it
[08:26:50] Ox0dea: Alas, it's specialized for strings to keep things short, but the generalization falls right out.
[08:28:07] Hounddog: has joined #ruby
[08:28:45] adaedra: Ox0dea: that's horiffic
[08:30:04] axl_: has joined #ruby
[08:32:16] white_bear: has joined #ruby
[08:32:45] Spami: has joined #ruby
[08:34:01] Ox0dea: I call it executable insanity.
[08:34:10] jenrzzz: has joined #ruby
[08:34:11] _whitelogger: has joined #ruby
[08:34:39] tekacs: has joined #ruby
[08:35:02] Oka: has joined #ruby
[08:35:06] elektronaut: has joined #ruby
[08:35:12] drPoggs: has joined #ruby
[08:35:38] coffeecupp: has joined #ruby
[08:35:39] axl_: has joined #ruby
[08:35:50] baweaver: Ox0dea: half asleep, probably going to call it a night on this one. Got a good way through the first lambda expression
[08:36:13] Ox0dea: baweaver: Ah, all right, then.
[08:36:39] baweaver: 'night mate, I'll ping you when I have something.
[08:36:57] Ox0dea: Good night. I eagerly await said ping.
[08:37:15] dionysus69: has joined #ruby
[08:37:52] lee-jon: has joined #ruby
[08:39:17] darlinger: has joined #ruby
[08:39:41] darlinger: is there any way to create an empty array without it automatically turning into Nil class?
[08:40:34] zotherstupidguy: whats the name of the channel of unrelated ruby things?
[08:40:36] darlinger: sevenseacat: still get a method error with NilClass
[08:40:43] mister_s_: has joined #ruby
[08:40:44] sevenseacat: darlinger: and the error is?
[08:40:45] Ox0dea: ?ot zotherstupidguy
[08:40:46] ruboto: zotherstupidguy, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[08:40:49] sevenseacat: and the code is?
[08:40:57] lee-jon: has joined #ruby
[08:41:22] sevenseacat: you might be trying to access the first element of an empty array, which is nil
[08:41:29] darlinger: sevenseacat: give me a second and I will send a gist
[08:41:37] Scroff: has joined #ruby
[08:42:52] darlinger: sevenseacat: https://gist.github.com/117d5987631fae1357e9
[08:42:53] Scroff: has joined #ruby
[08:42:54] konsolebox: has joined #ruby
[08:43:11] baweaver: has joined #ruby
[08:43:13] flughafen: what's the biggest/best ruby connference to go to in europe?
[08:43:27] sevenseacat: darlinger: and the error is?
[08:43:40] n008f4g_: has joined #ruby
[08:43:47] Akagi201: has joined #ruby
[08:44:20] darlinger: sevenseacat: run it. anything Array#method that I try to use with the empty arrays gives me a missing method error because it automatically turns into NilClass
[08:44:52] sevenseacat: darlinger: no it doesn't. I'd appreciate if you could post the full error you obviously have right in front of you on your screen.
[08:45:15] Ox0dea: sevenseacat: It's okay; that's enough code to see the problem.
[08:45:19] darlinger: https://gist.github.com/117d5987631fae1357e9
[08:45:21] darlinger: https://gist.github.com/117d5987631fae1357e9
[08:45:29] darlinger: sorry wrong buffer
[08:45:30] darlinger: ./towers_of_hanoi.rb:38:in `move': undefined method `empty?' for nil:NilClass (NoMethodError) from ./towers_of_hanoi.rb:59:in `<main>'
[08:45:37] darlinger: it's infuriating
[08:45:42] Ox0dea: darlinger: You don't need to pass @left and @right into the call to #move.
[08:45:58] sevenseacat: darlinger: you havent defined @left and @right
[08:46:01] Ox0dea: The instance knows its own @left and @right, so just access them directly from within #move.
[08:46:01] sevenseacat: therefore they are nil
[08:46:04] canton7: darlinger, line 59, @left and @right are undefined
[08:46:23] canton7: Ox0dea, I think that will defeat the point of the game :P
[08:46:28] sevenseacat: Ox0dea: it is enough to tell the error, but we dont encourage people to just dump their code and go 'fix it for me'
[08:46:33] corecode_: has left #ruby: ("ERC (IRC client for Emacs 24.5.1)")
[08:46:40] sevenseacat: 'you run the code, find the problem, and tell me how to fix it'
[08:46:52] darlinger: hmmm. well then how do i take user input to designate which instance variables I want to mess with it
[08:47:06] Ox0dea: You'll need to do some restructuring.
[08:47:24] canton7: you could: expose left, right, and middle to users of TowerGame, so usage is 'game1.move(game1.left, game1.right)'
[08:47:35] darlinger: sevenseacat: in my defense I did tell you a description of the error as well as present the code. i just didn't copy and paste the error for you
[08:47:41] canton7: or you could accept another form of identifier, e.g. 'game1.move(:left, :right)'
[08:47:53] sevenseacat: darlinger: against your defence, the error has nothing to do with arrays
[08:48:09] dramforever: has joined #ruby
[08:48:28] dramforever: has left #ruby: ()
[08:48:29] darlinger: canton7: oh that works? thanks
[08:48:41] canton7: darlinger, also, line 53, did you mean to have a '5' in there?
[08:49:19] canton7: darlinger, you'll need to write some more code for either of those options, but they're both valid end goals
[08:49:38] darlinger: canton7: oh good catch. still a work in progress. I have to fix that so that it changes with the number of rings
[08:50:02] olistik: has joined #ruby
[08:50:46] mrmargolis: has joined #ruby
[08:50:49] darlinger: canton7: i plan on handling all the moves with private methods
[08:50:50] canton7: darlinger, heck you've already got a @pegs dict - you could pass 'left', 'middle' or 'right' to move, and use @pegs to map that to the right column
[08:51:31] darlinger: canton7: that's the plan :D i just was testing the move method to see if it worked. didn't realize I was having a scope issue >_>
[08:52:24] dagda1: has joined #ruby
[08:54:01] _blizzy_: has joined #ruby
[08:54:22] darlinger: canton7: thanks for your help. i've been bashing my head against this for a few hours now
[08:54:55] unshadow: has joined #ruby
[08:56:54] rikkipitt: has joined #ruby
[08:56:57] gizmore: has joined #ruby
[08:57:11] ndrei: has joined #ruby
[08:59:05] darlinger: canton7: still getting nil class error
[08:59:08] Asher: has joined #ruby
[08:59:13] darlinger: canton7: with correct scope this time
[08:59:24] canton7: darlinger, pastie your modified code and the exact error message
[08:59:26] darlinger: xkhttps://gist.github.com/a5eccb570ea51ca5e081
[08:59:37] darlinger: ./towers_of_hanoi.rb:50:in `move': undefined method `push' for nil:NilClass (NoMethodError) from ./towers_of_hanoi.rb:67:in `<main>'
[08:59:43] nolic: has joined #ruby
[09:00:01] bigkevmcd: has joined #ruby
[09:00:47] canton7: darlinger, @left is nil
[09:00:50] canton7: see if you can figure out why ;)
[09:00:52] darlinger: just realized i had a mistake with TowerGame#move. had @left and @right switched
[09:01:00] darlinger: canton7: still throws same error
[09:01:02] _blizzy_: has joined #ruby
[09:01:03] avril14th: has joined #ruby
[09:01:08] canton7: darlinger, @left is nil
[09:01:09] canton7: see if you can figure out why ;)
[09:01:36] revath: has left #ruby: ()
[09:01:59] darlinger: canton7: the TowerGame#initialize
[09:02:15] darlinger: canton7: why doesn't @left take the contents of @win?
[09:02:30] sphex: hey. so when a block is passed down to a method, how are return/next/break from the block handled? they seem to do the right thing for built-in iterators, but how do they work? do they throw special exceptions?
[09:02:44] canton7: darlinger, because you don't assign @win to it ;)
[09:03:13] darlinger: canton7: does win not have a value until the method is done executing?
[09:03:33] canton7: darlinger, again, you don't assign @win to @left
[09:03:36] canton7: read your code, very carefully
[09:03:48] stamina: has joined #ruby
[09:03:55] ton31337: has joined #ruby
[09:04:02] ton31337: anyone is using zookeeper with ruby?
[09:04:25] darlinger: canton7: ohhhh oops. caught it. who keeps changing my identifiers?? :p
[09:04:27] fgo: has joined #ruby
[09:04:29] rikkipitt: has joined #ruby
[09:04:33] ton31337: https://gist.github.com/ton31337/0aae0e34e2dfffee31c9 no idea, what's wrong here. I can't see any events :/
[09:04:53] canton7: darlinger, nope, not scope. You wrote @left = @win_seq, not @left = @win
[09:06:04] darlinger: canton7: it works :)
[09:06:06] tkuchiki: has joined #ruby
[09:06:24] pengin: has joined #ruby
[09:06:43] darlinger: canton7: how do I print the name of a variable as a string?
[09:06:57] canton7: by writing the name of the variable as a string
[09:07:10] allomov: has joined #ruby
[09:07:18] yorickpeterse: darlinger: you can't, the only way to get all local variables in a scope is to call "local_variables"
[09:07:20] KrzaQ: has joined #ruby
[09:07:25] yorickpeterse: >> foo = 10; local_variables
[09:07:26] ruboto: yorickpeterse # => [:foo] (https://eval.in/391605)
[09:07:41] avril14th: Hello, I have a question about drying up the writing of some methods using meta programmation: https://gist.github.com/muichkine/d1a53c75137b85cd09b2 any input is welcome
[09:07:47] darlinger: yorickpeterse: gotcha. hmmm
[09:08:05] canton7: DRY is not about lines of code. It's about business logic
[09:08:15] canton7: having boilerplate does not mean you're violating DRY
[09:08:22] ton31337: has left #ruby: ()
[09:08:32] m3_del: has joined #ruby
[09:09:36] zotherstupidguy: has left #ruby: ("WeeChat 1.2")
[09:09:41] yorickpeterse: You could dynamically define the methods though
[09:11:09] avril14th: like? automatically prepending a module that lists all ias_* methods and override them with self.ias{ super } ?
[09:11:29] rikkipitt: has joined #ruby
[09:13:40] eGGsha: has joined #ruby
[09:15:08] yorickpeterse: eh no, I was thinking of using something like define_method to dynamically define the methods with whatever they're supposed to retunr
[09:15:46] Siyfion: has joined #ruby
[09:16:04] allomov: has joined #ruby
[09:16:08] avril14th: well, each returns its own stuff with a different logic, so I need to write their body one by one anway
[09:16:22] senayar: has joined #ruby
[09:16:27] tvb: bnagy: how can I check for string and if it is not a string submit a default?
[09:16:43] avril14th: tvb: obj.kind_of? String
[09:16:51] tvb: yeah but how about the if not?
[09:17:07] avril14th: obj.kind_of?(String) ? obj : 'default'
[09:17:13] MissionCritical: has joined #ruby
[09:17:17] symm-: has joined #ruby
[09:17:37] avril14th: or if you know that the object is either nil or a string: obj ||= 'default'
[09:18:56] tvb: avril14th: instance_type.kind_of?(String) ? instance_type : 't1.small'
[09:19:19] tvb: im submitting 2 (without quotes, so should be int?) and the check is not working
[09:19:27] tvb: expected: "t1.small"
[09:19:27] rikkipitt: has joined #ruby
[09:20:00] lee-jon: has joined #ruby
[09:20:41] marcoecc: has joined #ruby
[09:20:47] avril14th: >> 2.kind_of?(String) ? 'ah' : 'beh'
[09:20:48] ruboto: avril14th # => "beh" (https://eval.in/391617)
[09:21:02] bnagy: tvb: not very rubyish to do it that way
[09:21:07] ninja-maid-robot: has joined #ruby
[09:21:09] shevy: tvb you can also use more than one line, via if/else, or unless/else, if the ? confuses you
[09:21:23] tvb: bnagy: do educate me
[09:21:27] bnagy: mostly people would just String(arg) or something
[09:21:51] bnagy: and/or handle problems with the arg later
[09:21:52] yorickpeterse: What's not "Rubyish" about using a ternary?
[09:22:09] bnagy: well ternary is awful
[09:22:12] avril14th: bnagy: String(arg) with 2 will not return 't1.small'
[09:22:16] yorickpeterse: bnagy: because...?
[09:22:19] bnagy: but I was talking about checking concrete type
[09:22:37] Darkwater: nothing wrong with ternary imo
[09:22:56] avril14th: tvb: back to your question, somethng else is messing up. code?
[09:22:57] Darkwater: better than a 5-line if/else block
[09:22:57] Igorshp: has joined #ruby
[09:23:46] sinkensabe: has joined #ruby
[09:24:09] tvb: avril14th: not sure, let me paste
[09:24:12] sharpmachine: has joined #ruby
[09:24:16] bnagy: which is kind of a strawman because you almost never need if else to not use ternary
[09:24:20] shevy: some projects from rubyforge don't seem to exist on rubygems.org :(
[09:24:27] shevy: such as https://rubyforge.org/projects/ruby-xosd/
[09:24:38] shevy: oh no wait
[09:24:42] shevy: "libxosd-ruby"
[09:25:03] tvb: avril14th: https://gist.github.com/anonymous/0c27b776d9e343942701
[09:25:31] ljarvis: tvb: what else would instance_type be?
[09:25:31] yorickpeterse: clearly we need a Gem to wrap if/else in a certain pattern
[09:25:36] yorickpeterse: and preferably include it in ActiveSupport
[09:25:40] shevy: nothing wrong with if/else
[09:25:46] weemsledeux: has joined #ruby
[09:25:50] avril14th: tvb: that's strange code.
[09:26:05] yfeldblum: has joined #ruby
[09:26:13] beilabs_: has joined #ruby
[09:26:14] ljarvis: yorickpeterse: ActiveCondition
[09:26:18] shevy: no wonder - ternary is in that code :>
[09:26:19] avril14th: tvb: you specify default values, fine. Now you say "if the guy calling the code gives me shit, lets use default"
[09:26:34] einarj: has joined #ruby
[09:26:45] tvb: ljarvis: t2.small or any other string (I wont have to check for any valid aws type further tho)
[09:26:48] yorickpeterse: I joke but I basically did something pretty close to that
[09:26:52] yorickpeterse: although it serves a different use case
[09:27:01] tvb: avril14th: default if not submitted at all, right?
[09:27:03] yorickpeterse: https://github.com/olery/maybe this
[09:27:04] bruno-: has joined #ruby
[09:27:04] ljarvis: tvb: so.. if it's a string why do you need to check if it's a string?
[09:27:17] tvb: because one can type 2 as well
[09:27:18] bnagy: you should be checking if it's a valid instance type
[09:27:36] bnagy: there's no benefit to just checking if it's a string
[09:27:42] tvb: becuase instance_type can be submitted as option parse
[09:27:51] avril14th: tvb: yes, default if you pass nil. In which case you can write that better. Now, your code handles the case where a guy could call for instance "num_instance = -2". Should you really check that? if yes, why not raise an exception?
[09:27:58] ahmetkapikiran: has joined #ruby
[09:28:10] ljarvis: tvb: but you discard the 2 completely
[09:28:27] tvb: avril14th: not writing an exception because bnagy advised me not to
[09:28:29] ljarvis: "if this is 2, ignore it completely and use t1.small" it makes no sense
[09:28:56] bnagy: sigh. I told you not to use an exception to check if an arg is < 0 and then instantly handle it
[09:29:04] bnagy: because that's dumb.
[09:29:22] apofis: has joined #ruby
[09:29:39] bnagy: here, imvho, just validate the arg directly, don't mess about wondering what ruby type it is
[09:29:46] avril14th: tvb: default values are useful to avoid writing them everywhere. Checking that something not supposed to happen is the point of exceptions isn't it?
[09:29:57] tvb: avril14th: true
[09:30:03] bnagy: someone is going to pass something else stringish one day and your api will be broken for no reason
[09:30:19] lxsameer: has joined #ruby
[09:30:31] bnagy: so just look it up in a hash of valid instance types, which you're going to have to do at some point
[09:30:50] avril14th: or maybe you have backend logic that does the stuff rights and before that you have methods that check that params are fine
[09:30:52] tvb: bnagy: right
[09:31:11] avril14th: aren't controllers supposed to check passed params, and not backend logic code?
[09:31:12] tvb: avril14th: meh I want to keep it simple
[09:31:30] bnagy: then you can do instance_type = valid[instance_arg] || "some default"
[09:31:45] ljarvis: valid.fetch
[09:31:53] shevy: if I have a string for a class method, called string = 'foobar'; and that class method exists, like Bar.foobar; the way I invoke this is: Bar.send(string) # string can be a different method, foobar is just one example) - My question is, is there an alternative to .send() in this example?
[09:32:13] ljarvis: shevy: public_send is what you want
[09:32:38] ljarvis: unless you actually want it to potentially call a private method (almost never what you want)
[09:32:42] tvb: so this would make more sense
[09:32:43] tvb: instance_type === 't2.small' ? instance_type : 't2.small'
[09:32:49] bnagy: ljarvis: ha. I always forget fetch :/
[09:32:52] tvb: given that I only need to check for t2.smal
[09:33:12] ljarvis: tvb: that makes it *always* 't2.small' :/
[09:33:22] avril14th: shevy: send is fine, isn'it it? :)
[09:33:41] Scroff: has joined #ruby
[09:33:51] shevy: avril14th I guess
[09:33:53] avril14th: you could eval "Bar.#{string}" if you want to really mess things up / uglify though
[09:34:09] avril14th: public_send is basicaly a send with permission check
[09:34:42] tvb: ljarvis: guess that is fine in this case. I really don't want to extend the logic
[09:34:55] yorickpeterse: lol using eval() with user input
[09:34:59] yorickpeterse: surely that will never go wrong
[09:35:00] ljarvis: tvb: so wait, you don't want to allow anything but "t2.small"?
[09:35:07] canton7: tvb, I rewrote your code: "instance_type = 't2.small'"
[09:35:09] avril14th: yorickpeterse: exactly what I said :)
[09:35:27] dagda1: has joined #ruby
[09:35:37] tvb: canton7: heh that makes sense hmm
[09:35:56] tvb: ok maybe I need some exceptions here and there
[09:36:21] shevy: Ox0dea, haha look - I just found this project https://rubygems.org/gems/ascii - now your rugen thing could become a rugen-ascii thing!
[09:36:31] shevy: and an ascii representation of the unicode snowman \o/
[09:40:03] tvb: bnagy: how about this
[09:40:06] tvb: instance_types = ['t1.small', 't2.small']
[09:40:06] tvb: instance_types.include? instance_type ? instance_type : 't2.small'
[09:40:14] ljarvis: so.. they CAN be different?
[09:40:35] lee-jon: has joined #ruby
[09:40:37] adaedra: ACTION kills ljarvis
[09:40:47] yorickpeterse: ACTION intervenes
[09:41:04] skyrocker1: has left #ruby: ()
[09:41:13] ljarvis: tvb: define INSTANCE_TYPES with an array of allowed types, and write: instance_type = INSTANCE_TYPES.fetch(instance_type, 't2.small')
[09:41:17] ljarvis: you are done
[09:41:37] tvb: ljarvis: well, they can but I thought to keep it simple and just won't allow it for now
[09:42:02] ljarvis: tvb: this is simple eitherway, really
[09:42:07] tvb: ljarvis: true
[09:42:27] krz: has joined #ruby
[09:43:18] shevy: tvb btw you can also simplify such an array: instance_types = %w( t1.small t2.small ) <--- saves you the ',' in the middle, especially useful the longer the Array is
[09:43:24] bnagy: tvb: stop writing ternary
[09:43:47] bnagy: especially with boolean? methods :<
[09:44:08] shevy: or use ONLY boolean methods when you use the ternary!
[09:44:43] jenrzzz: has joined #ruby
[09:46:11] renderful: has joined #ruby
[09:51:00] fantazo: has joined #ruby
[09:51:47] lkba_: has joined #ruby
[09:53:39] tvb: ljarvis: getting fetch': no implicit conversion of String into Integer
[09:53:48] tvb: because im submitting 2
[09:54:04] andikr: has joined #ruby
[09:54:34] IanV0rn2341: has joined #ruby
[09:55:48] d0lph1n98: has joined #ruby
[09:57:52] michael_mbp: has joined #ruby
[09:58:51] bnagy: I suspect ljarvis meant a hash not an array
[09:59:00] User458764: has joined #ruby
[09:59:18] ndrei: has joined #ruby
[09:59:29] bnagy: Array also has a fetch method, which is probably what's causing the confusion
[09:59:30] tvb: hmm ok lets try that
[09:59:45] shevy: bnagy uses remote mind reading technique
[10:00:04] shevy: he is watching you as you type tvb!
[10:00:14] El3k0n: has joined #ruby
[10:00:58] tvb: shevy: I am real happy with all the help from all of you guys :)
[10:01:22] shevy: yeah you should buy bnagy a beer when he comes around!
[10:01:26] bnagy: when you define the hash it's kind of ugly though, cause it would have to be {'t1.small' => 't1.small'} if you're using fetch
[10:02:01] bnagy: but it makes the rest of the code clean, so meh
[10:02:23] tvb: instance_types = Hash.new
[10:02:23] tvb: instance_types[1] = 't1.small'
[10:02:23] tvb: instance_types[2] = 't2.small'
[10:02:26] Ox0dea: >> foo = [1,2,3]; foo.zip(foo).to_h
[10:02:27] tvb: instance_type = instance_types.fetch(instance_type, 't2.small')
[10:02:27] ruboto: Ox0dea # => {1=>1, 2=>2, 3=>3} (https://eval.in/391654)
[10:02:27] tvb: seems to work for me
[10:02:57] bnagy: tvb: oh, you want to look up from a number to a string?
[10:03:05] bnagy: then yes, using a hash is perfect now
[10:03:21] tvb: define number?
[10:04:05] bnagy: instance_types[1] = 't1.small' means the key is the number 1
[10:04:55] marr: has joined #ruby
[10:04:56] Indian: has joined #ruby
[10:04:59] bnagy: also, don't paste into the chan
[10:06:21] KrzaQ: has joined #ruby
[10:06:24] blackmesa: has joined #ruby
[10:06:27] tvb: bnagy: sorry about that
[10:06:34] pepperbreath1: has joined #ruby
[10:06:43] pepperbreath1: has left #ruby: ()
[10:06:54] rickmasta: has joined #ruby
[10:07:13] olistik: has joined #ruby
[10:08:22] JStoker: has joined #ruby
[10:08:23] JStoker: has joined #ruby
[10:08:51] gf3: has joined #ruby
[10:09:05] lkba: has joined #ruby
[10:09:17] m3_del: has joined #ruby
[10:09:35] Drager: has joined #ruby
[10:10:37] tvb: bnagy: I am not sure what you mean with "look up for a number to a string". I am submitting `2` and wanting to check that against the hashes defined in instance_types
[10:11:01] tvb: if not found, make instance_type 't2.small'
[10:11:12] Igorshp: has joined #ruby
[10:13:48] KrzaQ: has joined #ruby
[10:14:08] bnagy: do INSTANCE_TYPES = %w( blah.large blah.small .. more here) VALID_INSTANCES = INSTANCE_TYPES.zip(INSTANCE_TYPES).to_h
[10:14:17] bnagy: then use the fetch trick ljarvis said
[10:14:44] bnagy: instance = VALID_INSTANCES.fetch(arg, 'default.blah.here')
[10:15:27] machty: has joined #ruby
[10:15:38] ramfjord: has joined #ruby
[10:16:21] bnagy: I am still not 100% convinced of the cleanliness of this approach, but it should at least work
[10:16:56] tvb: I understand the code so its ok
[10:18:14] bnagy: otherwise use an array then do arg = default unless VALID.include? arg or something
[10:18:42] ljarvis: https://eval.in/391657
[10:18:54] tvb: undefined method `to_h
[10:19:15] ljarvis: you're on an older version of ruby which doesn't define to_h
[10:19:34] tvb: ruby 2.0.0p481
[10:19:36] ljarvis: Hash[foo] instead of foo.to_h
[10:19:40] ljarvis: yep, it's old
[10:19:43] ljarvis: internet old
[10:19:46] tvb: oh osx default i guess
[10:20:23] Tarkers34: Ox0dea: your regex worked perfectly from last night, thankyou
[10:20:24] adaedra: use Hash[]
[10:20:41] ljarvis: or use the code I pasted :)
[10:21:42] sash_: has joined #ruby
[10:21:59] bnagy: https://eval.in/391660
[10:22:37] ljarvis: ACTION prefers his
[10:22:48] bnagy: because it's longer and slower?
[10:23:07] ljarvis: since when is longer code a bad thing?
[10:23:28] ljarvis: and why is it slower? if you have a big fat list mine will in fact be exponentially faster
[10:23:29] shevy: long code leads to the java syndrome
[10:23:36] riffraff: has joined #ruby
[10:23:44] pgatt: has joined #ruby
[10:23:48] bnagy: ljarvis: because irl the Set creation is going to be slower than one list lookup
[10:23:52] skyjumper: has joined #ruby
[10:23:56] ljarvis: in this case perhaps
[10:24:03] bnagy: but fundamentally who cares
[10:24:04] pgatt: has joined #ruby
[10:24:10] ljarvis: but lets be honest, the different is inconsequential unless the list is huge
[10:24:14] bnagy: I'm not seriously faulting it for speed
[10:24:56] sharpmachine: has joined #ruby
[10:25:02] bnagy: I'm just angry at NFS right now
[10:25:44] tkuchiki: has joined #ruby
[10:26:29] akkad: has joined #ruby
[10:26:54] tvb: http://rubyforge.org/projects/netaddr/ => RubyForge Could Not Connect to Database:
[10:26:55] ljarvis: tvb: rubyforge is dead
[10:27:04] tvb: oh old link then
[10:27:15] shevy: good old rubyforge :(
[10:28:06] bnagy: tvb: another thing you could consider instead of all of this stuff is just raising ArgumentError
[10:28:26] bnagy: some people would argue that silently substituting a default for an invalid arg is bad API behaviour
[10:28:34] revath: has joined #ruby
[10:28:50] tvb: well lets throw in an argument error for my next task, just for fun
[10:28:54] GeorgesLeYeti: has joined #ruby
[10:29:03] shredding: has joined #ruby
[10:29:03] bnagy: like.. user makes a typo, keeps seeing wrong instance launch, spends hours wondering why
[10:29:10] tvb: bnagy: valid point
[10:29:41] tvb: first I need to verify the correctness of an ip address that has been submitted
[10:29:51] ljarvis: what does correctness mean?
[10:29:59] tvb: and convert it to the correct CIDR
[10:30:09] bruno-: has joined #ruby
[10:30:16] GeorgesLeYeti: I'm using a gem which display some info while using it. Is it possible no to print these info but only the ones i'm using into my function
[10:30:27] GeorgesLeYeti: Sorry if it's not clear
[10:30:33] ljarvis: GeorgesLeYeti: a gem prints something to STDOUT?
[10:30:36] ljarvis: tvb: https://github.com/bluemonk/ipaddress
[10:31:04] GeorgesLeYeti: ljarvis, How could i know that ?
[10:31:15] chinmay_dd: has joined #ruby
[10:31:16] ljarvis: GeorgesLeYeti: it'll print in your terminal (probably)
[10:31:22] Ox0dea: ljarvis: Could be stderr.
[10:31:29] tvb: ljarvis: I was looking at netaddr, but lets try ipaddress
[10:31:29] GeorgesLeYeti: ljarvis, then yes
[10:31:39] Ox0dea: GeorgesLeYeti: You'll need to determine if it's printing to stdout or stderr.
[10:31:45] Ox0dea: But yes, you can redirect either of them.
[10:31:47] ljarvis: GeorgesLeYeti: you could redirect stdout/stderr to determine
[10:32:09] ljarvis: see IO#reopen
[10:33:03] ljarvis: tvb: the last netaddr release was 7 years ago
[10:33:11] tvb: Noticed that yeah
[10:33:33] khebbie: has joined #ruby
[10:33:40] blackmes1: has joined #ruby
[10:33:51] tomphp: has joined #ruby
[10:34:09] bnagy: oh no, it probably hasn't kept up with all the new aspects of ip addressing
[10:34:18] GeorgesLeYeti: i'm pretty sure then display is coming from this line: puts response.inspect
[10:34:31] revath: has joined #ruby
[10:34:54] Ox0dea: >> require 'stringio'; $stdout = StringIO.new; puts 'this gets captured'; ret = $stdout.string; $stdout = STDOUT; ret
[10:34:56] ruboto: Ox0dea # => "this gets captured\n" (https://eval.in/391662)
[10:34:57] Ox0dea: GeorgesLeYeti: ^
[10:36:12] tvb: ljarvis: I installed the gem
[10:36:16] tvb: however
[10:36:17] tvb: `require': cannot load such file -- ipaddress (LoadError)
[10:37:54] helpa: has joined #ruby
[10:37:54] tvb: Successfully installed ipaddress-0.8.0
[10:39:38] bubbys: has joined #ruby
[10:39:41] tvb: hmm gem_path is emtpy?
[10:39:45] tvb: echo $GEM_PATH
[10:39:48] mrmargolis: has joined #ruby
[10:41:12] Oog: has joined #ruby
[10:41:17] tvb: oh but gem env is telling me
[10:41:17] tkuchiki: has joined #ruby
[10:41:19] sdothum: has joined #ruby
[10:41:19] tvb: - GEM PATHS:
[10:41:20] tvb: - /Library/Ruby/Gems/2.0.0
[10:42:39] Azure: has joined #ruby
[10:42:53] nolic: has joined #ruby
[10:42:58] jenrzzz: has joined #ruby
[10:43:28] dede: has joined #ruby
[10:43:37] yeticry: has joined #ruby
[10:44:39] mandarinkin: has joined #ruby
[10:45:32] ramfjord: has joined #ruby
[10:46:22] shevy: so where did it download it then
[10:46:55] shevy: is it in /Library/Ruby/Gems/2.0.0/cache/ ?
[10:47:03] senayar: has joined #ruby
[10:48:19] rmoriz: has joined #ruby
[10:49:47] tvb: updating ruby to 2.2.2
[10:49:56] unshadow_: has joined #ruby
[10:49:56] mister_solo: has joined #ruby
[10:50:03] centrx: has joined #ruby
[10:50:37] lee-jon: has joined #ruby
[10:50:44] fgo: has joined #ruby
[10:50:52] Mon_Ouie: has joined #ruby
[10:52:01] vondruch: has joined #ruby
[10:53:20] tvb: nice; ruby -v ruby 2.2.2p95
[10:53:31] eGGsha: has joined #ruby
[10:54:54] DEA7TH_: has joined #ruby
[10:55:17] tvb: ok got the same :(
[10:55:22] tvb: installed the gem again
[10:55:29] tvb: `require': cannot load such file -- ipaddress (LoadError)
[10:56:30] yqt: has joined #ruby
[10:57:42] izzol: tvb: which OS ?
[10:57:47] tvb: osx 10.10
[10:57:56] bhuvanaurora: has joined #ruby
[10:58:17] izzol: do you have it in: /Library/Ruby/Gems/{ver}/gems/ ?
[10:59:08] tvb: /Library/Ruby/Gems/2.0.0/gems/ipaddress-0.8.0/VERSION: ASCII text, with no line terminators
[10:59:19] tvb: version 2.0.0? Running 2.2.2 now
[10:59:23] jhass: tvb: is it in gem list? also what's your entire gem env output now (-> gist.github.com) and while at it, what's gem which ipaddress?
[10:59:29] claw: has joined #ruby
[10:59:30] tvb: should I create a symlink?
[10:59:51] jhass: how did you update to ruby 2.2.2?
[10:59:55] izzol: tvb: so you installed it in 2.0.0 and you are using 2.2.2
[10:59:58] tvb: gem env: GEM_PATHS - /Users/tvb/.rvm/gems/ruby-2.2.2
[11:00:20] jhass: did you run gem install again after updating?
[11:00:29] tvb: jhass: \curl -L https://get.rvm.io | bash -s stable --ruby & rvm install 2.2.2 --autolibs=enable
[11:00:29] Musashi007: has joined #ruby
[11:00:32] tvb: jhass: yes
[11:00:48] jhass: then I'd like my other questions answered :)
[11:00:58] tvb: it is in the 'gem list'
[11:01:26] tvb: ill gist it
[11:01:39] jhass: tvb: since RVM, also add rvm info
[11:02:35] tvb: https://gist.github.com/anonymous/f43e02aee791f90fcf32
[11:03:19] izzol: - /Users/tvb/.gem/ruby/2.0.0/bin
[11:03:33] tvb: rvm info: https://gist.github.com/anonymous/3cc5e11da210eef531b5
[11:03:54] rodfersou: has joined #ruby
[11:04:12] A124: has joined #ruby
[11:04:21] tvb: izzol: you are saying?
[11:04:31] jhass: yeah, something is adding to the shell path
[11:04:56] jhass: check your .$SHELLrc, .profile and .$SHELL_profile (bash by default on OS X iirc?)
[11:05:01] tvb: .profile perhaps?
[11:05:02] tvb: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[11:05:06] jhass: that's wanted
[11:05:25] adaedra: Should be bash on recent OSXes
[11:05:30] jhass: more like PATH="$(ruby yadayada):$PATH"
[11:05:32] tvb: export PATH="/Users/tristan/.gem/ruby/2.0.0/bin:$PATH"
[11:05:42] jhass: that one, drop it
[11:05:47] jhass: if you're going to RVM
[11:05:57] blackmes1: has joined #ruby
[11:06:23] tvb: - GEM PATHS:
[11:06:23] tvb: - /Users/tristan/.rvm/gems/ruby-2.2.2
[11:06:53] tvb: ok paths are looking good now
[11:07:00] jhass: so, ruby -ripaddress -e'puts "ok"'
[11:07:12] jhass: prints ok and nothing else?
[11:07:16] tvb: intalling ipaddress again
[11:07:27] tvb: it is not installing in the correct dir
[11:07:35] tvb: I dont see it /Users/tvb/.rvm/gems/ruby-2.2.2/cache/
[11:08:01] jhass: well, actually, what does command -v gem print?
[11:08:03] tvb: ruby -ripaddress -e'puts "ok"' prints ok tho
[11:08:11] jhass: ah, nvm then
[11:08:13] jhass: it should work now
[11:08:27] tvb: `require': cannot load such file -- ipaddress (LoadError)
[11:08:29] NeverDie: has joined #ruby
[11:08:31] tvb: it doesnt :(
[11:08:41] jhass: tvb: what exact command is throwing that?
[11:08:56] tvb: require 'ipaddress'
[11:09:01] jhass: no, that's the code
[11:09:11] jhass: I'm asking for the command you invoke that code with
[11:09:21] tvb: ruby test.rb --instances 0 --instance-type t2.small --allow-ssh-from
[11:09:40] jhass: is that the same exact shell you did ruby -ripaddress from?
[11:09:49] fgo: has joined #ruby
[11:09:52] pusewicz: has joined #ruby
[11:09:57] tvb: uhm yes?
[11:10:06] m3_del: has joined #ruby
[11:10:06] jhass: no other terminal window or so?
[11:10:24] tvb: same shell, one command after the other
[11:10:29] jhass: no user switching/no sudo?
[11:10:34] izzol: you executing it on the remote host?
[11:10:39] tvb: localhost
[11:10:43] jhass: tvb: directory switching?
[11:10:53] tvb: negative
[11:10:58] shevy: soon we are out of options
[11:11:08] shevy: tvb: a cat on the desk pulling the plug?
[11:11:08] jhass: makes no sense
[11:11:18] tvb: shevy: thats it :)
[11:11:27] shevy: well alright
[11:11:33] shevy: how many rubies do you have, and where are they?
[11:11:47] jhass: tvb: command -v ruby ?
[11:11:51] izzol: what is # which ruby ?
[11:11:57] bnagy: ruby -e "require 'ipaddress'"
[11:11:59] shevy: I have one ruby only for instance
[11:12:06] tvb: jhass: gives: /Users/tvb/.rvm/rubies/ruby-2.2.2/bin/ruby
[11:12:24] jhass: shevy: that's what we want (and established earlier)
[11:12:34] shevy: the problem!
[11:12:35] tvb: which ruby is the same
[11:12:46] tvb: I dont see it?
[11:12:52] jhass: tvb: ignore shevy
[11:13:32] jhass: tvb: able to share test.rb wholly?
[11:13:59] aryaching: has joined #ruby
[11:14:10] tvb: jhass: https://gist.github.com/anonymous/a17a7936025699e0b961
[11:14:42] jhass: did you ever mention you use bundler? :P
[11:14:58] jhass: you need to add gem 'ipaddress' to your Gemfile and run bundle install
[11:15:10] tvb: Im all new to this
[11:15:24] jhass: no worries, should've asked earlier about that
[11:15:31] bnagy: bumbler strikes again
[11:15:36] blackmesa: has joined #ruby
[11:16:16] shevy: ttp://cowboyjob.com/post/1666830/god-I-hate-that-choice-made-by-bundler-there
[11:16:18] tvb: Using ipaddress 0.8.0
[11:16:22] eGGsha: has joined #ruby
[11:16:22] shevy: damn I even mispaste
[11:16:32] T3: i have a troubleshooting checklist and 3rd on it is check gems are installed and correct version :p
[11:16:36] tvb: better!
[11:16:38] shevy: unless we rename http to ttp
[11:16:44] T3: it tends to occur more often than you would think
[11:16:48] T3: dont feel bad
[11:17:14] shevy: one problem down, 99 more to come
[11:17:59] tvb: ipaddress works perfectly
[11:18:02] adaedra: 99 little bugs in the code, patch it around, 167 little bugs in the code
[11:18:08] tvb: adaedra: hahaha
[11:22:12] Oog: has joined #ruby
[11:22:40] harleypig: has joined #ruby
[11:22:59] adamski2600: has joined #ruby
[11:24:38] vcoinminer: has joined #ruby
[11:25:58] sharpmachine: has joined #ruby
[11:26:14] AlexRussia_: has joined #ruby
[11:27:03] Oog: has joined #ruby
[11:27:14] fabrice31: has joined #ruby
[11:28:01] jenrzzz: has joined #ruby
[11:30:26] nettoweb: has joined #ruby
[11:30:39] intinig: has joined #ruby
[11:31:03] AlexRussia_: has joined #ruby
[11:31:18] tvb: guys what does the @ mean in ruby?
[11:31:20] fabrice31: has joined #ruby
[11:31:22] tvb: @aws = Aws.new
[11:31:29] centrx: tvb, it means it's an instance variable
[11:31:55] adaedra: it's not a symbol, it's part of the name
[11:32:31] tvb: so if I want to call aws.function()
[11:32:38] tvb: I rather call @aws.function()
[11:33:24] tvb: ..are prefixed by the @ symbol. This is enforced by Ruby - if your variable does not start with a @, it is considered to be a local variable.
[11:33:26] jhass: it's @aws.method, girl, but yeah ;)
[11:34:03] DefV: jhass: <3 for your effort on the BUNDLED_WITH issue
[11:34:29] ndrei: has joined #ruby
[11:35:55] tvb: !jhass:++
[11:36:35] millerti: has joined #ruby
[11:36:46] tvb: so im not sure how many kudos I have left but I am on a roll now :) and my next question is I have two files. One with a class definition and one where I want to call the class en do something with output
[11:37:33] tvb: assume the one with the output is called output.rb and the one with the class is called class.rb. Then I would require 'class' in output.rb, right?
[11:37:44] nfk: has joined #ruby
[11:37:56] jhass: DefV: you're welcome, I guess
[11:39:25] jhass: tvb: well, that's how it should be but you have to setup $LOAD_PATH in order to work with require (instead of require_relative)
[11:39:36] tvb: i guess it needs to load relatively
[11:39:49] jhass: $LOAD_PATH is the list of directories require searches through
[11:40:00] tvb: works better :)
[11:40:00] diegoviola: has joined #ruby
[11:40:30] jhass: the require 'bundler/setup' for example adds all the directories of the gems specified in your Gemfile and removes everything else
[11:40:38] jhass: hence you couldn't load ipaddress earlier
[11:41:03] jhass: so a common thing to do is to setup $LOAD_PATH (it's just an Array), at the entry point of your application
[11:41:07] tvb: rubocop: 5 files inspected, 51 offenses detected
[11:41:09] tvb: here we go again
[11:41:15] jhass: or if you're writing a Gem that's basically done for you
[11:42:07] revath: has joined #ruby
[11:43:47] dfockler: has joined #ruby
[11:43:58] ldnunes: has joined #ruby
[11:44:08] yeticry: has joined #ruby
[11:44:23] platzhirsch: has joined #ruby
[11:44:57] tvb: rubocop is bitching about this line
[11:45:02] tvb: being to long
[11:45:03] tvb: def generate_resources(num_instances = 1, instance_type = 't2.small', cidr_ip = '')
[11:45:29] tvb: how can I 'shrink' that line without removing the logic of the variable naming?
[11:45:41] tvb: put it on the next line with a \?
[11:45:50] ljarvis: no need for the \
[11:46:01] ljarvis: just add a new line after one of the commas
[11:46:06] Darkwater: yeah, there's commas
[11:46:15] tvb: cool, that works
[11:46:16] Darkwater: so it won't be ambiguous, so you won't need backslashes
[11:46:27] stef204: has joined #ruby
[11:46:29] rickmasta: has joined #ruby
[11:49:41] ramfjord: has joined #ruby
[11:50:53] jeanlinux: has joined #ruby
[11:51:03] DefV: jhass: that may have been a bit random, but I just read through the GH issue in anger, so to me it makes sense
[11:52:39] tvb: what does this mean?
[11:52:40] tvb: interpreted as grouped expression
[11:53:19] tekmaster: has joined #ruby
[11:53:33] sevenseacat: context required
[11:54:22] sandstrom: has joined #ruby
[11:54:36] tvb: expect(result['InstanceSecurityGroup']['Properties'] \
[11:54:36] tvb: ['SecurityGroupIngress'][0]['CidrIp']).to eq ('')
[11:54:44] JohnBat26: has joined #ruby
[11:55:06] blackmesa: has joined #ruby
[11:55:22] tvb: well, pasted the wrong line but the other one is simulair
[11:55:23] sevenseacat: thats a hell of a nested hash
[11:55:28] tvb: rspec/instance_spec.rb:22:68: W: (...) interpreted as grouped expression.
[11:55:28] tvb: expect(result['EC2Instance']['Properties']['InstanceType']).to eq ('t2.small')
[11:55:41] Ox0dea: tvb: Put the opening parentheses right next to the method name.
[11:55:47] JeramyRR: has joined #ruby
[11:55:51] serivich: has joined #ruby
[11:55:52] sevenseacat: remove the space between eq and (
[11:56:04] mnemon2: has joined #ruby
[11:56:10] tvb: ah right
[11:57:01] vondruch: has joined #ruby
[11:58:04] tvb: spec/spec_helper.rb:45:1: C: Do not use block comments.
[11:58:20] tvb: its bitching about an automated generated file
[11:59:22] ta: has joined #ruby
[11:59:27] spectra-: has joined #ruby
[11:59:31] adaedra: (sorry, this unclosed comment disturbed me)
[12:00:37] tvb: adaedra: huh?
[12:00:52] alem0lars: has joined #ruby
[12:00:58] silverdust: has joined #ruby
[12:01:10] adaedra: tvb: don't worry, just me being silly
[12:01:17] adaedra: TheBrayn: you want me to die? :<
[12:01:19] tvb: adaedra: there is an =end
[12:01:27] tvb: in spec_helper
[12:01:35] Darkwater: doesn't this apostrophe annoy you as well?
[12:02:03] adaedra: Darkwater: no, apostrophes are ok.
[12:04:22] iamninja: has joined #ruby
[12:04:42] zack6849: has joined #ruby
[12:04:42] zack6849: has joined #ruby
[12:04:55] senayar: has joined #ruby
[12:04:55] senayar: has joined #ruby
[12:04:59] emilkarl: has joined #ruby
[12:05:23] tvb: bnagy: you know earlier we talk about instance_type should be a string?
[12:05:38] tvb: we came up with checking for allowed types
[12:05:51] tvb: now I run a test with instance_type = '' and it fails
[12:06:03] DEA7TH_: has joined #ruby
[12:06:08] tvb: because we are not checking it for being an empty string
[12:06:44] tvb: guess I have to implement variable.nil? || variable.empty?
[12:07:09] Ox0dea: tvb: Object#nil? is already a thing, as is String#empty?.
[12:07:28] tvb: 'thing'?
[12:07:41] Ox0dea: You don't need to implement them; they are already there.
[12:07:55] tvb: hmm so now what?
[12:08:05] serivich: has joined #ruby
[12:08:06] Ox0dea: Whatever you were gonna do after implementing them, I suppose.
[12:08:28] tvb: i mean with implement, put them in my code
[12:08:32] tvb: and check for it
[12:08:42] Ox0dea: You should learn Ruby. ^_^
[12:08:46] Papierkorb: has joined #ruby
[12:08:48] tvb: I am trying :
[12:09:05] Ox0dea: >> [1.nil?, nil.nil?, 'foo'.empty?, ''.empty?]
[12:09:06] ruboto: Ox0dea # => [false, true, false, true] (https://eval.in/391732)
[12:09:11] chouhoulis: has joined #ruby
[12:09:22] tvb: first day ruby, hack first day programming besides some minor php experience
[12:09:55] cytoskeletor: has joined #ruby
[12:10:51] m3_del: has joined #ruby
[12:11:02] tvb: ok lets implement an exception here is the variable is emtpy
[12:11:12] lee-jon: has joined #ruby
[12:11:23] Ox0dea: tvb: "Implement" is closer to "create" rather than "use".
[12:11:47] tvb: lets use an exception then ;)
[12:12:09] claw: has joined #ruby
[12:12:35] jeanlinux: has joined #ruby
[12:13:33] tvb: ok so bnagy need some advise here
[12:13:44] keen__________11: has joined #ruby
[12:13:51] tvb: got raise "empty!" if instance_type.nil? || instance_type.empty?
[12:14:16] tvb: it is obviously raising an exception if I submit ''
[12:14:37] ryba: has joined #ruby
[12:15:18] fabrice31_: has joined #ruby
[12:15:26] KetaPan: has joined #ruby
[12:15:45] fabrice31_: has joined #ruby
[12:15:49] tvb: now i am trying to check that with rspec
[12:15:53] tvb: someting like
[12:15:54] tvb: expect(result.generate_resources.to raise_error("empty!")
[12:16:19] Darkwater: think you forgot a )
[12:16:33] tvb: hm true
[12:17:47] tvb: im not sure what it returning the exception here
[12:17:50] tvb: the method i suppose?
[12:18:10] eGGsha: has joined #ruby
[12:21:29] revath: has joined #ruby
[12:24:19] Ox0dea: tvb: That unfortunate miscommunication back there regarding "implement" made me sound like a total dick. Sorry about that. :/
[12:24:38] tvb: Ox0dea: hey no worries!
[12:25:02] chipotle: has joined #ruby
[12:25:11] tvb: You had valid point, got it noted :)
[12:25:32] Cork: Resolve.getaddresses resolves the ipv4 OR ipv6, is there a way to get all of them?
[12:25:34] charliesome: has joined #ruby
[12:25:40] IanV0rn2341: has joined #ruby
[12:25:49] Cork: (and it needs to include things from the hosts file)
[12:25:54] but3k4: has joined #ruby
[12:26:35] sharpmachine: has joined #ruby
[12:27:03] catphish: has joined #ruby
[12:27:22] catphish: is it possible to make initialize private to force people to use alternative initializers?
[12:27:57] jhass: singleton_class.private :new
[12:28:42] mrmargolis: has joined #ruby
[12:30:31] tvb: can you do a describe inside a describe with rspec?
[12:30:47] Darkwater: I'd use a context tho
[12:30:48] izzol: I don't like rspec.
[12:31:06] tvb: Darkwater: I am using context wrong then?
[12:31:08] bougyman: i don't like the way the people here use rspec.
[12:31:19] tvb: Darkwater: https://gist.github.com/anonymous/f98ebc45243e9eacf847
[12:31:24] Darkwater: oh wait, I'm mistaken
[12:31:25] Darkwater: never mind me
[12:31:31] bougyman: in my projects that use bacon, they add some metacrap to try and turn it into rspec.
[12:31:35] bougyman: and they broke the hell out of it.
[12:31:38] Darkwater: describe -> [context ->] it
[12:31:39] bougyman: all I need is bacon.
[12:31:45] Akagi201_: has joined #ruby
[12:32:58] tvb: Darkwater: https://gist.github.com/anonymous/81c56f86ebd209fbfa35
[12:33:06] tvb: it is erroring on missing class
[12:33:15] tvb: undefined method `generate_resources' for nil:NilClass
[12:33:46] tvb: I assumed the before would fix that?
[12:34:23] Darkwater: I'm not sure
[12:34:27] Darkwater: not a huge rspec user
[12:34:59] sevenseacat: tvb: you cant define result outside a test like that
[12:35:14] sevenseacat: if you wanted to do that, you might want to put it in a let block
[12:35:18] doerteDev: someone here worked with savon?
[12:35:25] sevenseacat: eg. let(:result) { @aws.... }
[12:35:33] jeanlinux: has joined #ruby
[12:35:33] sevenseacat: then you can refer to result inside the it blocks
[12:35:37] jhass: ?anyone doertedev
[12:35:37] ruboto: doertedev, Just ask your question, if anyone has or can, they will respond.
[12:35:47] doerteDev: I feel trolled by a webservice. client.operations gives me operations to call, and soapactions, when called I get the response that "this is not an operation"
[12:36:10] doerteDev: never did soap in my life I have to admit
[12:36:10] sandstrom: has left #ruby: ("OS X IRC Client (www.textualapp.com)")
[12:36:23] tvb: sevenseacat: well I moved result inside the it block
[12:36:24] ljarvis: ?code doertedev
[12:36:24] ruboto: doertedev, We can't help you without your code, please post it to https://gist.github.com
[12:36:26] tvb: it is working now
[12:37:03] tvb: however the expect(result).to raise_error('empty!') is still not correct
[12:37:05] doerteDev: ruboto: This is a general understanding problem.
[12:37:21] ljarvis: tvb: expect { foo }.to raise_error(...)
[12:37:26] catphish: jhass: singleton_class.private :new fails because private is itself private
[12:37:30] sevenseacat: thats right - when you do that kind of asserti..... yeah that wjarvis said
[12:37:33] sevenseacat: *what ljarvis
[12:37:37] ljarvis: tvb: you need to do it in a block so it can be evaluated lazily
[12:37:52] tvb: foo == result?
[12:37:52] dumdedum: has joined #ruby
[12:38:07] ljarvis: no, result is.. already the result
[12:38:11] catphish: jhass: "private_class_method :new" works though :)
[12:38:11] ljarvis: the method call is what raises
[12:38:23] tvb: ljarvis: check
[12:38:35] ljarvis: tvb: also, what is this weird "it" block wrapping everything?
[12:38:50] ljarvis: never seen that without a description
[12:38:52] sevenseacat: its the rspec test :P
[12:38:57] ljarvis: made it seem weird
[12:38:57] sevenseacat: yeah poorly written
[12:39:01] jhass: catphish: uh, must be fairly new
[12:39:15] tvb: ljarvis: got it from http://betterspecs.org/#short
[12:39:17] sevenseacat: having multi-line blocks in curly braces is also asking for trouble
[12:39:21] ljarvis: the result assignment outside of that block is wrong
[12:39:34] tvb: ljarvis: moved that inside the it already
[12:39:48] sevenseacat: tvb: yeah but you're totally not writing specs in the format of that guide
[12:39:53] ljarvis: you should just call it
[12:39:57] sevenseacat: you have an it block and you're just piling assertions in there
[12:40:00] langlands: has joined #ruby
[12:40:17] ljarvis: ^ 1-3 assertions per it block for me
[12:40:20] tvb: sevenseacat: doing the best to my knowledge and understanding :)
[12:42:13] tvb: I am not understanding this .to raise_error() part
[12:42:27] troulouliou_dev: has joined #ruby
[12:42:29] tvb: Failure/Error: result = @aws.generate_resources(0, '', 2)
[12:42:29] tvb: RuntimeError: empty!
[12:42:39] doerteDev: Okay so: SOAP - Can someone make sense of this: http://pastie.org/pastes/10271510/text
[12:42:40] tvb: in the test output
[12:42:51] ljarvis: tvb: generate_resources raises an exception, you're using that to assign result
[12:43:15] ljarvis: you need to write the code that generates an exception inside of the expect block
[12:43:24] tvb: expect { generate_resources }.to raise_error("empty!")
[12:43:25] ljarvis: expect { this code raises }.to raise_error
[12:43:35] elektronaut: has joined #ruby
[12:43:39] drPoggs: has joined #ruby
[12:43:39] ljarvis: not.. result = this code raises; expect { result }.to raise_error
[12:43:53] ljarvis: because the exception will raise before it can be evaluated by rspec
[12:43:56] _whitelogger: has joined #ruby
[12:44:04] ljarvis: evaluated/captured
[12:44:19] ljarvis: make sense?
[12:44:23] tvb: somewhat
[12:44:30] ljarvis: which part is confusing?
[12:44:32] tvb: 14:38:10 <ljarvis> the method call is what raises <--
[12:44:54] ljarvis: tvb: the method generate_resources raises an exception if there is some bad argument, correct?
[12:45:01] tvb: correct
[12:45:09] ljarvis: calling that method is "the method call"
[12:45:18] ljarvis: does that sentence still confuse you?
[12:45:37] tvb: result = @aws.generate_resources(0, '', 2) is 'calling the method'
[12:45:47] ljarvis: correct, and what happens?
[12:46:11] weemsledeux: has joined #ruby
[12:46:35] tvb: it raises an exception
[12:46:53] sevenseacat: at what point of the execution
[12:47:06] sevenseacat: before, during or after you try and catch it?
[12:47:28] tvb: raise "empty!" if instance_type.nil? || instance_type.empty?
[12:47:30] tvb: during i guess?
[12:47:43] sevenseacat: where are you trying to catch it?
[12:48:14] sevenseacat: which line of code is trying to catch it
[12:48:16] ljarvis: show us in the code
[12:48:28] tvb: ok let me gist it again, sorry guys
[12:49:00] tvb: code; raise @ line 45: https://gist.github.com/anonymous/cf5096849c1a04014242
[12:49:17] ljarvis: right, but where are you trying to *catch* it
[12:49:19] tvb: rspec code: https://gist.github.com/anonymous/1044e2b4d30c01e1a173
[12:49:22] sevenseacat: thats irrelevant to the test
[12:49:24] tvb: ljarvis: I guess i am not
[12:49:31] ljarvis: so you're not testing it?
[12:49:57] tvb: that is probably the part I missed..
[12:50:00] konsolebox: has joined #ruby
[12:50:01] ljarvis: tvb: talk us through this line https://gist.github.com/anonymous/1044e2b4d30c01e1a173#file-gistfile1-txt-L28
[12:50:19] tvb: Ok so my understanding is
[12:50:49] tvb: that it tests if the method being called is raising the error "emtpy".
[12:50:57] sevenseacat: you're not caling a methof there
[12:51:11] sevenseacat: you just have a variable - `result`
[12:51:11] tvb: I did here
[12:51:12] tvb: https://gist.github.com/anonymous/1044e2b4d30c01e1a173#file-gistfile1-txt-L22
[12:51:23] sevenseacat: which is outside the testing line
[12:51:52] sevenseacat: the point of using { } there is to define a block, so the before and after can be tested
[12:51:59] tkuchiki: has joined #ruby
[12:52:06] sevenseacat: before - no exception. after - exception.
[12:52:08] freerobby: has joined #ruby
[12:52:15] sevenseacat: if thats true, then the assertion passes
[12:52:25] sevenseacat: *before calling the block, after calling the block
[12:53:03] tvb: hmm need some example to visualize what you are talking about
[12:53:52] sevenseacat: you have it right there in the code you're looking at
[12:53:55] sevenseacat: the code you wrote
[12:54:10] jeanlinux: has joined #ruby
[12:54:16] ljarvis: https://eval.in/391780
[12:54:22] sevenseacat: in simpler form, expect { raise "Error!" } to raise_error
[12:54:29] sevenseacat: calling the block is what raises the error
[12:54:32] sevenseacat: so the assertion passes
[12:55:19] ljarvis: ^ good example
[12:55:40] langlands: has joined #ruby
[12:56:20] tvb: expect { raise "Error!" } to raise_error("Error!") does make sense
[12:56:50] sevenseacat: so now you can put what you actually expect to raise the error, inside that block
[12:57:14] tvb: @aws.generate_resources is raising the error
[12:57:26] ljarvis: so where does it go?
[12:57:29] sevenseacat: we're getting there
[12:57:59] ljarvis: charliesome: does eval-in have a public api?
[12:58:04] tvb: well I would put it inside the block
[12:58:11] charliesome: ljarvis: sorta
[12:58:25] charliesome: ljarvis: you can POST to / passing the same params that the form on the homepage passes
[12:58:29] charliesome: and then GET /:id.json
[12:58:46] ljarvis: charliesome: ah ok, wanted to check before I did that in case it was considered a dick move
[12:59:10] charliesome: as long as you set a meaningful User-Agent, it's fine by me :)
[12:59:18] ljarvis: nice one, ta
[12:59:43] yorickpeterse: is the API webscale?
[12:59:57] yorickpeterse: I heard Docker is the future, you should use that
[12:59:58] ljarvis: is it build in slash?
[13:00:16] yorickpeterse: and React native
[13:00:19] senayar: has joined #ruby
[13:00:19] yorickpeterse: it's also the future
[13:00:32] yorickpeterse: According to some wise person on HackerNews you should bet on it
[13:00:32] dgutierrez1287: has joined #ruby
[13:00:42] ljarvis: i'll bet my lifes earnings
[13:00:49] yorickpeterse: so I did, I pulled all my money from the bank and invested it in Facebook
[13:00:53] yorickpeterse: so I know React is going to be big
[13:01:16] ljarvis: good call, especially with nucleus or whatever its called
[13:01:22] tvb: sevenseacat: I have the feeling I missed something while you educated me
[13:01:46] tvb: tried to put @aws.generate_resources inside the { } as that is the method raising the error
[13:01:59] tvb: but is not evaluating it, so it seems
[13:02:03] yorickpeterse: https://news.ycombinator.com/item?id=9824574
[13:02:16] sevenseacat: tvb: your error is?
[13:02:24] tvb: Failure/Error: result = @aws.generate_resources(0, '', 2)
[13:02:24] tvb: RuntimeError:
[13:02:31] sevenseacat: because thats before the block
[13:03:02] avdi: has joined #ruby
[13:03:09] sevenseacat: I am unsure of what your tests are trying to achieve
[13:03:12] tvb: so "result = @aws.generate_resources(0, '', 2)" is actually raising the error
[13:03:16] tvb: before the expect has ran
[13:03:19] sevenseacat: because if you raise an exception, everything else is pretty much meaningless
[13:03:24] jeregrine: has joined #ruby
[13:03:26] sevenseacat: return values and whatnot
[13:03:31] ljarvis: you shouldn't care about the return value
[13:03:42] ljarvis: (in this case)
[13:04:29] Igorshp: Hi guys. I have a ruby program that changes the logger format based on $stdout.tty variable. is there a way to manualy force it to true?
[13:04:36] Igorshp: from outside of that program
[13:05:38] tvb: well, I am expecting the app to raise an error when the argument is ''. That is what I wanted to test.
[13:05:42] tvb: perhaps its a silly test
[13:06:07] ljarvis: it is, but that's besides the point
[13:06:32] tvb: oh and because it is throwing an error
[13:06:38] otisZart: has joined #ruby
[13:06:38] tvb: the test suite is failing
[13:07:02] ljarvis: if only test suits passed when there are errors being thrown ;)
[13:07:04] tvb: which is kind of expected because that is what a exception is for, but unwanted ofcourse
[13:07:22] dgutierr_: has joined #ruby
[13:08:17] thelastinuit: has joined #ruby
[13:08:37] izzol: ehh, I'm trying to parse an e-mail in Go and it's sounds like mission impossible (so far). In ruby it takes me 5 min :(
[13:09:21] JoshL: has joined #ruby
[13:09:32] ljarvis: izzol: yes I can see your dispair in the go channel
[13:10:49] yorickpeterse: How dare you criticize Go, the glorious language from dear leader Rob Pike
[13:11:38] m3_del: has joined #ruby
[13:12:32] sevenseacat: glorious leader?
[13:13:45] diegoviola: Rob Pike? Plan 9 didn't seem to have taken off
[13:13:47] yorickpeterse: I meant "glorious dear leader"
[13:13:55] yorickpeterse: I already typed that
[13:14:06] yorickpeterse: diegoviola: ssssshhh
[13:14:12] yorickpeterse: Plan 9 is the future
[13:14:15] diegoviola: where is his plan 9 used?
[13:14:22] diegoviola: on 10 computers?
[13:14:46] JeramyRR: has joined #ruby
[13:15:06] DEA7TH_: has joined #ruby
[13:16:03] Ox0dea: We have Rob Pike to praise/blame for UTF-8.
[13:16:22] rippa: has joined #ruby
[13:16:38] ruboto: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[13:17:13] Ox0dea: >> Encoding::UTF_8
[13:17:14] ruboto: Ox0dea # => #<Encoding:UTF-8> (https://eval.in/391798)
[13:17:17] lee-jon: Although UTF-8 could be considered a Ruby related problem :|
[13:18:06] maloik: I wouldn't say that, my terminal/irssi breaks quite hard when people use funky characters
[13:18:35] Ox0dea: maloik: On whom do you put the blame for that, exactly?
[13:18:51] jenrzzz: has joined #ruby
[13:18:51] maloik: myself and myself alone
[13:19:01] bjeanes: has joined #ruby
[13:19:03] Darkwater: <insert BEL here>
[13:19:14] jhass: nah we're +c here
[13:19:14] maloik: well, and the colleague that set up this server
[13:19:28] dblessing: has joined #ruby
[13:20:36] DefV: maloik: encoding is 100% client setting ;-)
[13:21:00] DefV: unless your server doesn't have an UTF-8 encoding configured but I know that server and it does ;-)
[13:21:16] maloik: it's not the default though I believe
[13:21:34] jhass: luckily it is for most clients these days
[13:21:37] lee-jon: What???s not default?
[13:21:45] maloik: was mostly kidding though, I'm just too lazy to figure this out
[13:21:49] maloik: it doesn't really bother me THAT much
[13:22:05] Geet: has joined #ruby
[13:22:17] featheryahn_: has joined #ruby
[13:22:18] MasterPiece: has joined #ruby
[13:22:20] jhass: maloik: join #ruby-offtopic and play a round of hangman with us then!
[13:22:32] Geet: whats the best way to learn ruby?
[13:22:43] adaedra: I'm thinking about parsing xml, what to use?
[13:22:48] jhass: Geet: solve a problem you have with it
[13:22:53] adaedra: (I know there are some people expert on that in here)
[13:23:00] acke: has joined #ruby
[13:23:06] Ox0dea: adaedra: Oga.
[13:23:13] Geet: i'll give it a go
[13:23:18] jhass: adaedra: oga and yell at yorickpeterse if it doesn't work
[13:23:29] adaedra: Did you mean: omega ruby
[13:23:35] adaedra: Google, google, google.
[13:24:17] alxndr: has joined #ruby
[13:24:51] Darkwater: Developers, developers, developers, developers.
[13:24:59] chouhoulis: has joined #ruby
[13:25:13] adaedra: jhass: I'll see what I can do for the second part. :)
[13:25:17] hellschreiber: has joined #ruby
[13:25:47] tkuchiki: has joined #ruby
[13:27:20] tvb: ljarvis: I am having an issue with ipaddress
[13:27:21] tvb: https://gist.github.com/anonymous/6f27671cd65594effd60
[13:27:30] sharpmachine: has joined #ruby
[13:27:34] tvb: when submitting 2 the p of cidr_ip is "2"
[13:27:58] tvb: and the above code is responding as true (eg the ip address "2" is valid)
[13:30:16] tkuchiki: has joined #ruby
[13:30:44] tvb: even p = IPAddress.valid? "2" is returning true
[13:31:32] Ox0dea: Well, it is a valid IP address; it's just another represenation of
[13:31:35] jhass: well, I guess if you dig through the RFCs it actually is
[13:32:20] tvb: Ox0dea: why is it complaining with the following then?
[13:32:20] tvb: `initialize': Invalid IP "2"
[13:32:35] tvb: iprange = IPAddress::IPv4.new cidr_ip
[13:32:51] mister_solo: has joined #ruby
[13:32:55] yorickpeterse: adaedra: No, https://github.com/yorickpeterse/oga
[13:33:00] yorickpeterse: omega Ruby, heh
[13:33:02] jhass: mmh, I wonder if it's a valid v6 but not a valid v4
[13:33:47] jhass: yup, that seems to be it
[13:34:07] adaedra: yorickpeterse: :)
[13:34:27] jhass: tvb: IPAddress.valid_ipv4? "2" #=> false
[13:35:12] tvb: undefined method `valid_ipv4' for IPAddress:Module
[13:35:17] whippythellama: has joined #ruby
[13:35:33] jhass: the ? is part of the method name
[13:36:18] OrbitalKitten: has joined #ruby
[13:36:29] JoshL: has joined #ruby
[13:37:29] nettoweb: has joined #ruby
[13:37:53] tvb: damn im getting done here
[13:38:04] tvb: its time to wrap up and leave the ruby school :)
[13:38:28] Scripore: has joined #ruby
[13:38:39] apofis: has joined #ruby
[13:41:56] lessless: has joined #ruby
[13:42:44] Indian: has joined #ruby
[13:45:13] enebo: has joined #ruby
[13:45:46] Muhannad: has joined #ruby
[13:48:52] mister_solo: has joined #ruby
[13:51:43] erts: has joined #ruby
[13:52:06] adaedra: Once you go into ruby, you don't leave it
[13:52:33] Darkwater: once you go ruby, you never go back
[13:52:55] diegoviola: once you go Ruby you learn how to write code, unlike PHP
[13:53:00] mrmargolis: has joined #ruby
[13:53:14] millerti: has joined #ruby
[13:53:19] catphish: tvb: what is this IPAddress class? it's not part of ruby is it?
[13:53:24] diegoviola: Sorry about that
[13:53:27] tvb: ipaddress gem
[13:53:46] tvb: catphish: https://github.com/bluemonk/ipaddress
[13:53:48] catphish: i normally just use IPAddr
[13:54:15] tvb: catphish: yeah, but it was recommended earlier by ljarvis and it works so :)
[13:54:23] catphish: or does it ;)
[13:55:18] catphish: i don't believe "2" is a valid IP
[13:55:27] catphish: though 2 could be
[13:55:35] adaedra: I think it isn't
[13:55:54] tvb: I think p is putting it in quotes
[13:56:12] catphish: 2 is (it's an integer representing
[13:56:13] adaedra: ::2 and 2:: also
[13:56:42] tvb: having some issues with no implicit conversion of Fixnum into String
[13:56:50] catphish: 2.2 is - if you believe in pre-classful IP addresses :)
[13:56:57] tvb: iprange = IPAddress::IPv4.new cidr_ip
[13:57:13] Darkwater: 2.2 represents
[13:57:13] tvb: where cidr_ip = 2
[13:57:33] catphish: tvb: don't pass an integer to it
[13:57:51] tvb: trying to find out how to convert it correctly
[13:58:04] catphish: tvb: well what data do you have, why 2?
[13:58:14] diegoviola: writing code with python makes me angry for some reason
[13:58:30] Darkwater: running code with python makes me angry
[13:58:30] tvb: well I picked 2 as a test to run against the check for valid ip address
[13:58:31] catphish: it's expecting a string, so if you have an integer, you've done something wrong i'd guess
[13:58:43] Darkwater: because often people use a shebang with /usr/bin/python
[13:58:51] diegoviola: I feel I have to be very strict/explicit with python for some reason
[13:59:09] Darkwater: which resolves to python 3 for me, but those scripts often need 2
[13:59:15] emilkarl: has joined #ruby
[13:59:19] catphish: tvb: to be clear, it's expecting a string, if you're passing 2 to it (an integer) then don't
[13:59:27] cnngimenez: has joined #ruby
[13:59:27] tvb: catphish: I understand
[13:59:36] tvb: so I have to check if it is a string or not, and if not convert it?
[13:59:47] catphish: tvb: where is the data coming from?
[13:59:54] Darkwater: just to input.to_s
[13:59:55] jhass: catphish: 2 does appear to be a valid IPv6 (and is another notation of 2::)
[13:59:58] Darkwater: >> "string".to_s
[13:59:59] ruboto: Darkwater # => "string" (https://eval.in/391870)
[14:00:03] ruboto: Darkwater # => "5" (https://eval.in/391871)
[14:00:03] catphish: tvb: don't put integers in your rspec then
[14:00:37] tvb: catphish: but that is something in the real world could happen als the same arguement used in rspec is an option in option parser
[14:00:48] atom3: has joined #ruby
[14:00:50] tvb: so one could enter just 2
[14:01:06] catphish: in the real world, if someone passes it an integer it *should* throw an error
[14:01:18] tvb: however, i noticed option parser converts it to a string already
[14:01:45] tvb: no implicit conversion of Fixnum into String
[14:02:13] hinbody: has joined #ruby
[14:02:13] catphish: that error means its expecting a string, but received an integer, and they're not sufficiently alike to automatically convert
[14:02:23] msnyon: has joined #ruby
[14:02:29] tvb: catphish: I understand
[14:02:31] izzol: tvb: try with .to_s
[14:02:42] catphish: the error is perfectly correct and means there's a bug elsewhere in the code causing it to receive an integer
[14:02:45] tvb: izzol: nah I just changed the rspec to be a string
[14:02:56] catphish: IMO blindly converting data types to strings is the wrong solution
[14:03:00] tvb: it does not make sense to test against an int as there wont be any int never
[14:03:24] catphish: the correct solution is to raise an error if a programmer ever passes it an integer
[14:03:26] izzol: you never know
[14:03:45] camonz: has joined #ruby
[14:03:50] Darkwater: what if yuo change the options parser to one that does automatically convert "2" to 2
[14:04:06] catphish: tvb: the user input should always be a string anyway
[14:04:23] tvb: Darkwater: then Im screwed
[14:04:47] tvb: Ok last question for today
[14:05:01] tvb: got the rspec as the following now
[14:05:11] tvb: describe -> context -> it
[14:05:15] izzol: ehh, I cannot work because of that weather :<
[14:05:29] devdazed: has joined #ruby
[14:05:34] tvb: now do I need to 'define' the it as well?
[14:05:39] tvb: as in describe it
[14:05:44] catphish: i don't know much about rspec i'm afraid
[14:05:58] sevenseacat: the it block is always the inner-most rspec construction
[14:06:03] sevenseacat: that defines the test iself
[14:06:13] tvb: I guess I don't
[14:06:16] tvb: it do works fine
[14:06:37] tvb: sevenseacat: and not the context?
[14:06:48] sevenseacat: I might have misunderstood the question because it didnt make a lot of sense
[14:06:57] tvb: sevenseacat: heh wait
[14:07:15] tvb: sevenseacat: https://gist.github.com/anonymous/583db03e26d939bdb104
[14:07:24] sevenseacat: yes, ive seen that code a lot now
[14:07:33] tvb: "with correct arguments" -> it
[14:07:43] tvb: do I need to describe the it as well?
[14:07:52] sevenseacat: as you said, it works without it
[14:07:57] tvb: it does
[14:08:08] sevenseacat: that answers your question
[14:08:25] tvb: but what is best practice here?
[14:08:28] sharpmachine: has joined #ruby
[14:08:34] intinig: has joined #ruby
[14:08:43] tvb: run every expect in its own it and describe in the it what it tests?
[14:08:45] sevenseacat: to delete most of that spec and rewrite it
[14:08:49] izzol: As I remember you can do is like: it 'bla bla bla' do (...)
[14:08:55] tvb: sevenseacat: hah!
[14:09:01] sevenseacat: one assertion per test, better descriptions
[14:09:12] tvb: sevenseacat: check
[14:09:15] sevenseacat: your error and success messages are all going to be meaningless
[14:09:40] gamename: has joined #ruby
[14:09:44] fabrice31: has joined #ruby
[14:10:29] fabrice31: has joined #ruby
[14:11:39] kobain: has joined #ruby
[14:12:07] fabrice31: has joined #ruby
[14:12:23] m3_del: has joined #ruby
[14:12:28] dopie: has joined #ruby
[14:12:52] kraljev11: has joined #ruby
[14:14:22] otisZart: has joined #ruby
[14:15:10] tvb: writing good tests is hard
[14:16:11] bruno-: has joined #ruby
[14:18:33] sevenseacat: just takes a lot of practice.
[14:18:50] DoubleMalt: has joined #ruby
[14:19:22] thiagovsk: has joined #ruby
[14:19:27] izzol: tvb: try with minitest. Rspec is not so easy.
[14:19:55] tvb: izzol: I have to work with rspec this time, thanks
[14:19:56] rawtext: has joined #ruby
[14:20:35] dagda1: has joined #ruby
[14:20:42] brain_shim: has joined #ruby
[14:20:44] OrbitalKitten: has joined #ruby
[14:21:01] jpfuentes2: has joined #ruby
[14:21:31] Rollabunna: has joined #ruby
[14:21:47] _blizzy_: has joined #ruby
[14:21:55] Exuma: has joined #ruby
[14:22:05] revath: has joined #ruby
[14:22:25] i8igmac: has joined #ruby
[14:24:12] fabrice31: has joined #ruby
[14:25:42] chouhoulis: has joined #ruby
[14:25:58] BTRE: has joined #ruby
[14:27:19] brettnem: has joined #ruby
[14:29:13] _blizzy_: has joined #ruby
[14:30:48] mary5030: has joined #ruby
[14:33:45] psyprus: has joined #ruby
[14:34:04] Muhannad: has joined #ruby
[14:34:41] decoponio: has joined #ruby
[14:35:01] Baprath: has joined #ruby
[14:35:16] davedev24_: has joined #ruby
[14:35:52] lavros: has joined #ruby
[14:37:11] izzol: has joined #ruby
[14:38:27] diegoviola: has joined #ruby
[14:39:32] Darkwater: wait, you don't need parentheses around arguments when defining a function?
[14:39:48] adaedra: some people like it without, some people with
[14:39:53] Darkwater: I've never seen anyone use it without
[14:39:58] Darkwater: I think it's ugly with
[14:40:08] ljarvis: no it's ugly without :)
[14:40:12] adaedra: I think it's ugly without
[14:40:12] Darkwater: thought they were necessary
[14:40:29] ljarvis: Darkwater: most of mechanize/nokogiri is built without parens.. some people just like the style
[14:40:54] sepp2k: has joined #ruby
[14:40:57] AlexRussia: has joined #ruby
[14:41:27] diegoviola: has joined #ruby
[14:41:59] arturmartins: has joined #ruby
[14:42:04] senayar: has joined #ruby
[14:42:59] yorickpeterse: I heard there are also people that use "then" in if statements
[14:43:41] headius: has joined #ruby
[14:43:51] Exuma: has joined #ruby
[14:44:59] ljarvis: yeah also lots of those in mechanize
[14:45:07] ljarvis: drbrain loves a then
[14:45:35] yorickpeterse: I really don't get why
[14:45:39] eGGsha: has joined #ruby
[14:45:41] yorickpeterse: They add exactly nothing
[14:47:05] sharpmachine: has joined #ruby
[14:47:44] eam: next you're going to hate on the semicolon
[14:48:06] adaedra: puts "bar";
[14:49:00] cpruitt: has joined #ruby
[14:49:36] sluukkonen: has joined #ruby
[14:50:38] kies^: has joined #ruby
[14:53:49] maloik: I still think we should switch to a tab and 3 spaces for indentation
[14:54:10] workmad3: maloik: we should switch to a space and a >
[14:54:22] yorickpeterse: I think the first step is to must make "then" a syntax error
[14:54:24] workmad3: > > >indented 3 times
[14:54:34] yorickpeterse: but I think it's more likely for me to get married tomorrow than for parse.y to ever be cleaned up
[14:54:38] maloik: much more obvious
[14:54:49] maloik: yorickpeterse: mail order bride!
[14:54:49] apeiros: I think we should be more avant-garde than that
[14:54:55] skade: has joined #ruby
[14:54:56] apeiros: we should use ; for indentation
[14:54:57] maloik: (or groom, if that is your thing)
[14:55:05] eam: yorickpeterse: probably easier for you to get married
[14:55:23] workmad3: ooh, how about ????
[14:55:52] adaedra: oooh, how about DON'T
[14:55:59] yorickpeterse: eam: yeah, I'm at least not made out of 11000 lines of wtf
[14:56:06] workmad3: adaedra: hmm... it would look a bit odd multiple times at the start of a line
[14:56:15] eam: and that's not counting the regex parser
[14:56:16] workmad3: DON'TDON'TDON'T some indent...
[14:56:25] ljarvis: obviously we should use back to back parenthesis. ()def foo;()()bar -- it would be a syntax error if one wasn't closed so we can ensure at the very least, the number of parens are always even
[14:56:48] eam: ljarvis: hm, this guarantees an even number of indent characters, I like it
[14:57:01] adaedra: You're all horrible
[14:57:09] adaedra: Is it the heat that affects you?
[14:57:17] ljarvis: I should propose it, shouldn't be hard to add to parse.y
[14:57:25] senayar: has joined #ruby
[14:58:01] workmad3: adaedra: no, we're like this anyway :P
[14:58:02] yorickpeterse: sounds like somebody wants to cut their wrist
[14:58:06] yorickpeterse: should we call the police?
[14:58:17] ljarvis: the parse.y police
[14:58:21] ljarvis: that thing really should be policed
[14:58:24] eam: rubocop
[14:58:34] adaedra: I can't cut my wrist, it melted
[14:58:37] adambeynon: has joined #ruby
[14:59:00] jaygen: has joined #ruby
[15:00:05] yorickpeterse: I also really don't get why it suggests "fail" over "raise"
[15:00:08] sharpmachine: has joined #ruby
[15:00:09] yorickpeterse: it's literally just a meaningless alias
[15:00:14] yorickpeterse: and you don't fail errors, you raise them
[15:00:25] yorickpeterse: ACTION shakes cane
[15:01:02] acke: has joined #ruby
[15:01:03] ljarvis: Success! http://jarvo.io/s/3oZq0A.png
[15:01:18] phutchins1: has joined #ruby
[15:01:38] workmad3: ljarvis: SO PRETTY!!!!
[15:02:05] yorickpeterse: oh, that's already valid syntax IIRC
[15:02:19] adaedra: >>()puts "Hello"
[15:02:20] ruboto: adaedra # => /tmp/execpad-290f947aa5c4/source-290f947aa5c4:2: syntax error, unexpected tIDENTIFIER, expecting key ...check link for more (https://eval.in/391907)
[15:02:30] yorickpeterse: oh hm it's not
[15:02:52] yorickpeterse: ljarvis: you monster
[15:02:55] rawtext: has joined #ruby
[15:02:57] ljarvis: in other news, I forgot how to record the number of times a character occurs in vim and use that are a replacement
[15:03:06] yorickpeterse: ACTION just fucked up stuff in Pry, so hence he thought it would work
[15:03:21] yorickpeterse: ljarvis: also how on earth can you stare at this font all day?
[15:03:27] yorickpeterse: the aliasing is all over the place
[15:03:32] ljarvis: SACRILIDGE
[15:03:38] ljarvis: or that word spelt properly
[15:03:47] yorickpeterse: monospaced, unaliased fonts fo lyfe
[15:03:50] ljarvis: my font is fucking delicious
[15:03:59] ljarvis: it's monospaced, just aliased
[15:04:02] Ox0dea: yorickpeterse: Tamsyn?
[15:04:08] adaedra: you don't code in Comic-Sans?
[15:04:35] ljarvis: Bitsream Vera Sans Mono
[15:04:39] ljarvis: that is my jam
[15:05:01] yorickpeterse: http://downloads.yorickpeterse.com/images/screenshot_2015_07_03_17_04_55.png
[15:05:28] ljarvis: never got on with old ass monospaced thing tiny noob fonts
[15:05:30] workmad3: yorickpeterse: that font makes small children cry :(
[15:05:39] ljarvis: workmad3: <3
[15:05:40] yorickpeterse: Good thing I'm not a small child
[15:06:27] adaedra: you made sevenseacat leave! D:
[15:06:37] yorickpeterse: adaedra: they left in awe
[15:06:48] ljarvis: of my screenshot prolly
[15:07:07] phizzbuzz: has joined #ruby
[15:07:11] symm-: has joined #ruby
[15:07:11] darix: yorickpeterse: stop breaking things!
[15:07:13] Papierkorb_: has joined #ruby
[15:07:15] adaedra: we all know monofur is best programming font
[15:07:51] yorickpeterse: or just use Times New ROman
[15:07:54] yorickpeterse: works everywhere
[15:08:19] adaedra: ACTION shoots yorickpeterse
[15:09:09] ljarvis: na that one can't do lower case o's
[15:09:13] yorickpeterse: where's the police brutality now?
[15:09:28] yorickpeterse: normally it's all "OOOH THAT'S OFFTOPIC" and now it's all ok
[15:09:32] adaedra: in french, "font" is ?? police ??
[15:09:33] ruboto: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[15:10:17] ramfjord: has joined #ruby
[15:10:20] apeiros: /kick yorickpeterse here's the power tripping psycho cop police brutality - happy? :D
[15:11:14] adaedra: The ?ot, aka ?STOPFUNNOW
[15:13:08] m3_del: has joined #ruby
[15:13:54] Ox0dea: >> (___=->_,__=''{__=_[$.]+__;_[$.+=$$/$$]?___[_,__]:__})['?gnirts a esrever ot yaw tseb eht siht sI']
[15:13:55] ruboto: Ox0dea # => "Is this the best way to reverse a string?" (https://eval.in/391917)
[15:15:11] Ox0dea: I thought so.
[15:16:24] riotjones: has joined #ruby
[15:16:33] Darkwater: clever use of $.
[15:17:14] Igorshp_: has joined #ruby
[15:17:39] aZtec_: has joined #ruby
[15:18:13] aZtec_: I have an array of objects with a "start" date property that is sorted asc. by that property
[15:18:39] thoraxe: has joined #ruby
[15:18:53] xcesariox: has joined #ruby
[15:18:53] aZtec_: I want to move all elements with a start-date smaller than Time.now to be moved to the back. can i do this in-place or should i use a new array for the sorted objects?
[15:19:02] thoraxe: if I have a Gemfile that specifies only one source, why would "bundle install" go to rubygems.org if that is not the source specified?
[15:19:27] Ox0dea: Aztec_: array.rotate(array.index { |o| o.start < Time.now })
[15:19:31] Ox0dea: Or something along those lines.
[15:19:36] Ox0dea: Also #rotate!.
[15:20:10] aZtec_: oh wow, i knew there had to be a more elegant solution than iterating and inserting at the back ^^thx, Ox0dea
[15:20:16] Ox0dea: Sure thing.
[15:20:26] Ox0dea: In hindsight, you'll want to flip the comparison as well.
[15:21:08] gambl0re: has joined #ruby
[15:21:45] adaedra: Ox0dea: r,w = Array.new(2) { IO.pipe }; fork do r[0].close; w[1].close; STDOUT.reopen(r[1]); STDIN.reopen(w[0]); exec 'rev' end; w[0].close; r[1].close; w[1].write "?siht tuoba woH"; w[1].close; r[0].read
[15:21:59] blue_deref: has joined #ruby
[15:22:26] Ox0dea: Shelling out cannot possibly be the best way to reverse a string in Ruby.
[15:22:55] aZtec_: so Ox0dea I assume this approaches it from the opposite direction, by moving all future events to the front
[15:23:02] ljarvis: seems inconclusive
[15:23:57] a346: has joined #ruby
[15:24:14] bullcitydev: has joined #ruby
[15:24:32] nettoweb: has joined #ruby
[15:24:34] iamjoe: has joined #ruby
[15:24:57] Darkwater: Ox0dea: finally understand it know
[15:24:58] Ox0dea: Aztec_: It finds the index of the first future event and rotates the array to the left that many times.
[15:24:58] Darkwater: took long lol
[15:25:04] Ox0dea: Darkwater: Really?
[15:25:13] Darkwater: the obfuscated code? yeah
[15:25:29] Darkwater: note that I had to figure out lambdas as well
[15:25:33] Darkwater: since I have like 0 experience with them
[15:26:32] Ox0dea: >> foo = [1, 2, 3, 4, 5, 6]; foo.rotate(foo.index { |e| e > 3 })
[15:26:33] ruboto: Ox0dea # => [4, 5, 6, 1, 2, 3] (https://eval.in/391919)
[15:26:45] Ox0dea: Aztec_: ^ Replace the 3 with Time.now and everything ought to fall into place.
[15:27:42] aZtec_: yea i didn't get #rotate until now
[15:27:52] joneshf-laptop: has joined #ruby
[15:28:09] aZtec_: but i'm getting nil from #index...pretty sure it's just a detail though
[15:28:22] pizzaops: has joined #ruby
[15:28:45] senayar: has joined #ruby
[15:28:45] senayar: has joined #ruby
[15:29:03] dopie: has joined #ruby
[15:29:05] sharpmachine: has joined #ruby
[15:29:55] ccooke: Aztec_: I must admit, in a similar problem (a set of metrics for a monitoring system), I always simply use sort_by and resort the metric set each time.
[15:30:21] ccooke: However, that's also because the metrics after being processed need to be reinserted at effectively random points.
[15:30:45] ccooke: A b-tree would be more efficient, but for the datasets I'm using it's not necessary
[15:30:53] ccooke: (and sort_by is much easier to read)
[15:31:16] aZtec_: i'm dealing with, at most, 30 items so a b-tree would be overkill
[15:31:42] ccooke: yeah. sort_by is a perfectly reasonable solution, and it's clearer to read what's going on
[15:32:37] aZtec_: but is there a way to use sort_by in the way i want to use it? having a delimiter, with the values smaller ending up behind the values larger than the delimiter?
[15:32:41] Ox0dea: ccooke: I think you've misinterpreted the problem Aztec_ is trying to solve.
[15:32:58] ccooke: Ox0dea: entirely possible, I just came back from a meeting :-)
[15:33:18] aZtec_: it's always nice to have b-trees appear in discussions though
[15:33:54] havenwood: has joined #ruby
[15:34:38] timonv: has joined #ruby
[15:35:35] Ox0dea: ccooke: Aztec_ wants to, essentially, join the partitions of a sorted array in the opposite order.
[15:35:56] chinmay_dd: has joined #ruby
[15:36:29] n1ftyn8_: has joined #ruby
[15:36:34] Ox0dea: >> foo = [1,2,3,4,5,6]; foo.partition { |x| x > 3 }.reduce(:+)
[15:36:36] ruboto: Ox0dea # => [4, 5, 6, 1, 2, 3] (https://eval.in/391930)
[15:37:06] Ox0dea: But using #rotate and #index is a little nicer and can be done in-place.
[15:37:33] jack_rabbit: has joined #ruby
[15:39:27] langlands: has joined #ruby
[15:39:43] Channel6: has joined #ruby
[15:40:04] aZtec_: test passes Ox0dea....my setup/data-prep was a mess, which is why index found nothing
[15:42:40] jeanlinux: has joined #ruby
[15:44:04] Ox0dea: Aztec_: That's good, but I've got some crow to eat; #sort_by is indeed better, but you have to account for the fact that Ruby's booleans aren't comparable/ordered.
[15:44:07] Ox0dea: >> foo = [1,2,3,4,5,6]; foo.sort_by { |x| x > 3 ? 0 : 1 }
[15:44:08] ruboto: Ox0dea # => [4, 5, 6, 1, 2, 3] (https://eval.in/391934)
[15:44:21] zzor: has joined #ruby
[15:44:23] Ox0dea: This does rely on Ruby's preserving insertion order, but of course it does.
[15:44:53] michael_mbp: has joined #ruby
[15:45:14] mrmargolis: has joined #ruby
[15:45:15] cytoskeletor: has joined #ruby
[15:45:31] aZtec_: hm that's indeed even nicer
[15:45:54] shevy: you eat crows?
[15:45:55] Ox0dea: It reads nicer, anyhow, but I suspect #rotate moves data about less frequently.
[15:47:28] atom3: has joined #ruby
[15:47:41] apofis: has joined #ruby
[15:47:49] bruno-: has joined #ruby
[15:47:54] jeanlinux: has joined #ruby
[15:48:42] acke: has joined #ruby
[15:48:55] renderful: has joined #ruby
[15:49:29] penzur: has joined #ruby
[15:53:49] Peteykun: has joined #ruby
[15:54:26] bb010g: has joined #ruby
[15:56:21] wallerdev: has joined #ruby
[15:58:24] GnuYawk: has joined #ruby
[16:00:10] chinmay_dd: has joined #ruby
[16:02:53] maZtah: has joined #ruby
[16:05:55] sarkyniin: has joined #ruby
[16:06:14] victortyau: has joined #ruby
[16:09:36] senayar: has joined #ruby
[16:09:36] senayar: has joined #ruby
[16:11:26] meph: has joined #ruby
[16:11:38] sharpmachine: has joined #ruby
[16:13:01] mandarinkin: has joined #ruby
[16:13:53] m3_del: has joined #ruby
[16:15:00] chinmay_dd_: has joined #ruby
[16:16:28] serivich: has joined #ruby
[16:18:43] scunc: has joined #ruby
[16:18:48] penzur: has joined #ruby
[16:19:29] bf4: has joined #ruby
[16:19:54] scunc: has left #ruby: ()
[16:20:04] chinmay_dd: has joined #ruby
[16:20:54] lavros: has joined #ruby
[16:21:15] shinnya: has joined #ruby
[16:22:10] sankaber: has joined #ruby
[16:22:39] endash: has joined #ruby
[16:23:27] NeverDie: has joined #ruby
[16:24:50] sbhatore: has joined #ruby
[16:28:29] abuzze: has joined #ruby
[16:29:17] chinmay_dd_: has joined #ruby
[16:29:37] findaway: has joined #ruby
[16:29:57] willharrison: has joined #ruby
[16:30:01] sbhatore: Hey! This is a question regarding aes-256-gcm encryption algorithm. The function p2 works in the case of aes-256-cbc algorithm
[16:30:01] sbhatore: https://gist.github.com/sbhatore/1787fe1784f1f79d5f0d
[16:30:01] sbhatore: while it doesn't in case of aes-256-gcm for the similar code
[16:30:01] sbhatore: https://gist.github.com/sbhatore/345f5bc8098c3011dfd6
[16:30:01] sbhatore: and gives this error: OpenSSL::Cipher::CipherError: in the decipher.final. Can someone help me with this please, on how to make the gcm encryption work. It encrypts perfectly, but gives the above error in decryption.
[16:30:40] bryancp: has joined #ruby
[16:33:43] dopie: has joined #ruby
[16:34:13] chinmay_dd: has joined #ruby
[16:34:22] deimos: has joined #ruby
[16:36:21] mandarinkin: has joined #ruby
[16:36:25] abuzze: has joined #ruby
[16:36:35] blackmesa: has joined #ruby
[16:37:04] Aryasam: has joined #ruby
[16:37:47] havenwood: sbhatore: You're not setting the #auth_tag=?
[16:38:22] sbhatore: havenwood: Hmmm..I think I tried that. Let me try again
[16:38:28] havenwood: sbhatore: Err, rather saving #auth_tag and providing it to the decipher.
[16:38:29] neanderslob: has joined #ruby
[16:38:33] sharpmachine: has joined #ruby
[16:38:48] havenwood: sbhatore: tag = cipher.auth_tag
[16:39:09] rdema: has joined #ruby
[16:39:33] n008f4g_: has joined #ruby
[16:39:55] mburns: has joined #ruby
[16:41:22] chinmay_dd: has joined #ruby
[16:41:25] chouhoulis: has joined #ruby
[16:42:04] sbhatore: havenwood: Thanks a bunch. You saved my day :) I think I did the tag think incorrectly before
[16:42:19] havenwood: sbhatore: you're welcome!
[16:42:58] fgo: has joined #ruby
[16:43:17] jaredrhine: has joined #ruby
[16:45:03] shevy: we dance the RUBY dance
[16:45:12] Sweeper: you can dance if you want to
[16:45:17] Sweeper: you can leave python behind
[16:45:19] shevy: your nick invites me to dance!
[16:45:36] shevy: pythons can dance too... I saw it in the jungle book :)
[16:45:38] Agoldfish: has joined #ruby
[16:46:29] _whitelogger: has joined #ruby
[16:47:41] drPoggs: has joined #ruby
[16:48:02] elektronaut: has joined #ruby
[16:49:14] charles81: has joined #ruby
[16:50:16] manveru: has joined #ruby
[16:50:53] bcavileer: has joined #ruby
[16:51:28] chinmay_dd_: has joined #ruby
[16:52:48] mleung: has joined #ruby
[16:53:11] mfranzwa: has joined #ruby
[16:54:53] speaking1ode: has joined #ruby
[16:55:22] Jackneill: has joined #ruby
[16:56:06] JimmyNeutron: has joined #ruby
[16:56:17] willharrison: has joined #ruby
[16:57:25] jaroslav: has joined #ruby
[16:57:26] tlarevo: has joined #ruby
[17:00:14] jaroslav: guys, can somebody please help me understand how to properly build a simple gem, with the main file "lib/foo.rb" implementing class, not module?
[17:00:58] jaroslav: I know it is possible, saw some examples, however I'd like to follow standard 'bundler' setup, with gem version in "lib/foo/version.rb" <- that's causing problems
[17:01:40] havenwood: jaroslav: class Foo; VERSION =
[17:01:43] northfurr: has joined #ruby
[17:02:08] apeiros: ?guys jaroslav
[17:02:08] ruboto: jaroslav, we're not all guys - did you mean folks, y'all, everyone?
[17:02:11] havenwood: jaroslav: Change that file to `class Foo` instead of `module Foo`.
[17:02:35] Akagi201: has joined #ruby
[17:02:47] jaroslav: apeiros: sorry, I guess that can be a language difference, I'm using "guys" thinking about all possible genders
[17:02:48] davedev24: has joined #ruby
[17:03:22] apeiros: jaroslav: cool. but in here, not everybody feels that way, so please try to use another word (or just leave it off - your question works without it too)
[17:03:36] jaroslav: apeiros: ack
[17:03:52] bmurt: has joined #ruby
[17:04:17] shevy: jaroslav basically, all you have to do is load up all the .rb files in your gem-structured code
[17:04:35] shevy: so lib/foo/version is really: require 'foo/version.rb'
[17:05:50] jaroslav: havenwood: I have additional problem, my class 'Foo' inherits from 'JIRA::Client'. And that's what I have in my foo.rb; But if in lib/foo/version.rb I just write: "class Foo; VERSION = ", it doesn't work as it complains 'superclass mismatch' ;)
[17:06:16] jhass: jaroslav: yap, you have to repeat it everywhere. Or reconsider making the toplevel a class
[17:06:33] jhass: common alternatives are Foo::Client and such
[17:07:51] cmisenas: has joined #ruby
[17:08:11] enedil: has joined #ruby
[17:08:15] jaroslav: jhass: right... and that was what I had initially; however, I didn't like the fact that my gem name does not correspond to namespacing of my modules / classes.
[17:08:21] jaroslav: But maybe there's no other way
[17:08:53] mikecmpbll: has joined #ruby
[17:08:53] jhass: what do you mean it didn't correspond?
[17:08:59] jaroslav: I wanted to have a gem called 'foo-client', where Foo is a module, Client is a class in it, that inherits from JIRA::Client
[17:09:11] jaroslav: I don't want to call the gem just 'foo'
[17:09:16] jhass: well, then you're even supposed to have Foo::Client
[17:09:25] podman: has joined #ruby
[17:09:28] jhass: oh, wait, I see what you mean
[17:09:41] jaroslav: jhass: yup, I have Foo::Client, but this client is a class ;)
[17:10:10] dfockler: has joined #ruby
[17:10:10] jaroslav: I don't want to have a Foo::Client *module* with Foo::Client::Client class in it, that would be... weird ;)
[17:10:16] sbhatore: https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-4.5. Does anyone know what an 'empty octet sequence' is in the 4th line of section 4.5 and how to create one ?
[17:10:17] jeanlinux: has joined #ruby
[17:10:30] jhass: jaroslav: mmh, I'd probably go for repeating the superclass then
[17:10:47] drew0: has joined #ruby
[17:11:24] jhass: sbhatore: "", empty string, nothing
[17:11:34] rfv: has joined #ruby
[17:11:50] alphaatom: has joined #ruby
[17:12:48] djbender: has joined #ruby
[17:13:07] sbhatore: jhass: thanks !!
[17:14:06] The_Phoenix: has joined #ruby
[17:14:12] havenwood: xxneolithicxx: hi
[17:14:30] shevy: heya paleolithic!
[17:14:39] m3_del: has joined #ruby
[17:15:06] The_Phoenix: has joined #ruby
[17:15:07] xxneolithicxx: hi shevy bronco
[17:16:02] [H]unt3r: has joined #ruby
[17:16:09] jaroslav: jhass: thanks, yeah, that's probably best option to specify the superclass in both places. I really don't like to change the namespacing.
[17:16:28] The_Phoenix: has joined #ruby
[17:17:43] The_Phoenix: has joined #ruby
[17:18:48] The_Phoenix: has joined #ruby
[17:19:27] Agoldfish378: has joined #ruby
[17:19:49] The_Phoenix: has joined #ruby
[17:19:51] s00pcan: has joined #ruby
[17:20:08] postmodern: has joined #ruby
[17:24:44] rapha: has joined #ruby
[17:25:46] rapha: With ".sort_by {|x, y| [y, x]}" (x being a string and y being an integer), how do I reverse the sorting direction of x, but not of y?
[17:27:14] apeiros: or use the sorting gem: [asc(y), desc(x)]
[17:27:24] rapha: apeiros: tried that first ... undefined method `-@' for "????":String
[17:27:29] gambl0re: has joined #ruby
[17:27:34] rapha: oh, that sounds nice!
[17:27:50] apeiros: oh, x being a *string*
[17:27:55] apeiros: I read both were integers, sorry
[17:28:28] apeiros: sorting gem then :)
[17:28:32] rapha: apeiros: do you mean the gem by the exact name of "sorting"? because that exists, but is version 0.0.2 only...
[17:28:57] apeiros: I didn't receive any bug tickets. maybe I should just rerelease as 1.0 :o)
[17:29:39] apeiros: or take a page from passenger and release a 1.0.2
[17:30:33] rapha: undefined method `asc' for main:Object
[17:30:43] rapha: just "require 'sorting'", correct?
[17:30:51] apeiros: that doesn't add monkey patches
[17:30:52] findaway: has joined #ruby
[17:30:54] msnyon_: has joined #ruby
[17:31:14] apeiros: if you want toplevel asc/desc you need to require "sorting/convenience"
[17:31:26] CatMartyn: has joined #ruby
[17:31:28] apeiros: otherwise: Sorting.asc/Sorting.desc, and your toplevel remains untouched :)
[17:31:37] apeiros: (or Kernel, actually)
[17:31:38] rapha: this is a teeny, tiny script, convenience sounds good.
[17:31:51] bruno-: has joined #ruby
[17:32:12] apeiros: If I ever get around, I'll add refinements, so `using Sorting` works too :)
[17:32:48] apeiros: the readme covers most important parts: https://github.com/apeiros/sorting
[17:32:53] jhass: apeiros: would be a good reason to 1.0 it :P
[17:32:54] apeiros: you can also use asc/desc to handle nils f.ex.
[17:33:01] apeiros: jhass: true, true
[17:33:06] apeiros: you mean 1.0.2 it?
[17:33:09] rapha: nice, best word frequency analysis script ever! :-P
[17:33:44] jhass: apeiros: 1.1.0. I started to use 0.1.0 as initial version^^
[17:33:49] rapha: apeiros: starred and watched!
[17:33:50] bruno-: has joined #ruby
[17:33:51] bmurt: has joined #ruby
[17:34:02] EnergyCoffee: has joined #ruby
[17:34:04] mrmargolis: has joined #ruby
[17:34:15] apeiros: rapha: top :) if you find an issue, let me know!
[17:34:58] luckyno7: has joined #ruby
[17:35:15] EnergyCoffee: has joined #ruby
[17:35:42] baweaver: has joined #ruby
[17:36:31] EnergyCoffee: has joined #ruby
[17:36:37] iateadonut: has joined #ruby
[17:36:44] OrbitalKitten: has joined #ruby
[17:37:03] sharpmachine: has joined #ruby
[17:37:46] EnergyCoffee: has joined #ruby
[17:38:29] skmp: has joined #ruby
[17:39:02] EnergyCoffee: has joined #ruby
[17:39:16] bruno-_: has joined #ruby
[17:39:43] SCHAAP137: has joined #ruby
[17:40:17] EnergyCoffee: has joined #ruby
[17:40:32] slash_nick: apeiros: README, might could link to the file instead of telling the path to it ({file:documentation/examples.rb})... same for LICENSE?
[17:41:30] EnergyCoffee: has joined #ruby
[17:41:33] rapha: apeiros: will do, but for my current usecase it works ... well ... like a gem :)
[17:42:12] abuzze: has joined #ruby
[17:42:29] nofxx: has joined #ruby
[17:42:41] rubynuby: has joined #ruby
[17:42:47] EnergyCoffee: has joined #ruby
[17:43:27] brain_shim: has joined #ruby
[17:44:01] EnergyCoffee: has joined #ruby
[17:45:17] EnergyCoffee: has joined #ruby
[17:46:34] EnergyCoffee: has joined #ruby
[17:46:52] millerti: has joined #ruby
[17:47:27] mandarinkin: has joined #ruby
[17:47:36] shevy: is it common to see modifications such as: class Gtk::TextIter
[17:47:50] shevy: as in, directly, rather than do; class Gtk; class TextIter # or something like that
[17:49:10] jhass: yeah, feels like roughly 35% do that
[17:49:12] yqt: has joined #ruby
[17:49:30] spider-mario: has joined #ruby
[17:51:21] adamski2600: has joined #ruby
[17:51:21] rubynuby: has joined #ruby
[17:53:10] linocisco: has joined #ruby
[17:53:12] Kruppe: has joined #ruby
[17:53:27] rubynuby: has left #ruby: ()
[17:53:41] krz: has joined #ruby
[17:56:03] slash_nick: if you try to adhere to a limit of 80 columns per line, it saves a couple of spaces (2*Nmodules spaces)
[17:56:19] rapha: apeiros: if you have a minute, here's the word frequency analysis script ... it does what I want, but I'd be happy about general criticism! https://gist.github.com/sixtyfive/c03bc1bbb91a8e61b849
[17:57:03] Salehi: has joined #ruby
[17:57:19] Salehi: Hey guys, please vote ruby in
[17:57:19] Salehi: https://www.toptal.com/technology-battles/ruby-vs-python?utm_campaign=ruby-vs-python&utm_medium=email&utm_source=toptal
[17:57:31] Salehi: Ruby needs you! right now
[17:58:45] jhass: ?guys Salehi
[17:58:45] ruboto: Salehi, we're not all guys - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[17:59:01] adaedra: I'm not your guy, pal
[17:59:13] saadq: has joined #ruby
[17:59:23] Salehi: :D OK folks !
[17:59:31] slash_nick: I'm partial to y'all
[17:59:37] mozzarella: there's a gender neutral "guys", look it up
[17:59:52] dopie: has joined #ruby
[17:59:54] shevy: adaedra is my french girl
[18:00:03] drew0: ruboto: That's a good point. I am guilty of using 'guys' in place of plural 'you', but I should make an effort to not. Thanks for pointing it out!
[18:00:11] ruboto: I don't know anything about bot
[18:00:17] ruboto: I don't know anything about python
[18:00:19] jhass: mozzarella: it's regionally different, hence better to avoid
[18:00:20] shevy: this bot needs to learn more
[18:00:30] linocisco: has left #ruby: ("Leaving")
[18:00:55] ruboto: I'm the channel bot, linker of the rules, adept of the facts, wielder of the banhammer.
[18:01:05] ruboto: Please respect the channel rules: http://ruby-community.com/pages/user_rules
[18:01:11] Salehi: jhass: ruboto, good starting point :D
[18:01:12] bougyman: i've never read 'em, heh.
[18:01:53] CatMartyn: has joined #ruby
[18:02:18] shevy: the rules mention that you can get banned for "Trolling"
[18:02:24] bougyman: that could be a lot shorter if you just linked to http://www.catb.org/esr/faqs/smart-questions.html
[18:02:37] bougyman: a lot of DRY
[18:02:53] shevy: are you saying that you don't believe in https://xkcd.com/927/ bougyman
[18:03:06] Salehi: Ruby is 10 and python is 20 in the voting right now! I like Ruby and I'm here to ask you folks to vote ruby in https://www.toptal.com/technology-battles/ruby-vs-python
[18:03:16] shevy: but it stayed at 11
[18:03:21] shevy: I mean 10
[18:03:23] bougyman: why are you advertising some crappy poll.
[18:03:54] Salehi: bougyman: Because I don't like python! and I wanna Ruby wins this voting!
[18:04:04] mister_solo: has joined #ruby
[18:04:10] shevy: sentence was not finished yet
[18:04:16] shevy: Salehi, #python has like 2000 people
[18:04:28] bougyman: Salehi: I'm pretty sure it doesn't matter to me.
[18:04:35] bougyman: I'm absolutely sure, in fact.
[18:04:45] shevy: yeah but it matters to him!
[18:04:50] Salehi: bougyman: Yeah, this is another perspective :D
[18:04:58] shevy: he wins a cookie if ruby wins
[18:05:03] Salehi: shevy: I don't join in #python ;) :D
[18:05:13] rapha: ruboto: "guys" has pretty much changed to mean "y'all" and is definitely inclusive of women nowadays.
[18:05:16] shevy: I would but for some reason I can not pick the nick "python" :(
[18:05:22] bougyman: my son codes python for a living.
[18:05:30] bougyman: not by choice, he's 21 so he had to take what he could get.
[18:05:38] bougyman: he got some django gig.
[18:05:47] Salehi: rapha: I think so
[18:05:50] shevy: django looked more interesting than the rest of python
[18:05:55] CatMartyn: has joined #ruby
[18:05:57] JeramyRR: has joined #ruby
[18:06:02] tomaz_b: has joined #ruby
[18:06:05] shevy: and rails :)))
[18:06:29] bougyman: i've been spending 1.5 years on getting my current $dayjob off-rails
[18:06:29] shevy: but I dunno, does anyone actually use both ruby and python at the same time, in equal parity?
[18:06:31] bougyman: we're really close.
[18:06:34] Salehi: shevy: but seems to stopped development for a while :D
[18:06:38] bougyman: moving to roda and sinatra micro-apps.
[18:06:45] Salehi: shevy: Django is good, but Rails is awesome :D
[18:06:51] baweaver: shevy: /me raises hand
[18:06:52] drew0: rapha, I shared that opinion for a while, but I later realized that it's not just "how you intend it," but also "how it is received."
[18:07:03] bougyman: I prefer roda but a lot of the devs like barrister, which is sinatra-backed.
[18:07:14] shevy: baweaver wow
[18:07:16] bougyman: there's a clear path to replacing sinatra with roda behind barrister, though.
[18:07:18] shevy: you are one clever beaver
[18:07:22] bougyman: we just haven't taken the time to do so.
[18:07:26] baweaver: Saltstack as opposed to Chef
[18:07:35] baweaver: ACTION has a seething hatred of Chef
[18:07:47] bougyman: if you hate chef, you'll hate salt, too
[18:07:50] Scrofff: has joined #ruby
[18:08:02] bougyman: salt, puppet, ansible, chef, others.
[18:08:06] bougyman: i've used probably a dozen.
[18:08:06] baweaver: All CMs are junk honestly.
[18:08:08] Salehi: shevy: & me ( raising hand )
[18:08:11] bougyman: they all have hatable factors.
[18:08:16] bougyman: baweaver: exactly.
[18:08:18] baweaver: First one to incite stockholme syndrome wins
[18:08:28] bougyman: you just have to make the most of them and workaround the individuaal weaknesses.
[18:08:39] rapha: drew0: that's true for any and all communication and imo not solved by picking out a word here or a word there.
[18:09:07] bougyman: confluence is a meta-meta-cm
[18:09:12] bougyman: it has some hope.
[18:09:14] baweaver: The entire metaphor game is cute and all, but really should be kept out of design
[18:09:23] shevy: Salehi you really use both ruby and python?
[18:09:34] bougyman: I use both.
[18:09:39] baweaver: especially if you can't even keep to your own metaphor (Chef / cooking)
[18:09:47] bougyman: we're heavily dependent on buildbot, which is all python.
[18:09:49] Salehi: shevy: Yes, but I'm new to Rails
[18:10:07] apeiros: slash_nick: it does. github doesn't process the links that way. i.e. if you open the docs locally it's linked
[18:10:21] Salehi: shevy: I found the rails awful :D
[18:10:23] bougyman: i prefer buildbot to all of the other ci implementations i've tried.
[18:10:23] apeiros: rapha: sorry, I'm off for today. if you ping me tomorrow, I'll have a look :)
[18:10:24] baweaver: Admittedly working on getting more into Scala and Spark at the moment. DevOps is getting a bit tedious.
[18:10:29] atom3: has joined #ruby
[18:10:42] drew0: rapha: agreed, but it's a very easy courtesy, imho.
[18:10:43] yqt: has joined #ruby
[18:11:09] Akagi201: has joined #ruby
[18:11:11] Salehi: shevy: /msg ?
[18:11:13] drew0: @shevy we use both ruby and python daily.
[18:11:19] rapha: apeiros: okay, have a nice day! :)
[18:12:30] baweaver: As of now I'm about equal parts Javascript, Ruby, Python, and Scala if you average the days of the week.
[18:13:04] radialneon: has joined #ruby
[18:13:42] rapha: drew0: i guess i have become defensive about these matters... the city in which i live has a lot of left-wing political people in it and for a while now there've been posters and flyers saying things like "make feminism a threat" everywhere. and while i'm 100% for equal rights, equal chances, equal pay, equal whatnot, this sort of aggressive and antipacifistic rhethoric appals me.
[18:13:53] bougyman: 70/20/10 ruby, pg/plsql, python.
[18:14:27] jhass: rapha: drew0 if you want to discuss this extensively, please head over to #ruby-offtopic ;)
[18:14:55] baweaver: then again I'm still a young pup myself at 25, so a ways to go yet.
[18:15:25] m3_del: has joined #ruby
[18:15:28] PaulCapestany: has joined #ruby
[18:15:30] El3k0n: has joined #ruby
[18:16:09] seitensei: has joined #ruby
[18:16:09] seitensei: has joined #ruby
[18:16:25] Channel6: has joined #ruby
[18:17:19] wallerdev: has joined #ruby
[18:17:38] s00pcan: has joined #ruby
[18:18:44] Scripore: has joined #ruby
[18:20:20] davedev24_: has joined #ruby
[18:22:43] sharpmachine: has joined #ruby
[18:22:57] balazs_: has joined #ruby
[18:23:15] cstrahan: has joined #ruby
[18:23:30] Scroff: has joined #ruby
[18:23:49] artmann: has joined #ruby
[18:24:45] shevy: has joined #ruby
[18:24:53] chris2: has joined #ruby
[18:25:07] nwhirschfeld: has joined #ruby
[18:25:23] jenksy: has joined #ruby
[18:25:54] Scrofff: has joined #ruby
[18:26:21] kirun: has joined #ruby
[18:26:40] Scrofff: has joined #ruby
[18:27:06] Mekkis: has joined #ruby
[18:28:03] super: has joined #ruby
[18:28:32] crdpink: has joined #ruby
[18:30:24] Gnea: has joined #ruby
[18:31:10] findaway: has joined #ruby
[18:31:30] rmoriz: has joined #ruby
[18:31:56] abuzze: has joined #ruby
[18:32:24] gkra: has joined #ruby
[18:36:57] baweaver: Ox0dea: http://keeprubyweird.com/ - I found a convention for ya
[18:36:58] yfeldblum: has joined #ruby
[18:37:50] StephenOTT: has joined #ruby
[18:39:10] slash_nick: baweaver: i like the sound of that
[18:39:47] baweaver: I might go over Clairvoyance and actually release part of it finally
[18:40:15] baweaver: Think TDD on steroids
[18:40:32] baweaver: RSPEC code is still just code, which means you can totally run it through another parser
[18:40:48] codecop: has joined #ruby
[18:40:52] baweaver: what if that parser, instead of testing the code, wrote the code it thought the test was referring to?
[18:41:15] MiracleBlue: has joined #ruby
[18:41:20] tvw: has joined #ruby
[18:41:46] fmcgeough: has joined #ruby
[18:41:59] baweaver: (psuedo) describe MyClass: describe '#function': it 'returns 5': expect(subject.function).to eq(5) -> class MyClass; def function; 5 end end
[18:42:40] perturbation: has joined #ruby
[18:43:06] baweaver: contexts normally describe logic branches, describes normally reference functions, etc
[18:43:09] multi_io: has joined #ruby
[18:43:21] baweaver: then just ping pong it until it can get the tests to pass.
[18:43:44] baweaver: or give up and give you what its best guess is as to the code as it should be written.
[18:44:10] baweaver: Fair warning, this thing is a nightmare to make work properly.
[18:47:35] baweaver: Submitting that as my talk.
[18:48:20] abuzze: has joined #ruby
[18:51:48] maasha: has joined #ruby
[18:51:54] baweaver: shevy: I need opinions on this madness of mine.
[18:52:08] Scroff: has joined #ruby
[18:52:20] OrbitalKitten: has joined #ruby
[18:53:05] jaygen_: has joined #ruby
[18:53:18] Frem: has joined #ruby
[18:53:28] shevy: the shevy shall bring order into the chaos of the mind!
[18:53:51] shevy: first - grab a cold beer. that's always a good start
[18:53:52] DEA7TH_: has joined #ruby
[18:54:14] shevy: you'll be giving a talk?
[18:54:49] DEA7TH_: Is there any drawbacks to using a shell command (`mkfifo`) in my Ruby program, as opposed to a Ruby function? (I'm not concerned with portability)
[18:54:50] senayar: has joined #ruby
[18:54:50] senayar: has joined #ruby
[18:54:59] baweaver: submitting it to Keep Ruby Weird
[18:55:20] baweaver: DEA7TH_: cross system compatibility
[18:55:24] baweaver: Windows if it's a gem
[18:55:26] shevy: DEA7TH_ don't think there should be any drawbacks, after all that was a good use case for perl as well
[18:55:38] baweaver: that's about it honestly.
[18:55:40] m8: has joined #ruby
[18:55:43] shevy: let me find out how to do mkfifo in ruby
[18:55:52] DEA7TH_: shevy: it uses a gem :/
[18:56:12] shevy: oh damn I see
[18:56:19] shevy: require "mkfifo"; File.mkfifo('pipe_name')
[18:56:36] wasamasa: I bet that wouldn't work on windows anyways
[18:56:37] maasha: Generic computer science question: Is there a described standard way of dealing with parantheses when evaluating expressions?
[18:56:38] shevy: yeah in this case, using `` is simpler because you won't need an external gem; ideally though, that could become part of File
[18:56:41] shevy: or FileUtils
[18:56:50] wasamasa: maasha: use a stack
[18:57:13] DEA7TH_: even if I installed the gem, it still probably won't work on Windows
[18:57:21] maasha: I am going to write a parser for some pattern matching logic involving regex type operators and modifiers including logical operators.
[18:57:42] fantazo: has joined #ruby
[18:57:52] shevy: do you actually use windows? :)
[18:57:57] eGGshke: has joined #ruby
[18:58:06] jfarmer: has joined #ruby
[18:58:09] maasha: wasamasa: I was thinking of a clear system of reducing parans (or whatever it is called when you remove redundant parans)
[18:58:14] baweaver: on the talk, it's more of wondering if it's an interesting subject.
[18:58:25] baweaver: Clairvoyance is freaking ambitious to get made.
[18:58:30] shevy: baweaver add in some pictures of cats and beavers and it'll be alright
[18:58:42] krzkrz: has joined #ruby
[18:58:43] wasamasa: maasha: that should be a job for the optimizing part of a compiler
[18:58:43] shevy: matz did this as well during his talk
[18:58:47] shevy: he showed one duck that was typing
[18:58:51] wasamasa: maasha: not evaluation
[18:59:32] maasha: wasamasa: ok, so what rules does the compiler follow and is there an easy read on that topic?
[19:00:00] wasamasa: maasha: well...
[19:00:18] wasamasa: maasha: the problem is that the most famous compilers out there are monolithic blobs of magic
[19:00:55] wasamasa: maasha: anyhow, if you want an easy read, I was reading emacs internals after finding out about a matz talk regarding ruby implementation choices
[19:01:01] JoshL: has joined #ruby
[19:01:15] wasamasa: maasha: and was surprised how understandable the peephole optimization parts of its bytecode optimizer were
[19:01:34] maasha: wasamasa: I guess to. I am just beginning researching this. I am going to look at compiler compilers - like YACC - but maybe that will just kill you :o)
[19:01:48] wasamasa: maasha: which could work out for your task
[19:02:12] wasamasa: maasha: it's basically about looking at a sufficiently simple form of your instructions and transforming known forms of it into more performant ones
[19:02:36] wasamasa: maasha: like, (+ x 1) into (1+ x)
[19:02:38] jamesaxl: has joined #ruby
[19:04:49] Muhannad: has joined #ruby
[19:04:56] maasha: wasamasa: right. I kinda dig reverse polish notation since it eliminates parens. I fear there are several ways parens can be dealt with and you end up with monolithic blobs of evil.
[19:07:11] eam: I wish method parens functioned as precedence parens
[19:07:53] Muhannad: has joined #ruby
[19:08:25] eGGshke: has joined #ruby
[19:08:35] lkba: has joined #ruby
[19:08:37] Lucky_: has joined #ruby
[19:09:58] baweaver: >> def plus(*xs) xs.reduce(0, :+) end; (plus 1, 2, 3) # not quite lispy though
[19:10:00] ruboto: baweaver # => 6 (https://eval.in/392041)
[19:10:41] alex88: has joined #ruby
[19:10:50] Muhannad: has joined #ruby
[19:11:09] Scroff: has joined #ruby
[19:11:39] Musashi007: has joined #ruby
[19:12:03] sharpmachine: has joined #ruby
[19:13:57] Muhannad: has joined #ruby
[19:14:31] Scrofff: has joined #ruby
[19:14:54] jenksy: has joined #ruby
[19:15:23] platzhirsch: has joined #ruby
[19:16:10] m3_del: has joined #ruby
[19:17:47] micmus: has joined #ruby
[19:18:21] dseitz: has joined #ruby
[19:18:44] gambl0re: has joined #ruby
[19:19:42] towski_: has joined #ruby
[19:22:15] nateberkopec: has joined #ruby
[19:22:57] mrmargolis: has joined #ruby
[19:23:32] mwlang: has joined #ruby
[19:24:33] mwlang: I???m working on a phone reg expr to extract the digits of a (XXX)-XXX-XXXX input where I don???t care what separates the digits, but I want area code to be optional.
[19:24:45] mwlang: I have this so far: /(\d{3})?[^\d]+?(\d{3})[^\d]+?(\d{4})/
[19:25:23] mwlang: and it works for the full number but not for when area code is absent???I thought the ??????? specified the partial match as optionally appearing???
[19:25:24] dgutierrez1287: has joined #ruby
[19:26:25] s2013: has joined #ruby
[19:27:12] chouhoulis: has joined #ruby
[19:28:53] JeramyRR: has joined #ruby
[19:30:08] toretore: has joined #ruby
[19:30:09] mansel: has joined #ruby
[19:30:26] lala: has joined #ruby
[19:31:28] mwlang: wow, ultra quiet room today
[19:32:02] findaway: has joined #ruby
[19:32:06] MatthewsFace: has joined #ruby
[19:32:46] Pupeno: has joined #ruby
[19:33:39] shevy: mwlang it's too hot in europe :(
[19:34:09] mwlang: ah???meltdown
[19:34:18] shevy: it's almost 22:00, 10 pm that is I guess, and it's almost 29.0?C outside still; and my room isn't cooling down, it's getting hotter
[19:35:22] Axsuul: has joined #ruby
[19:35:42] chendry: has joined #ruby
[19:35:53] GitGud: has joined #ruby
[19:36:13] chendry: has left #ruby: ()
[19:36:16] jhass: mwlang: are you sure? that should work. make a rubular with some examples?
[19:36:22] bruno-: has joined #ruby
[19:36:27] casadei: has joined #ruby
[19:36:39] mwlang: sure???one sec.
[19:38:16] rawtext: has joined #ruby
[19:38:21] rawtext: has left #ruby: ()
[19:38:33] mleung: has joined #ruby
[19:42:15] mwlang: jhass: sorry for delay, had to redact the actual numbers since they came from real customer inputs. https://gist.github.com/mwlang/24714c0fa90a713af221
[19:42:33] platzhirsch: has joined #ruby
[19:42:47] dagda1: has joined #ruby
[19:43:12] mwlang: all the specs pass except the one without area code.
[19:43:29] _blizzy_: has joined #ruby
[19:44:49] mwlang: meh???just thought of another ??? nothing but numbers ???4045551234??? doesn???t pass that regexp
[19:45:09] k3asd`: has joined #ruby
[19:45:21] jhass: mwlang: http://rubular.com/r/BLplzA1B0F your examples pass, let's look at the logic (also note the slight cleanup by using \D)
[19:45:51] jhass: did you look at the spec failures? I bet you get output that starts with -
[19:45:58] hahuang65: has joined #ruby
[19:46:05] sharpmachine: has joined #ruby
[19:46:18] jhass: since an optional capture group still gets an empty capture
[19:46:36] jhass: >> "foo".match(/(b)?(foo)/).captures
[19:46:38] ruboto: jhass # => [nil, "foo"] (https://eval.in/392054)
[19:46:45] Joufflu_: has joined #ruby
[19:46:51] mwlang: the failures: got: nil
[19:47:32] jhass: you can also avoid doing the match twice, just check whether .match returned nil
[19:47:35] mwlang: jhass: but good to be aware of that situation???I can compact before joining to resolve that.
[19:49:12] mwlang: jhass: good catch on double match call.
[19:50:24] _blizzy_: has joined #ruby
[19:50:30] niemcu: has joined #ruby
[19:50:54] mwlang: hmmm???your regexp leads to same spec failures.
[19:51:10] s2013: has joined #ruby
[19:51:11] jhass: well yeah, I said it's equivalent, just nicer way to write it
[19:51:21] mwlang: Ah! missed that bit.
[19:52:16] mwlang: but in rubular it???s matching the one w/o area code.
[19:53:51] hahuang65: has joined #ruby
[19:54:28] shadoi: has joined #ruby
[19:54:35] jpfuentes2: has joined #ruby
[19:55:23] blackmesa: has joined #ruby
[19:56:09] jhass: oh, we're stupid
[19:56:20] jhass: the issue is that the \D+ / [^\d]]
[19:56:29] jgpawletko: has joined #ruby
[19:56:30] jhass: * ]+ needs to consume something
[19:56:49] jhass: in the rubular it consumes the newline beofre
[19:56:54] michael_mbp: has joined #ruby
[19:57:03] last_staff: has joined #ruby
[19:57:27] shevy: <jhass> oh, we're stupid
[19:57:50] jhass: not the first time I said it ;)
[19:58:52] jhass: mwlang: /(?:(\d{3})\D+?)?(\d{3})\D+?(\d{4})/, whether that's a good expression to match phone numbers... it matches your examples
[19:59:48] Akagi201: has joined #ruby
[20:00:01] mwlang: let me try???I was at: /((\d{3})\D*?){1,2}(\d{4})/ which almost worked, but the area code had the delimiter included.
[20:02:35] msnyon: has joined #ruby
[20:02:50] houhoulis: has joined #ruby
[20:03:02] mwlang: jhass: bam! There we go. one slight change to handle nothing but digits: /(?:(\d{3})\D*?)?(\d{3})\D*?(\d{4})/
[20:04:00] toretore: why don't you just do (\d{3})?\D*(\d{3})\D*(\d{4}) ?
[20:04:11] toretore: http://rubular.com/r/BLplzA1B0F
[20:04:49] Scroff: has joined #ruby
[20:04:58] jaroslav: what country phone numbers is this regex supposed to cover?
[20:05:10] mwlang: jhass: cleaned up gist: https://gist.github.com/mwlang/24714c0fa90a713af221
[20:05:22] mwlang: jaroslav: just the state of georgia.
[20:05:32] mwlang: hence the 404, 770, 678 area codes.
[20:05:52] toretore: you want to match one \d{3} followed by \d{4}, optionally preceded by \d{3}, and any or no non-digits in between
[20:06:16] tomphp: has joined #ruby
[20:06:58] mwlang: I just scanned 10 years of data and that spec covers all the exceptional cases encountered.
[20:07:05] adamski2600: has joined #ruby
[20:07:14] mwlang: mysql with regexp query support is nice. :-)
[20:07:35] jaroslav: I don't think the "?" after second \D* is needed
[20:07:41] jaroslav: \D* is enough
[20:07:45] msnyon: has joined #ruby
[20:08:14] jhass: mwlang: if you're going to for optional delimiters I'd go with toretore's regex and http://paste.mrzyx.de/plz64hib9
[20:09:36] acke: has joined #ruby
[20:10:48] mwlang: add one more example to the examples: 4045551234
[20:11:05] mwlang: I had to change \D+ to \D* since delimiters were optional.
[20:11:09] shevy: <mwlang> I just scanned 10 years of data
[20:11:13] shevy: are you working for the agency!
[20:11:25] phutchins1: has joined #ruby
[20:11:30] sargas: has joined #ruby
[20:12:31] niemcu: has joined #ruby
[20:12:36] Wolland: has joined #ruby
[20:12:50] Spami: has joined #ruby
[20:13:15] mwlang: shevy: :-)
[20:13:51] toretore: number.scan(/\d+/).join[0,9]
[20:13:55] zachk: has joined #ruby
[20:14:31] willharrison: has joined #ruby
[20:14:39] roolo: has joined #ruby
[20:15:41] mwlang: toretore: I started to do that, but I???m about to extend the cases to extensions and that whole bit were somebody keeps entering area code and trailing with ???or 678??? was nuts.
[20:16:06] mwlang: so I just decided I wanted a definite XXX? XXX XXXX pattern
[20:16:13] __butch__: has joined #ruby
[20:16:23] Scripore: has joined #ruby
[20:16:31] mwlang: or that it can be turned into such where the delimiters are optional.
[20:16:37] wmoxam: mwlang: use Phonie
[20:16:52] mwlang: phonie? phony phones?
[20:16:52] wmoxam: then just filter on the area code ;)
[20:16:54] m3_del: has joined #ruby
[20:16:56] jenrzzz: has joined #ruby
[20:17:17] wmoxam: https://github.com/wmoxam/phonie
[20:17:23] eggoez: has joined #ruby
[20:18:12] mwlang: wmoxam: hmmm???.that???s an idea.
[20:18:21] niemcu: has joined #ruby
[20:18:50] mwlang: only concern is performance needs to be fast since this is a data exchange server (sucking data from one pipeline and stuffing it into another)
[20:19:42] shadoi: has joined #ruby
[20:20:00] mwlang: not exactly pre-mature optimization here since they hired me specifically to fix performance issues as well as improve the sanity of the data going through the pipes.
[20:20:41] mwlang: if I handle 99% of the phone numbers and kick back the non-valid stuff, we???re solid.
[20:20:50] m3_del_: has joined #ruby
[20:21:27] Salehi: has left #ruby: ()
[20:21:54] mwlang: anyway, jhass and toretore, I have a solid solution and all specs passing. Thanks for nudging me over the bump.
[20:22:14] AlexRussia: has joined #ruby
[20:22:29] drewo: has joined #ruby
[20:22:36] matp: has joined #ruby
[20:23:18] mwlang: wmoxam: phonie???s nice. I know just the place I can use this gem (another client???s project)
[20:24:06] symm-: has joined #ruby
[20:24:39] wmoxam: mwlang: :D
[20:25:24] niemcu: has joined #ruby
[20:26:00] brain_shim: has joined #ruby
[20:30:30] niemcu: has joined #ruby
[20:30:46] lessless: has joined #ruby
[20:31:09] blackmesa: has joined #ruby
[20:32:03] millerti: has joined #ruby
[20:32:37] fgo: has joined #ruby
[20:32:41] findaway: has joined #ruby
[20:33:05] MatthewsFace: has joined #ruby
[20:33:29] balazs_: has joined #ruby
[20:33:52] Limix: has joined #ruby
[20:35:11] jaygen: has joined #ruby
[20:35:49] benlieb: has joined #ruby
[20:37:24] niemcu: has joined #ruby
[20:37:44] sharpmachine: has joined #ruby
[20:39:05] dik_dak: has joined #ruby
[20:39:12] sankaber: has joined #ruby
[20:42:27] niemcu: has joined #ruby
[20:44:49] JDiPierro: has joined #ruby
[20:45:56] nfk: has joined #ruby
[20:47:01] bf4: has joined #ruby
[20:48:19] niemcu: has joined #ruby
[20:49:12] gambl0re: has joined #ruby
[20:52:54] grey_beard: has joined #ruby
[20:53:13] Hanmac: has joined #ruby
[20:54:22] nyanz: has joined #ruby
[20:54:39] mandarinkin2: has joined #ruby
[20:54:43] niemcu: has joined #ruby
[20:58:00] chouhoulis: has joined #ruby
[20:58:18] nyanz: has left #ruby: ()
[21:00:01] kadoppe: has joined #ruby
[21:00:38] niemcu: has joined #ruby
[21:00:39] ytti: happy 4th of july US
[21:00:46] eggoez: has joined #ruby
[21:02:32] ytti: https://youtu.be/lZD4ezDbbu4
[21:05:28] mando: has joined #ruby
[21:05:38] niemcu: has joined #ruby
[21:05:54] langlands: has joined #ruby
[21:06:26] Lucky_: has joined #ruby
[21:09:54] idiocrash: has joined #ruby
[21:11:32] pen: has joined #ruby
[21:11:39] mandarinkin2: has joined #ruby
[21:12:45] niemcu: has joined #ruby
[21:14:10] bruno-: has joined #ruby
[21:14:42] dagda1: has joined #ruby
[21:14:46] adaedra: Where do you think you are, Windows?
[21:15:33] jhass: Ctrl+W is close window/tab, Ctrl+Q is close application
[21:15:44] adaedra: (Like under Windows)
[21:16:03] adaedra: Found the mac user
[21:16:10] _whitelogger: has joined #ruby
[21:16:15] jhass: well, on OS X it's Cmd instead of Ctrl so you can feel special, yeah
[21:16:16] toretore: i'm getting a pc
[21:16:37] drPoggs: has joined #ruby
[21:17:02] elektronaut: has joined #ruby
[21:17:04] adaedra: jhass: yeah, not like the platform that has a key named after the system. :p
[21:17:46] mwlang: What???s the proper way to handle a param passed in that may be an array of hashes or just a hash? Normally, when I know something can be either a single value or an array of values I just wrap with Array(some_param) and know I always have an array.
[21:18:10] mwlang: but when dealing with hashes, Array(some_hash) turns that entire hash into an array of tuples.
[21:18:10] jhass: mwlang: fix your API to always get an array
[21:18:21] jhass: or take a splat and don't accept an array
[21:18:28] mwlang: jhass: That???s what I???m doing
[21:18:29] jhass: have the caller splat it
[21:18:45] mwlang: jhass: it???s coming from the Nori gem.
[21:18:58] niemcu: has joined #ruby
[21:19:12] jhass: so that has inconsistent returns? *sigh*
[21:19:35] toretore: "i have a great idea! if only one result is found, i'll not return an array"
[21:19:39] toretore: said the idiot
[21:19:43] mwlang: nori basically gives me either a hash when an XML section appears only once, or an Array of hashes when a section repeats.
[21:19:57] jhass: [foo].flatten(1)
[21:20:03] jhass: there's sadly no nicer way
[21:20:14] Scripore: has joined #ruby
[21:20:19] toretore: v = [v] unless v.is_a?(Array)
[21:20:22] toretore: is what i do
[21:20:26] adaedra: a.is_a?(Array) ? a : [a]
[21:20:35] mwlang: jhass: that???s nice enough???At least I stop the perpetuation and always return an array. :-D
[21:21:21] adaedra: putting into an array and using flatten seems like a little much to me
[21:21:26] mwlang: I wonder which is more performant! I???ve done all three of the above, but just kinda sick of it, I suppose.
[21:21:39] jhass: well, the is_a? is certainly faster
[21:22:43] adaedra: you should also bug the library creator to fix his API and introduce consistency
[21:23:16] adaedra: we've already .count to know if an array contains only one element, no need to unwrap it
[21:24:29] mwlang: adaedra: I???m actually bordering on forking and doing it myself???it???s a part of the Savonrb project, but entire thing is riddled with inconsistencies.
[21:24:46] adaedra: nuke them then
[21:24:48] mwlang: and kinda un-ruby-like.
[21:25:23] toretore: make everything return streams
[21:25:55] niemcu: has joined #ruby
[21:26:17] mwlang: toretore: heh???speaking to that???I???m considering building something similar to Savon but SAX parsing with Ox and making it return PORO
[21:27:18] mwlang: I find that although a hash representation of a SOAP message is somewhat nice, I end up wanting Ruby classes anyway.
[21:27:49] adaedra: Yeah, I know some of these words.
[21:27:55] mwlang: so why not figure out how to go to that (and I don???t mean Nokogiri???s whole Node style approach)
[21:28:04] toretore: what's wrong with e.g. nokogiri?
[21:28:19] adaedra: it's not written by yorickpeterse.
[21:28:23] mwlang: toretore: nothing. It???s good at what it does.
[21:28:25] toretore: or do you mean represent soap messages and not xml?
[21:28:35] Musashi007: has joined #ruby
[21:28:53] zenspider: mwlang: you know another name for PORO? object
[21:28:58] mwlang: toretore: I want smart ruby classes that get their attributes automatically populated.
[21:29:18] mwlang: zenspider: Plain Ole Ruby Object?
[21:29:24] toretore: sounds reasonable; i don't know enough about soap to have an opinion
[21:29:38] jhass: toretore: feel lucky
[21:29:47] mwlang: zenspider: ah.
[21:29:50] zenspider: there's no real non-objects in ruby.
[21:29:51] toretore: as opposed to those fancy new ruby objects
[21:29:58] jhass: zenspider: fun fact. when they say PORO they usually mean a class
[21:30:41] mwlang: zenspider: true???just too used to distinguishing ???non Active Record??? models to others in conversation. (do we create an Active Model class or a PORO class for this?)
[21:30:43] zenspider: jhass: sad, isn't it?
[21:31:03] zenspider: active record objects are ALSO objects.
[21:31:18] mwlang: yeah, we all know that, right?
[21:31:31] zenspider: sometimes I'm not so sure
[21:31:46] niemcu: has joined #ruby
[21:31:47] toretore: poro is a term taken from java that doesn't make sense to say in ruby
[21:31:55] toretore: i think is the point
[21:32:01] mwlang: I guess I???m usually telling devs ???you don???t need all the bells and whistles of ActiveModel when a PORO will do"
[21:32:20] darix: I think AR objects are just PORO as well. calling them anything else would be discrimination.
[21:33:26] findaway: has joined #ruby
[21:33:45] zenspider: "The POJO phenomenon has most likely gained widespread acceptance because of the need for a common and easily understood term that contrasts with complicated object frameworks."
[21:33:49] Pupeno: has joined #ruby
[21:33:49] mwlang: well heck, I *am* discriminating in the conversations???but of course my use above should???ve just been ???object??? since AR wasn???t anywhere in sight other than in my project I???m not processing SOAP with ActiveRecord classes as the Rails 2.x version of the app I???m rewriting is.
[21:34:31] nettoweb: has joined #ruby
[21:34:31] zenspider: other than the fact that AR hides a lot of their state in the attributes hash instead of ivars, I can't really say that AR is a "complicated object framework" with "special restriction"s
[21:34:54] zenspider: SOAP. there's an acronym I don't miss. :P
[21:35:05] toretore: i think it's more interesting to contrast pure data with objects that encapsulate and have behavior
[21:35:32] darix: zenspider: everyone needs a little SOAP each day ;)
[21:35:42] zenspider: toretore: what's "pure data" ?
[21:35:49] mwlang: yeah, SOAP can be a royal pain.
[21:35:51] toretore: not objects
[21:35:54] slash_nick: i think of a poro as something that depends only on stdlib...
[21:35:55] zenspider: darix: that's different! It's 90 here right now
[21:36:00] toretore: as in !object
[21:36:05] zenspider: toretore: and where do you do that?
[21:36:19] JDiPierro: has joined #ruby
[21:36:37] slash_nick: if you implement your poro using a library that depends on stdlib alone, yeah... that flies
[21:36:57] zenspider: fun fact: everything in scheme is called an object
[21:36:59] darix: zenspider: so what? we will have 100-104 tomorrow and I will have a nice 10.5h train ride where i can only hope the AC holds
[21:37:03] mwlang: Well, I???m going back to my PORO reimplementation of a messy, cumbersome AR-oriented approach. :-D
[21:37:19] zenspider: "All objects created in the course of a Scheme computation, including procedures and continuations, have unlimited ex- tent."
[21:37:31] darix: mwlang: give us a call when you found out how much of AR you reimplemented in the process. ;)
[21:37:47] darix: or ActiveModel for that matter.
[21:37:48] zenspider: darix: yeah but I live in a place where this doesn't happen enough for ppl to buy AC
[21:37:54] zenspider: it SUCKS here right now
[21:38:23] mwlang: darix: heh???let???s just say the new solution is about a 70% reduction in code base since it???s actually domain model driven instead of tables in a database driven.
[21:38:27] zenspider: at least the desert (usually) gets cold at night.
[21:38:57] darix: mwlang: and you persist into what?
[21:39:08] darix: just curious
[21:39:55] darix: 22??C here now^^
[21:40:10] zenspider: I would love that
[21:41:18] baweaver: zenspider: SF is almost always between 55 and 75
[21:41:31] mwlang: darix: well, I???ll tie into the DB later, but at least it???ll be a very simple some_ar_model_instance.some_attribute = some_soap_model.some_attribute assignment straight down the entire method rather than a whole bunch if if/else/unless conditional. and I???ll probably do it with an iterator like ???some_ar_model_instance.attributes.keys.each ??????
[21:42:48] darix: so you actually just put in another layer :)
[21:42:51] mwlang: and not everything???s going into the db, either.
[21:42:58] mwlang: darix: yes, and on purpose.
[21:43:51] mwlang: I don???t need to write the same code to store addresses, phone numbers, people???s names over and over, yet the legacy database just has the same basic fields over and over.
[21:43:58] mwlang: and I don???t control the db.
[21:44:00] acke: has joined #ruby
[21:44:40] casadei: has joined #ruby
[21:45:47] tomphp: has joined #ruby
[21:46:28] JoshL: has joined #ruby
[21:47:30] silverdust: has joined #ruby
[21:47:30] alem0lars: has joined #ruby
[21:47:31] alem0lars: has joined #ruby
[21:47:39] Alayde: has joined #ruby
[21:48:09] mwlang: darix: another point is the SOAP classes are going to be used to push data from one stream to three separate databases which the schemas are different in each (it???s a data exchange service, after all)
[21:48:11] Akagi201: has joined #ruby
[21:48:24] zenspider: baweaver: but then I have two problems
[21:48:44] baweaver: no pleasing you is there? :P
[21:49:04] Alayde: has joined #ruby
[21:49:04] zenspider: I loooove seattle, 9-10 months of the year
[21:49:19] mwlang: zenspider: move a little further south of SF to SD and deal with 65 - 75 temps. :-)
[21:49:46] shevy: or move to canada 2 months per year, but the french speaking part
[21:50:05] zenspider: we were there for ... rubyconf? twice? not my people
[21:50:11] mwlang: zenspider: yup. just moved from Georgia ??? loving it so far.
[21:50:23] zenspider: mwlang: not a very high bar, is it? :P
[21:50:43] zenspider: shevy: I liked what little I've experienced of eastern canada
[21:50:56] mwlang: zenspider: heh???you referring to the rednecks or to the sweltering 100% humidity heat waves?
[21:51:07] zenspider: where was that? montreal or toronto ... sec
[21:51:19] renderful: has joined #ruby
[21:51:32] findaway: has joined #ruby
[21:51:32] zenspider: must have been montreal
[21:51:58] MatrixBridge: has joined #ruby
[21:52:47] blackmesa: has joined #ruby
[21:53:42] zenspider: mwlang: yes?
[21:56:15] adamski2600: has joined #ruby
[21:56:39] phutchins1: has joined #ruby
[21:58:45] senayar: has joined #ruby
[22:01:26] decoponio: has joined #ruby
[22:01:47] Joufflu: has joined #ruby
[22:02:40] havenwood: has joined #ruby
[22:02:52] alextheman: has joined #ruby
[22:03:27] alextheman: has left #ruby: ()
[22:03:40] Musashi007: has joined #ruby
[22:03:48] nofxx: just tryed working with objective C... I'm already depressed. Out of a handful of langs I've played I don't know any other so obfuscated.
[22:03:51] DLSteve: has joined #ruby
[22:04:04] workmad3: has joined #ruby
[22:04:33] nofxx: jobs always bragged about who cares about soft makes he's own hardware... that's because he never coded for real
[22:04:41] shevy: didn't swift promise to make things better?
[22:05:41] nofxx: shevy, nah... don't care about either. It's like 2 lines change, did in 10minutes in java which I never code, going to ask a ios friend ;)
[22:06:01] nofxx: ah, it's a phonegap plugin.. hence the objc/java thing...
[22:06:35] Alayde: has joined #ruby
[22:06:49] nofxx: he would say: makes he's own DECENT language
[22:07:17] benlieb: has joined #ruby
[22:08:30] tomphp: has joined #ruby
[22:08:49] nofxx: shevy, check out: `value = 1.0` objc version: NSNumber* value = [[NSNumber alloc] initWithFloat:1.0];
[22:09:03] Nahra: has joined #ruby
[22:09:08] shevy: I can see lisp in the [] !
[22:09:17] NiVanc: has joined #ruby
[22:09:17] nofxx: shevy, yeah... () looks better ;)
[22:09:39] shevy: could they transition into a ruby-like syntax, while retaining the speed of objc?
[22:10:05] nofxx: shevy, if you're coding only ios/osx there's that macruby thing, it's pretty neat
[22:10:41] ljarvis: Swift is awesome..
[22:10:48] nofxx: someone was telling about it here the other day, can't remember now
[22:10:55] ljarvis: RubyMotion
[22:11:01] ljarvis: is what you're talking about
[22:11:10] jhass: has joined #ruby
[22:11:38] nofxx: android too
[22:13:28] thbar: has joined #ruby
[22:14:48] Alayde: has joined #ruby
[22:14:49] allomov: has joined #ruby
[22:14:58] zenspider: shevy: except that it is [noun verb] like god intended
[22:17:29] seanstickle: has joined #ruby
[22:17:58] adaedra: nofxx: I thought macruby was dead
[22:19:29] nofxx: adaedra, I meant rubymotion. the 'from macruby thing'
[22:19:36] havenwood: adaedra: It lives on through it's progeny, RubyMotion.
[22:19:38] adaedra: also, obj-c is made to try to keep language in the syntax. Parameters are all named, so you know which one is what, which can be ambigous otherwise.
[22:19:41] bruno-: has joined #ruby
[22:19:59] adaedra: Also, NSNumber* value = [[NSNumber alloc] initWithFloat:1.0] is not float value = 1.0
[22:20:27] MatthewsFace: has joined #ruby
[22:21:10] zenspider: <comic-book-guy-voice>Technically...</comic-book-guy-voice>
[22:21:40] nateberkopec: has joined #ruby
[22:21:41] shevy: you can relate to the comic book guy I can see ;)
[22:21:59] shevy: He had a lot of domain-specific knowledge
[22:23:01] bf4: has joined #ruby
[22:24:32] ellisTAA: has joined #ruby
[22:26:32] workmad3: has joined #ruby
[22:28:35] ixti: has joined #ruby
[22:28:43] Gnea: I'm having troubles installing the gem 'json' of a particular version (1.7.7) that's required for a specific application. It fails with the following errors: https://gist.github.com/anonymous/a9960dd457046d2b50c3 which I can fix manually, but if I try to re-run the installation, it pulls in fresh json code and overwrites the fix. How can I reliably fix the code and still obtain a compiled & installed gem?
[22:29:11] djbkd: has joined #ruby
[22:29:23] blackmesa: has joined #ruby
[22:30:13] havenwood: Gnea: JSON is in the stdlib in modern Ruby.
[22:30:22] havenwood: Gnea: http://ruby-doc.org/stdlib/libdoc/json/rdoc/JSON.html
[22:30:52] Gnea: havenwood: the application, snorby, requires version 1.7.7, not the currect version.
[22:30:57] havenwood: Gnea: Is this an app written for Ruby 1.8?
[22:31:20] crdpink: should core/stdlib documentation spelling and grammar errors be submitted to bugs.ruby-lang.org or as git pull requests?
[22:31:40] ljarvis: crdpink: either, the former has been more responsive imo
[22:31:50] Gnea: havenwood: no, 1.9
[22:31:59] Gnea: havenwood: (or newer)
[22:32:00] havenwood: crdpink: http://documenting-ruby.org/
[22:32:00] crdpink: ljarvis: thanks!
[22:32:03] ljarvis: crdpink: but, just ping zzak
[22:32:10] ljarvis: he's a cool bro
[22:32:39] m3_del: has joined #ruby
[22:32:41] ljarvis: speaking of which
[22:33:07] zenspider: Gnea: 1.7.7 - February 11, 2013 java (85.5 KB) -- that's a while back...
[22:33:09] crdpink: that link looks like it has all the info, cheers
[22:33:42] zenspider: tho this is headius and flori... so I'd suspect it is pretty solid
[22:33:50] fgo: has joined #ruby
[22:34:14] Gnea: zenspider: I'm still pretty new to ruby, so learning as I go
[22:34:39] Akagi201: has joined #ruby
[22:34:43] zenspider: rb_str_new has always taken 2 args tho
[22:34:50] darix: zenspider: sadly i saw some apps not long ago where the gemfile still requested 1.7.7:|
[22:35:02] zenspider: that error looks really suspect.
[22:35:06] balazs: has joined #ruby
[22:35:32] darix: Gnea: you can try removing the version restriction for json
[22:35:36] zenspider: unless FBUFFER_PAIR is suppposed to macroize into 2 args
[22:35:37] darix: it will probably work
[22:35:40] zenspider: I don't see that code ever working
[22:36:24] zenspider: ok: #define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb)
[22:36:56] zenspider: Gnea: this means something is stupid about your compiler
[22:37:04] yxhuvud: <3 recursive macros
[22:37:48] zenspider: ../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
[22:37:48] zenspider: VALUE result = rb_str_new(FBUFFER_PAIR(fb));
[22:37:52] zenspider: that's just wrong afaict
[22:38:03] yxhuvud: macros to another macro. they are not self-recursive
[22:38:10] darix: also snorby on a rasperry pi or so
[22:38:14] darix: that will go well ;)
[22:38:21] zenspider: you keep using that word. I don't think it means what you think it means
[22:38:27] Indian: has joined #ruby
[22:39:22] zenspider: if it did, all methods that did _anything_ would be recursive in your mind.
[22:39:31] ellisTAA: are sessions a form of chaching?
[22:39:48] darix: EllisTAA: you can abuse them as a cache
[22:39:56] darix: but generally speaking no
[22:39:59] ellisTAA: darix: thank you
[22:40:12] Gnea: zenspider: I agree, so when I found and implemented the fix, I was able to get generator.o to appear, but that was just one component, and the overall system wants fresh code already in place.
[22:40:32] darix: Gnea: your ruby 2.2 already comes with json
[22:40:38] Gnea: darix: but I'm back to square one.
[22:40:41] darix: you just need to allow it to use that version
[22:40:49] guideX: has joined #ruby
[22:41:00] darix: could even comment out the json line in the gemfile
[22:41:23] Gnea: I can edit the Gmakefile easily, but I don't know what command it's running since I'm just running "bundle install" overall
[22:41:38] zenspider: Gnea: you don't fix a broken complier by futzing with the source of its target
[22:41:41] Gnea: sorry, Gemfile
[22:41:43] zenspider: compiler, even.
[22:41:43] darix: that file is read by bundle install
[22:41:56] Gnea: zenspider: yes, but the compiler isn't the problem
[22:42:04] Papierkorb: has joined #ruby
[22:42:07] Gnea: it doesn't matter
[22:42:14] dopie: has joined #ruby
[22:42:33] darix: https://github.com/Snorby/snorby/blob/master/Gemfile not touched since 2013
[22:42:43] Gnea: I get that
[22:42:50] guideX: has left #ruby: ()
[22:42:55] zenspider: it does matter. this isn't going to be the only problem you have. if it can't even preprocess a C file correctly and then compile it, you're going to be in a world of hurt
[22:43:06] darix: missing tons of security fixes
[22:43:17] darix: e.g. for rails
[22:43:22] Gnea: ACTION sighs
[22:43:30] darix: good thing that isnt a security related project!
[22:43:43] Gnea: ACTION drops a pin into an ocean
[22:43:52] zenspider: sigh all you want, but that isn't the only C dependency you're going to have with a gemfile that big
[22:44:30] Gnea: well it's gcc 5.1.0
[22:44:40] Gnea: I don't know why that makes a difference
[22:44:47] Musashi007: has joined #ruby
[22:44:50] darix: Gnea: it is a big step for the gcc project
[22:45:08] darix: from the distros point of view i can tell you we had to fix a lot of things for gcc 5
[22:45:10] Gnea: look, you're talking about apples and oranges that I can even see
[22:45:30] darix: Gnea: given the snorby website is down
[22:45:37] Gnea: and that's great, fixes are appreciated
[22:45:45] darix: one could argue the project is deadish
[22:45:47] Gnea: as is the amount of time put into them
[22:46:44] darix: Gnea: maybe hop into the snorby channel (same network) and ask them if they plan to update the dependencies in the gemfile to include security fixes
[22:47:07] darix: also ruby 2.2 needed some fixes in gems to work properly
[22:47:09] zenspider: still won't matter if you can't compile fairly straightforward c files correctly.
[22:47:10] Gnea: I don't think it's entirely dead, there was an update 2 days ago
[22:47:11] darix: json might be one of them
[22:48:07] darix: Gnea: a project which still pulls library versions from 2013
[22:48:25] Gnea: darix: I can surely ask that, it's not as dead as #sagan is
[22:48:32] pgatt: has joined #ruby
[22:48:32] zenspider: the FBUFFER_PAIR code is exactly the same as before in the latest version of json
[22:48:55] Gnea: zenspider: so how was the issue addressed?
[22:49:30] zenspider: you're REALLY not listening
[22:50:48] Gnea: oh I'm sorry, I didn't realize that it was against the rules to ask questions.
[22:51:54] Gnea: zenspider: perhaps you have a link to some documentation that I could read regarding the compiler fix?
[22:53:49] bf4: has joined #ruby
[22:56:07] willharrison: has joined #ruby
[22:56:19] AhabsBeard: has joined #ruby
[22:57:24] kb3ien: has joined #ruby
[22:58:45] chouhoulis: has joined #ruby
[22:59:27] Gnea: zenspider: I am sorry, this is very frustrating. I will try again later.
[22:59:43] kb3ien: I've had to make changes to a ruby gem, to add functionality that was missing in the original. I'd like to include the modified gem in the /vendors dir of my project, to keep my SVN copy more meaningful and because editing files that may be updated by bundler seems like the WRONG way to admin this project.
[23:00:14] Coraline: It would be better to wrap the gem than to work with a modified version of it.
[23:00:26] Coraline: You won't get any updates the way you're doing it.
[23:00:58] MatthewsFace: has joined #ruby
[23:01:38] sharpmachine: has joined #ruby
[23:03:15] zotherstupidguy: has joined #ruby
[23:03:59] kb3ien: Okay. So I modified one file in the gem, basically forcing HTTPS connects to use a caching proxy server using HTTP. The gem contains multiple files, but I only changed one. What specifically do you suggest I read first?
[23:05:06] danielpclark: has joined #ruby
[23:05:15] cnngimenez: has joined #ruby
[23:07:07] zenspider: kb3ien: consider sending the original a PR with your change?
[23:07:15] zenspider: that way everyone benefits
[23:07:57] wallerdev2: has joined #ruby
[23:08:01] kb3ien: I'm not sure if I want updates, until I know that the code is changed to allow HTTPS to be initiated by the proxy, not the ruby code.
[23:08:11] kb3ien: I'm trying. These things take time.
[23:08:59] Channel6: has joined #ruby
[23:09:11] ramfjord: has joined #ruby
[23:09:21] findaway: has joined #ruby
[23:09:29] kb3ien: What's the best way to move it to vendor, even if I fall off the upgrade train.
[23:11:10] JDiPierro: has joined #ruby
[23:11:43] kb3ien: there is a repo, but it is SVN, not git, so git-centric concerns need not apply.
[23:11:48] zenspider: kb3ien: if you're using bundler, you can fork the project, put your change in there, and then point your gemfile at your repo/branch
[23:12:09] baweaver: has joined #ruby
[23:12:40] zenspider: what repo _your_ project is in shouldn't matter in this case
[23:13:04] kb3ien: i'm using bundler to install gems (projectBlacklight). I'd like to use the gemfile to spec a local copy, but I've not had any sucess.
[23:13:54] newbie: has joined #ruby
[23:14:08] kb3ien: gem 'gemname', :path "" seems to the solution. Never got it to work.
[23:14:24] roolo_: has joined #ruby
[23:16:34] stoodfarback: has joined #ruby
[23:17:08] gregf: has joined #ruby
[23:17:18] iamninja: has joined #ruby
[23:17:24] jhass: gem 'bar', path: "~/foo/bar" or gem 'bar', :path => "~/foo/bar"
[23:17:33] kb3ien: The original gem downloads to '/usr/local/lib/ruby/gems/2.0.0/gems/ebsco-discovery-service-api-1.0.4' which contains only one file 'lib/ebsco-discovery-service-api.rb'
[23:18:35] djbkd: has joined #ruby
[23:19:29] claptor: has joined #ruby
[23:20:27] redlegion: has joined #ruby
[23:20:56] kb3ien: should the path be '/usr/local/lib/ruby/gems/2.0.0/gems/' ?
[23:21:19] kb3ien: or the equivilent depth in /var/www/site...
[23:22:11] kb3ien: okay. assuming /var/www/site/path/vendor/vendor/bundle/ruby/2.1.0/gems/ebsco-discovery-service-api-1.0.4/lib/ebsco-discovery-service-api.rb what should 'path' point to ?
[23:23:50] Scripore: has joined #ruby
[23:25:29] kb3ien: Or am I missing something?
[23:25:35] jhass: well, since it's apparently not on that guys github, we'll have to reconstruct a bit
[23:25:45] jhass: start with gem unpack ebsco-discovery-service-api
[23:26:56] jhass: to the resulting ebsco-discovery-service-api-1.0.4 directory, add a copy of /var/www/site/path/vendor/vendor/bundle/ruby/2.1.0/specifications/ebsco-discovery-service-api-1.0.4.gemspec
[23:27:06] jhass: try pointing path: at that directory then
[23:27:43] solocshaw: has joined #ruby
[23:27:48] yorickpeterse: 01:30: finally cooling down
[23:28:02] jhass: 26??C indoors here
[23:28:36] yorickpeterse: it's 25C-ish here
[23:28:44] pen: has joined #ruby
[23:28:47] eggoez: has joined #ruby
[23:28:56] kb3ien: I'm not looking at my temp. I'd rather NOT KNOW. Its been up to 30 here ( Southern .ny.us )
[23:29:06] yorickpeterse: 23,1C at 80% humidity :<
[23:29:55] kb3ien: where do i run 'gem unpack' ?
[23:30:03] jhass: somewhere convenient
[23:30:11] kb3ien: okay. /tmp it is.
[23:30:31] jhass: well, you want it to persist since you want to point path: to the result after adding the gemspec
[23:30:32] rvchangue: has joined #ruby
[23:30:47] idiocrash: has joined #ruby
[23:30:51] ubuntu_: has left #ruby: ()
[23:31:32] jenrzzz: has joined #ruby
[23:31:46] marcoamorales: has joined #ruby
[23:31:52] daas: has joined #ruby
[23:32:02] mwlang: why did TextMate go open source? (finally getting around to trying out TM2 today)
[23:32:21] 1JTAAGLFW: has joined #ruby
[23:32:21] 5EXABLYGN: has joined #ruby
[23:32:48] jhass: ?ot mwlang
[23:32:48] drPoggs: has joined #ruby
[23:32:49] ruboto: mwlang, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[23:32:49] manveru: has joined #ruby
[23:32:57] idiocrash: has joined #ruby
[23:33:23] artmann: has joined #ruby
[23:33:36] kalleth: has joined #ruby
[23:34:04] mwlang: didn???t even know that channel existed!
[23:34:33] Pupeno: has joined #ruby
[23:34:36] fgo: has joined #ruby
[23:34:42] phrozen77: has joined #ruby
[23:34:50] yorickpeterse: mwlang: tl;dr because IIRC the author couldn't maintain/support it
[23:35:58] daas: would you guys mind looking at a simple function https://gist.github.com/anonymous/2eabc4b47d514decc10a
[23:36:07] ruboto: we're not all guys - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[23:36:31] daas: would y'all folks mind looking at a simple function https://gist.github.com/anonymous/2eabc4b47d514decc10a
[23:36:38] nofxx: daas, first... it should be named 'def even?'
[23:36:46] yorickpeterse: jhass: honestly at this point you might just want to set up an auto response
[23:36:47] findaway: has joined #ruby
[23:36:55] nofxx: daas, we are kinda against camel case
[23:37:00] kb3ien: guys is gender neutral in many dialects of US English. In UK English, my name isn't 'Guy'.
[23:37:05] daas: oh yeah just a habit lol
[23:37:15] kb3ien: ERROR: Gem 'ebsco-discovery-service-api-1.0.4' not installed nor fetchable.
[23:37:24] jhass: yorickpeterse: honestly, I'd forget that I did when apeiros finally deploys the bot :P
[23:37:31] nofxx: daas, here how it works... num in the case is a integer you mean right?
[23:37:46] al2o3-cr: don't meant (doesn't make sense)
[23:37:49] mwlang: yorickpeterse: he built it too good!
[23:37:52] jhass: >> 2.even?
[23:37:52] nofxx: daas, it's class in ruby is 'Fixnum' , you just open fixnum and add your method
[23:37:54] ruboto: jhass # => true (https://eval.in/392098)
[23:38:00] jhass: ^ just pointing out
[23:38:13] jhass: so we'll need my_even? or something
[23:38:17] zack6849: has joined #ruby
[23:38:17] zack6849: has joined #ruby
[23:38:24] pawz: has joined #ruby
[23:38:27] Mon_Ouie: And if you're going to define it in some class, you should define it in Integer, not Fixnum
[23:38:37] daas: oh Ruby already has an even function for Integers lol
[23:38:50] daas: but yeah I was just trying to figure out how to extend one of Ruby's existing class with methods, thanks
[23:39:20] nofxx: daas, that's what I imagined
[23:39:28] nofxx: Mon_Ouie, yeah, thanks...
[23:39:29] Mon_Ouie: >> class Integer; def hi; puts "I'm #{self}"; end; end; 3.hi
[23:39:30] ruboto: Mon_Ouie # => I'm 3 ...check link for more (https://eval.in/392099)
[23:41:09] nofxx: Mon_Ouie, a nice trick, end doesn't need line ending:
[23:41:11] kb3ien: jhass did that command work for you ?
[23:41:13] nofxx: >> class Integer; def hi; puts "I'm #{self}" end end; 3.hi
[23:41:14] ruboto: nofxx # => I'm 3 ...check link for more (https://eval.in/392100)
[23:41:46] nofxx: totally forgot the name of ';' hehe.... going to eat. til soon
[23:41:53] jhass: kb3ien: yeah
[23:42:08] jhass: kb3ien: does gem fetch ebsco-discovery-service-api work?
[23:42:44] nobitanobi: has joined #ruby
[23:43:42] Tarkers34: Okay guys, now I'm learning about blocks and I've got a bit of a headscratcher. When you put put statements inside a block, why aren't those put statements outputted to the console when yield is called inside the method? Here is an example of what I mean https://gist.github.com/anonymous/18ab198308a7dfdf4668 See? I would expect us to get 'nil' reported to the console every time yield is called...
[23:44:09] ruboto: we're not all guys - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[23:44:12] Tarkers34: is console output surpressed inside the method or is something cleverer going on?
[23:44:30] kb3ien: sorry i used the version number too.
[23:44:35] kb3ien: both work.
[23:44:56] adamski2600: has joined #ruby
[23:45:21] ellisTAA: has joined #ruby
[23:45:40] Tarkers34: * okay guys, girls, transexuals, aliens w/e it takes to make the PC police stop :'(
[23:45:47] MatrixBridge: has joined #ruby
[23:45:54] zenspider: Tarkers34: you exp... nevermind
[23:46:53] Tarkers34: zenspider ??
[23:47:12] zenspider: cut out the jackassery and we'll talk
[23:47:41] Tarkers34: okay, go on
[23:47:45] Tarkers34: if you would
[23:48:20] Musashi007: has joined #ruby
[23:48:25] kb3ien: jhass done, it deposited only one file again. /tmp/ebsco-discovery-service-api-1.0.4/lib/ebsco-discovery-service-api.rb
[23:48:58] jhass: kb3ien: yep, do you remember the second step I wrote?
[23:49:53] willharrison: has joined #ruby
[23:49:55] michael_mbp: has joined #ruby
[23:50:24] Lucky_: has joined #ruby
[23:50:41] kb3ien: found it. done.
[23:51:23] jhass: Tarkers34: I'm not sure why you expect the nil's
[23:51:53] rickmasta: has joined #ruby
[23:52:53] drew0: has joined #ruby
[23:52:58] kb3ien: Should I be able to use path to point to that dir, now ?
[23:53:49] jhass: Tarkers34: and each_with_index returns the receiver, it's not .map_with_index
[23:53:57] jhass: kb3ien: yeah
[23:54:00] zenspider: kb3ien: ruby -I<path/to/lib> or modify the pathing in your code
[23:54:04] zenspider: (before require)
[23:54:58] Tarkers34: jhass Not necessarily nils...just some sort of error. I mean I don't actually expect it from a ruby native method but you see what I mean? We're executing puts 'index ' + i.inspect What is 'i'? in the context of the method? nil, right? Or, if it's not nil, it's the index. So it would be executed twice. If you were to create an interaor from scratch you'd see what I mean :P
[23:55:01] chipotle: has joined #ruby
[23:55:10] JDiPierro: has joined #ruby
[23:55:33] Tarkers34: *so it would be printed twice **iterator
[23:56:07] kkeuning: has joined #ruby
[23:56:14] jhass: Tarkers34: no, I don't see what you mean. each_with_index is basically def each_with_index; i = 0; each do |e| yield e, i; i += 1; end; self; end;
[23:56:19] jhass: just implemented in C
[23:57:19] zenspider: executed twice? why?
[23:57:21] arooni-mobile: has joined #ruby
[23:57:34] toretore: anyone happen to know where to find the "concurrent" gem source? i remember seeing it on github before
[23:57:50] Tarkers34: zenspider printed twice. ill make a gist
[23:57:59] toretore: (not "concurrent-ruby")
[23:58:15] zenspider: hey, that's one of our gems!
[23:58:20] zenspider: mentalguy wrote that
[23:58:38] toretore: yeah, that's the one
[23:58:41] jhass: toretore: use the github search, either for repo name or the gemspec
[23:59:17] toretore: oh it's mental/concurrent
[23:59:18] zenspider: https://github.com/mental/concurrent
[23:59:26] toretore: i tried mentalguy
[23:59:28] zenspider: and http://moonbase.rydia.net/mental/blog/programming/concurrency-five-ways.html
[23:59:52] kb3ien: sookay. Sound whre would the path point (the files are now in : /var/www/site/path/vendor/bundle/ruby/2.1.0/gems/ebsco-discovery-service-api-1.0.4/ebsco-discovery-service-api-1.0.4.gemspec and /var/www/site/path/vendor/bundle/ruby/2.1.0/gems/ebsco-discovery-service-api-1.0.4/lib/ebsco-discovery-service-api.rb ) ?