« Back to channel list

#ruby - 31 March 2016

« Back 1 day Forward 1 day »
[00:00:44] riceandbeans: like config_option = true, config_option.value = 'foo' ?
[00:00:57] apeiros: like show_foo_part = true/false
[00:01:40] smathy: riceandbeans, the former.
[00:01:49] apeiros: alternatively what baweaver showed - set it to nil if it should not be shown, to any non-nil/false value which you can use in the content part too if it should be shown.
[00:02:00] smathy: riceandbeans, then just `if your_var`
[00:02:08] uglybandersnatch: has joined #ruby
[00:02:34] riceandbeans: ok, I can accept that
[00:02:44] riceandbeans: nil vs non nil
[00:02:46] riceandbeans: simple enough
[00:03:13] riceandbeans: >> v = -1; v.nil?
[00:03:14] ruby[bot]: riceandbeans: # => false (https://eval.in/545288)
[00:03:25] riceandbeans: >> v = 0; v.nil?
[00:03:26] ruby[bot]: riceandbeans: # => false (https://eval.in/545289)
[00:03:39] LoneHermit: has joined #ruby
[00:03:39] riceandbeans: >> v = ''; v.nil?
[00:03:40] ruby[bot]: riceandbeans: # => false (https://eval.in/545290)
[00:03:47] apeiros: ?experiment riceandbeans
[00:03:48] ruby[bot]: riceandbeans: Please use your local irb or pry (see ?pry) to experiment, ruboto's eval functionality is for demonstration purposes only.
[00:03:51] riceandbeans: ...ok...I think I'll be good then, just worried about edge cases
[00:04:05] Ox0dea: First day with Ruby, eh?
[00:04:13] apeiros: and - surprise - only nil.nil? is true. and only nil/false won't branch into `if foo`
[00:04:22] smathy: riceandbeans, I wouldn't use .nil? - just test the var. false.nil? is false, and the last thing you want is for `show_stuff = false` to SHOW the view.
[00:05:08] riceandbeans: it doesn't help that it's for a giant config file so spotting an error is a needle in a hay stack
[00:05:14] riceandbeans: I need to get it right
[00:05:20] apeiros: even worse if you use implicit meaning
[00:05:29] apeiros: like whether the variable exists or not…
[00:06:23] rkazak: has joined #ruby
[00:06:34] benlieb: has joined #ruby
[00:06:48] wilbert: has joined #ruby
[00:07:37] rbennacer: has joined #ruby
[00:08:26] hiyosi: has joined #ruby
[00:08:28] frozen3: has joined #ruby
[00:08:39] Ropeney: has joined #ruby
[00:10:26] tubuliferous_: has joined #ruby
[00:10:36] Rutix: has joined #ruby
[00:10:36] Rutix: has joined #ruby
[00:10:55] jackjackdripper: has joined #ruby
[00:11:32] Vile`: has joined #ruby
[00:15:14] edwinvdgraaf: has joined #ruby
[00:16:30] kies: has joined #ruby
[00:18:24] radens: has joined #ruby
[00:18:29] radens: has left #ruby: ("WeeChat 1.3")
[00:19:06] jackjackdripper: has joined #ruby
[00:19:45] ruby-lang326: has joined #ruby
[00:20:01] babblebre: has joined #ruby
[00:20:02] mistermo_: has joined #ruby
[00:21:18] ruby-lang326: I am creating a poker simulator with Ruby and it contains a module Ranking that checks an array of Cards and determines what combination you might have.
[00:21:48] ruby-lang326: My question is a module the right approach? I was wondering if I should make that a class instead. Also I am not sure how to start with testing a module.
[00:21:56] abyx: has joined #ruby
[00:22:25] RickHull: modules are the easiest to test
[00:22:28] RickHull: i start with them first
[00:22:45] RickHull: module methods (at the class layer) have no private state
[00:22:58] RickHull: so output generally just depends on input
[00:23:04] RickHull: aka "static" methods
[00:23:08] Ox0dea: ruby-lang326: Why not a #value method on a Hand class?
[00:23:44] RickHull: generally you can only go so far with a bare module, and you want to add state. then just call it a class, def initialize, and figure out what you need for private state
[00:24:41] ramfjord: has joined #ruby
[00:25:27] jenrzzz: has joined #ruby
[00:28:43] jdawgaz: has joined #ruby
[00:29:23] dtzuzu: has joined #ruby
[00:32:38] Rubie: has joined #ruby
[00:38:44] ekinmur: has joined #ruby
[00:40:07] skade: has joined #ruby
[00:40:43] ramfjord: has joined #ruby
[00:47:59] solocshaw1: has joined #ruby
[00:50:56] Maletor: has joined #ruby
[00:51:17] bkxd: has joined #ruby
[00:52:21] sarbs: has joined #ruby
[00:53:07] shazaum_: has joined #ruby
[00:53:28] jdawgaz: has joined #ruby
[00:56:39] C0deMaver1ck: has joined #ruby
[00:57:53] skade: has joined #ruby
[00:58:51] AustinMatherne: has joined #ruby
[01:04:01] stunder: has joined #ruby
[01:04:20] FooMunki: has joined #ruby
[01:05:34] rolha_: has joined #ruby
[01:07:01] lyoshajapan: has joined #ruby
[01:08:08] frozen3: has joined #ruby
[01:08:33] goglosh: has joined #ruby
[01:09:13] itaipu: has joined #ruby
[01:09:37] ur5us: has joined #ruby
[01:10:48] goglosh: what was the name that replaced Config::CONFIG?
[01:11:14] goglosh: oh yes RbConfig
[01:12:55] blackgoat: has joined #ruby
[01:13:11] freerobby: has joined #ruby
[01:14:51] darix: goglosh: that's like *years* ago :p
[01:15:12] goglosh: yeah but I'm reading a book that says "look into Config::CONFIG"
[01:15:27] goglosh: maybe I should read something more modern? :9
[01:16:15] darix: goglosh: what book are you reading? maybe there is an updated version of it
[01:16:42] goglosh: the well grounded rubyist
[01:16:55] havenwood: goglosh: the second edition covers Ruby 2
[01:18:44] goglosh: lemme find it
[01:19:42] hotpancakes: has joined #ruby
[01:22:12] cpup: has joined #ruby
[01:22:20] darix: goglosh: www.amazon.com :p
[01:23:38] goglosh: yeah, moni is not my strong point :`
[01:23:53] jdawgaz: has joined #ruby
[01:24:16] minimalism: has joined #ruby
[01:27:44] blackgoat: has joined #ruby
[01:36:40] andywojo: has joined #ruby
[01:36:48] djbkd: has joined #ruby
[01:38:45] bronson: has joined #ruby
[01:41:12] wilbert: has joined #ruby
[01:41:56] arescorpio: has joined #ruby
[01:43:26] ur5us: has joined #ruby
[01:44:18] sorbo_: has joined #ruby
[01:46:01] Aviio: has joined #ruby
[01:49:11] Aswebb_: has joined #ruby
[01:51:55] leon_e: has joined #ruby
[01:52:12] sarbs: has joined #ruby
[01:53:13] sudoubuntu: has joined #ruby
[01:53:48] moeabdol: has joined #ruby
[01:54:05] leon_e: has joined #ruby
[01:54:55] benlovell: has joined #ruby
[01:58:02] Xeago: has joined #ruby
[02:02:04] emmanuel_erc: has joined #ruby
[02:02:08] emmanuel_erc: has left #ruby: ("ERC (IRC client for Emacs 24.5.1)")
[02:02:41] Rubie: has joined #ruby
[02:04:46] ur5us: has joined #ruby
[02:05:07] bedouin_: has joined #ruby
[02:07:04] bkxd: has joined #ruby
[02:07:20] Maletor: has joined #ruby
[02:07:29] sarbs: has joined #ruby
[02:11:39] jackjackdripper: has joined #ruby
[02:13:36] mistermocha: has joined #ruby
[02:14:19] mistermocha: has joined #ruby
[02:17:12] frozen3: has joined #ruby
[02:19:53] sarbs: has joined #ruby
[02:21:27] abyx: has joined #ruby
[02:21:32] jdawgaz: has joined #ruby
[02:22:24] stantona: has joined #ruby
[02:24:18] jdawgaz: has joined #ruby
[02:26:12] rmulliga`: has joined #ruby
[02:27:18] IrishGringo: has joined #ruby
[02:27:27] jtoy: has joined #ruby
[02:27:52] G: has joined #ruby
[02:30:07] kies: has joined #ruby
[02:30:53] diegoaguilar: has joined #ruby
[02:32:48] Rixius: has joined #ruby
[02:33:44] bronson: has joined #ruby
[02:34:34] moeabdol1: has joined #ruby
[02:37:02] mistermocha: has joined #ruby
[02:37:08] ur5us: has joined #ruby
[02:37:12] yfeldblum: has joined #ruby
[02:37:35] jdawgaz: has joined #ruby
[02:38:23] sorbo_: has joined #ruby
[02:41:43] sudoubuntu: has joined #ruby
[02:42:17] jdawgaz: has joined #ruby
[02:42:17] sp4rrow: has joined #ruby
[02:45:49] mostlybadfly: has joined #ruby
[02:48:04] chagel: has joined #ruby
[02:48:12] jdawgaz: has joined #ruby
[02:48:53] hahuang61: has joined #ruby
[02:49:46] Tref: has joined #ruby
[02:50:10] statelesscode: has joined #ruby
[02:52:23] Tref: hey guys I’m looking for the best resource for learning basic algorithms in either ruby or JS. Preferably something at the beginner level with examples of real world application on stuff like: [Hash tables, Linked lists, Breadth-first search, depth-first search, Quicksort, merge sort, Binary search, 2D arrays, Dynamic arrays, Binary search trees, Dynamic programming, Big-O analysis]
[02:52:43] benzrf: tref: this is not stuff that has real world application if you'rew riting ruby
[02:52:58] benzrf: tref: most of this stuff is only things that get implemented in C
[02:53:01] benzrf: well, maybe not big-o
[02:53:07] Ox0dea: And search.
[02:53:53] Tref: benzrf this because of the higher-level implementation of Ruby?
[02:54:31] Tref: I’m in the process of interviewing and it seems to be a pretty common question that comes up
[02:55:04] benzrf: that's kind of silly :(
[02:55:14] Tref: benzrf: tell me about it
[02:55:44] Tref: its a torrent of problems about shit I’ve never used in practice
[02:55:52] Ox0dea: Computer science != software development.
[02:56:12] Tref: Ox0dea EXACTLY
[02:56:32] Ox0dea: tref: But it's the same logic that makes standardized testing a reasonable thing to do.
[02:56:54] Tref: Ox0dea: I dont think the game questions are bad
[02:57:09] Tref: I just dont like how I have to explain them verbally
[02:58:27] sneakerhax: has joined #ruby
[02:59:11] Tref: Ox0dea: I think the best way to screen a candidate is to do the same exact thing you do at work. Give them a task and see how well they do it
[02:59:42] Ox0dea: tref: That's far too sensible.
[03:01:15] Tref: The last time they asked me about checkers I wanted to ask the interviewer at which point his fortune 500 payroll company started building games?
[03:02:07] Tref: I thought I was interviewing for application development
[03:02:19] hxegon: has joined #ruby
[03:02:59] matp: has joined #ruby
[03:03:44] Tref: That’s like interviewing a Chef with questions about farming
[03:03:58] leon_ee: has joined #ruby
[03:04:48] Ox0dea: tref: Was that a Mitch Hedberg reference?
[03:04:52] Tref: yes sir!
[03:04:53] Rasi: has joined #ruby
[03:04:56] jinie: has joined #ruby
[03:05:14] Tref: Ox0dea: wish that guy was still around. Such a shame :/
[03:05:23] Ox0dea: He was pretty great.
[03:05:49] z3uS: has joined #ruby
[03:05:57] slackR: has joined #ruby
[03:07:27] baweaver: has joined #ruby
[03:07:27] abyx: has joined #ruby
[03:08:00] zast: has joined #ruby
[03:08:44] frozen3: has joined #ruby
[03:09:30] Cohedrin: has joined #ruby
[03:09:40] Suntzu: has joined #ruby
[03:11:26] Ox0dea: tref: Really, though, it's more like expecting a chef to know how to prepare everything from scratch.
[03:11:37] Ox0dea: Really good chefs even pride themselves on being able to do so.
[03:11:37] smathy: tref, those sorts of questions are a very effective way of filtering out job opportunities that will be a nightmare.
[03:12:39] Tref: Ox0dea: what are you equating to ‘scratch’
[03:12:55] sarbs: has joined #ruby
[03:13:20] Ox0dea: tref: Well, raw ingredients, I suppose.
[03:13:39] Ox0dea: Probably don't look too far into the analogy.
[03:13:59] Tref: Ox0dea: haha, noted.
[03:14:22] G: has joined #ruby
[03:15:26] jtoy: has joined #ruby
[03:16:38] ruby-lang236: has joined #ruby
[03:16:45] Rubie: has joined #ruby
[03:20:09] braincrash: has joined #ruby
[03:23:40] darkf_: has joined #ruby
[03:24:39] sgambino: has joined #ruby
[03:24:57] j0bk_: has joined #ruby
[03:25:54] sorbo_: has joined #ruby
[03:26:25] mrfooo_: has joined #ruby
[03:26:36] BoxDevelopment_: has joined #ruby
[03:27:06] jhill_: has joined #ruby
[03:27:08] cbetta_: has joined #ruby
[03:27:23] baweaver: has joined #ruby
[03:27:56] rgs_: has joined #ruby
[03:27:58] Mr_Pancake-: has joined #ruby
[03:28:07] Armand: has joined #ruby
[03:28:12] bjmllr: has joined #ruby
[03:28:14] aspiers_: has joined #ruby
[03:28:32] joeyjones_: has joined #ruby
[03:28:38] c355E3B_: has joined #ruby
[03:28:50] TomyLobo: has joined #ruby
[03:28:50] troter________: has joined #ruby
[03:29:04] rfv_: has joined #ruby
[03:29:07] pfg__: has joined #ruby
[03:29:18] Nuck: has joined #ruby
[03:29:26] Lloyd__: has joined #ruby
[03:29:27] tekmaster: has joined #ruby
[03:29:37] deimos__: has joined #ruby
[03:29:39] Madplatypus_: has joined #ruby
[03:29:44] thomasfedb_: has joined #ruby
[03:29:54] gsingh93-: has joined #ruby
[03:30:07] UKn0Meh: has joined #ruby
[03:30:12] Blue_Ice_: has joined #ruby
[03:30:20] awk: has joined #ruby
[03:30:27] iNeedHelp: has joined #ruby
[03:30:28] shwouchkster_: has joined #ruby
[03:30:28] Lorn_: has joined #ruby
[03:30:43] artmann_: has joined #ruby
[03:31:05] Guest12896__: has joined #ruby
[03:31:10] j2k_: has joined #ruby
[03:31:26] bestie_: has joined #ruby
[03:31:26] bttf_: has joined #ruby
[03:31:38] bihi_: has joined #ruby
[03:31:43] x77686d_: has joined #ruby
[03:31:48] kireevco_: has joined #ruby
[03:31:51] shelling___: has joined #ruby
[03:32:03] wreet: has joined #ruby
[03:32:11] wreet: has left #ruby: ()
[03:32:12] majuscul1: has joined #ruby
[03:32:20] jmcc________: has joined #ruby
[03:32:21] abhishek_: has joined #ruby
[03:32:22] swills_: has joined #ruby
[03:32:35] Eleeleth_: has joined #ruby
[03:32:40] svkurowski_: has joined #ruby
[03:32:44] DiabolikFreenode: has joined #ruby
[03:32:50] kpwarr: has joined #ruby
[03:32:58] Antiarc1: has joined #ruby
[03:33:08] Jamo_: has joined #ruby
[03:33:20] kpwarr_: has joined #ruby
[03:33:21] raenk: has joined #ruby
[03:33:27] RealMarc: has joined #ruby
[03:33:31] atom3: has joined #ruby
[03:33:33] Flipez: has joined #ruby
[03:33:37] dling`: has joined #ruby
[03:33:43] ElderFain: has joined #ruby
[03:33:45] jwang: has joined #ruby
[03:33:48] trajing: has joined #ruby
[03:33:53] russt: has joined #ruby
[03:33:58] dellavg: has joined #ruby
[03:33:59] bougyman: has joined #ruby
[03:34:01] b3nt_pin: has joined #ruby
[03:34:08] cjk101010: has joined #ruby
[03:34:14] moredhel: has joined #ruby
[03:34:17] M-Kodo: has joined #ruby
[03:34:24] TheCubeLord: has joined #ruby
[03:34:26] hplar_: has joined #ruby
[03:34:28] Kilo`byte: has joined #ruby
[03:34:29] glacius: has joined #ruby
[03:34:36] hxegon: has joined #ruby
[03:34:38] nugit: has joined #ruby
[03:34:38] kalz: has joined #ruby
[03:34:40] EvilJStoker: has joined #ruby
[03:34:41] Luna_Moonfang: has joined #ruby
[03:34:45] Mekkis: has joined #ruby
[03:34:47] Cyrus: has joined #ruby
[03:34:56] JoL1hAHN: has joined #ruby
[03:35:03] vqrs: has joined #ruby
[03:35:31] shevy: has joined #ruby
[03:36:13] bronson: has joined #ruby
[03:36:16] borkdude: has joined #ruby
[03:36:41] uglybandersnatch: has joined #ruby
[03:36:42] incomprehensibly: has joined #ruby
[03:37:08] nitrix: has joined #ruby
[03:37:23] DukeDave: has joined #ruby
[03:37:24] alxndr: has joined #ruby
[03:37:34] amitchellbullard: has joined #ruby
[03:37:40] nyandoge: has joined #ruby
[03:37:50] bkxd: has joined #ruby
[03:37:51] charles81: has joined #ruby
[03:38:02] HashNuke: has joined #ruby
[03:38:42] acalewin: has joined #ruby
[03:38:52] podman: has joined #ruby
[03:39:28] crayfishx: has joined #ruby
[03:40:01] skydiver: has joined #ruby
[03:40:18] gix: has joined #ruby
[03:40:22] andersh: has joined #ruby
[03:40:23] sudoubuntu: has joined #ruby
[03:40:28] gremax: has joined #ruby
[03:41:25] LoneHermit: has joined #ruby
[03:43:02] benlovell: has joined #ruby
[03:43:49] drewo: has joined #ruby
[03:49:44] mr_oh: has joined #ruby
[03:50:01] Aswebb_: has joined #ruby
[03:50:54] mr_oh: Is there a way to do something like: write_to_file + "stuff...." , instead of typing out write_to_file every time?
[03:51:03] mr_oh: every line
[03:51:59] baweaver: mr_oh: https://gist.github.com/ - what's the code look like?
[03:52:12] baweaver: the answer depends on the context.
[03:55:11] jdawgaz: has joined #ruby
[03:55:58] mr_oh: Hmmm... is this how you use gist?
[03:55:59] mr_oh: https://gist.github.com/c0ldT/86590c98450ae7b4a480f93f6c42fd4d
[03:56:10] trosborn: has joined #ruby
[03:56:49] trosborn: has left #ruby: ()
[03:58:39] mr_oh: looks like poop? (Beginner stages)
[03:58:52] Ox0dea: mr_oh: For what it's worth, decent editor would let you write "w<Tab>" instead of having to spell it out every time.
[03:59:55] mr_oh: Atom seems kind of slow at that
[04:00:08] Ox0dea: I believe it.
[04:00:13] Ox0dea: I said a decent editor. :P
[04:00:40] Biohazard: has joined #ruby
[04:00:49] Ox0dea: You could stick all the strings in an Array and say `strings.each { |s| write_to_file s }` or some such, but that's not much of an improvement.
[04:01:14] Ox0dea: Do nix all those comments, though.
[04:01:19] moeabdol: has joined #ruby
[04:01:42] pawnbox: has joined #ruby
[04:01:51] merida: has joined #ruby
[04:02:33] mr_oh: I thought about initalizing values elsewhere and getting at them in the process_ methods
[04:02:40] noService: has joined #ruby
[04:02:47] Ox0dea: That's not a bad idea.
[04:02:50] mr_oh: But I haven't gotten into class and all that yet
[04:03:13] dravine: has joined #ruby
[04:03:43] Hanmac: has joined #ruby
[04:04:10] baweaver: also what's write_to_file
[04:04:14] mr_oh: suprising, but @variables work without any defined classes
[04:04:18] shevy: I believe it writes to a file
[04:04:32] baweaver: kinda unnecessary honestly.
[04:04:46] Aces1up: has joined #ruby
[04:05:12] baweaver: it's more of output to file, not process_products
[04:05:21] shevy: mr_oh yeah but actually when you are already using @variables, it's just a tiny extra step to write classes
[04:05:43] mr_oh: I should just do a class or two...
[04:05:48] frozen3: has joined #ruby
[04:07:10] mr_oh: well even if I do $file.puts "xcxcc", I'm still typing $file.puts on every line, no?
[04:08:31] Ox0dea: mr_oh: You can pass multiple arguments to #puts.
[04:08:48] karioleez: has joined #ruby
[04:08:49] Ox0dea: Also, @instance_variables don't go on classes; they go on instances.
[04:09:14] _blizzy_: has joined #ruby
[04:09:14] Ox0dea: >> @foo = 42; [self, instance_variables]
[04:09:15] ruby[bot]: Ox0dea: # => [main, [:@foo]] (https://eval.in/545337)
[04:11:45] pawnbox: has joined #ruby
[04:12:28] hk238: has joined #ruby
[04:13:44] NightMonkey_: has joined #ruby
[04:16:32] nlsun: has joined #ruby
[04:18:11] hxegon: has joined #ruby
[04:20:22] mr_oh: right, so the top level class is "main" or Object
[04:24:22] lyoshajapan: has joined #ruby
[04:24:56] duncannz: has joined #ruby
[04:25:38] nando293921: has joined #ruby
[04:25:41] Ox0dea: More precisely, `self` is `main` at the top level, and Object is the "default definee".
[04:26:14] CloCkWeRX: has joined #ruby
[04:27:50] Inside: has joined #ruby
[04:27:50] Inside: has joined #ruby
[04:27:53] mr_oh: ACTION punches screen
[04:32:35] pawnbox: has joined #ruby
[04:35:09] dtzuzu: has joined #ruby
[04:36:05] fedexo: has joined #ruby
[04:37:27] benlieb: has joined #ruby
[04:38:39] bkxd: has joined #ruby
[04:38:50] shevy: are you punching any particular nick mr_oh :)
[04:39:32] sgambino: has joined #ruby
[04:40:16] uglybandersnatch: has joined #ruby
[04:44:10] paradisaeidae: has joined #ruby
[04:44:46] mr_oh: Just the computer in general
[04:44:59] Ox0dea: How come?
[04:45:41] jtoy: has joined #ruby
[04:46:25] shevy: don't let the AIs rise
[04:47:58] sorbo_: has joined #ruby
[04:48:03] karioleez: has joined #ruby
[04:49:16] Gooer: has joined #ruby
[04:49:30] hahuang61: has joined #ruby
[04:50:03] paradisaeidae: So I've compiled Ruby 2.3.0. Looks like my gem's extension need recompiling. As rb_data_object_alloc is DEPRECATED_BY(rb_data_object_wrap
[04:50:38] paradisaeidae: Though when invoking gem, it loads the gems, one is ffi which halts.
[04:50:56] paradisaeidae: So cannot rebuild.
[04:51:59] paradisaeidae: Is there an option in building Ruby which gets over this?
[04:53:16] mr_oh: Ox0dea: It's just frustrating not knowing enough yet.
[04:53:46] CloCkWeRX: has joined #ruby
[04:53:59] Ox0dea: mr_oh: Anger is hardly the most appropriate response to (temporary) ignorance.
[04:54:19] Gooer_: has joined #ruby
[04:54:49] mr_oh: It isn't. But it built up over the course of the evening.
[04:54:59] Ox0dea: ¯\_(ツ)_/¯
[04:55:07] Ox0dea: Aim for "Fuck yeah! New shit to learn."
[04:55:22] Ox0dea: All things in moderation, of course.
[05:01:10] teejayen: has joined #ruby
[05:01:46] lyoshajapan: has joined #ruby
[05:02:09] S01780: has joined #ruby
[05:02:34] minimalism: has joined #ruby
[05:03:35] tneilen: has joined #ruby
[05:03:38] Ox0dea: paradisaeidae: Could you clarify? The ffi gem doesn't use rb_data_object_alloc(), so its relevance is unclear.
[05:03:54] frozen3: has joined #ruby
[05:04:53] lyoshajapan: has joined #ruby
[05:05:15] paradisaeidae: Hi, I see this: gems/ffi-1.9.10/lib/ffi_c.so: undefined symbol: rb_data_object_alloc
[05:06:49] paradisaeidae: Has it been linked in by a previous compile with Ruby 2.2.2?
[05:07:11] Ox0dea: Yes, that seems the most likely cause.
[05:07:25] Ox0dea: Re-installing the gem should clear that right up.
[05:08:45] paradisaeidae: Looks like I have to remove it with 2.2.2 then install it with 2.3.0
[05:09:56] sauvin: has joined #ruby
[05:11:03] Ox0dea: Yeah, gems are per-version unless you go out of your way to share them across, which isn't a great idea in the first place.
[05:11:18] last_staff: has joined #ruby
[05:19:11] sgambino: has joined #ruby
[05:22:28] chagel: has joined #ruby
[05:22:40] Devalo: has joined #ruby
[05:23:20] lyoshajapan: has joined #ruby
[05:29:16] Gooer_: has joined #ruby
[05:29:23] Elysia: has joined #ruby
[05:29:39] Tref: has joined #ruby
[05:31:19] benlovell: has joined #ruby
[05:34:35] Gooer: has joined #ruby
[05:35:06] Gooer_: has joined #ruby
[05:36:15] Gooer_: has joined #ruby
[05:36:47] bronson: has joined #ruby
[05:38:24] hotpancakes: has joined #ruby
[05:38:51] juria_roberts: has joined #ruby
[05:39:52] Oog: has joined #ruby
[05:40:59] juria_roberts: How do i merge the arrays instead of it being overwritten? https://repl.it/CAym/0
[05:41:12] jaruga: has joined #ruby
[05:41:14] Xiti: has joined #ruby
[05:41:57] baweaver: juria_roberts: Look into the merge function
[05:42:03] jaruga: has joined #ruby
[05:42:06] baweaver: &ri Hash#merge
[05:42:06] `derpy: http://ruby-doc.org/core-2.3.0/Hash.html#method-i-merge
[05:42:18] baweaver: it takes a block
[05:42:27] Radar: https://repl.it/CAym/1 ?
[05:42:45] Radar: baweaver: good point
[05:42:47] sinanislekdemir: has joined #ruby
[05:43:04] krz: has joined #ruby
[05:43:48] baweaver: >> {a: [1]}.merge({a: [2]}) { |k, old_val, new_val| old_val + new_val }
[05:43:50] ruby[bot]: baweaver: # => {:a=>[1, 2]} (https://eval.in/545359)
[05:43:54] Radar: https://repl.it/CAym/2
[05:43:57] Radar: juria_roberts: ^
[05:44:30] juria_roberts: Thanks baweaver and Radar..i am new to Ruby :)
[05:44:47] baweaver: given that it's a block, you could do arbitrary conditions to do things like diffs, unions, and more. Quite handy.
[05:44:57] baweaver: juria_roberts: everyone starts somewhere.
[05:45:10] juria_roberts: how do i merge multiple?
[05:45:27] baweaver: though the docs are quite well written and very useful. I'd read through Enumerable at some point.
[05:45:36] baweaver: juria_roberts: explain a little further there
[05:45:37] juria_roberts: without chaining merge
[05:46:01] baweaver: merge multiple hashes, ie flatten them into one?
[05:46:07] baweaver: do you want the same block logic?
[05:46:16] baweaver: yup to the second as well?
[05:46:20] juria_roberts: no another logic will do
[05:46:41] Macaveli: has joined #ruby
[05:46:48] baweaver: >> [{a: 1}, {b: 2}, {c: 3}].reduce({}, :merge!)
[05:46:49] ruby[bot]: baweaver: # => {:a=>1, :b=>2, :c=>3} (https://eval.in/545368)
[05:46:59] baweaver: That's dense, so let's break it down a bit
[05:47:02] Ox0dea: baweaver: Obfuscatory?
[05:47:06] Ox0dea: They need merge logic.
[05:47:07] baweaver: first, the longhand version of it.
[05:47:37] Ox0dea: They need #reduce + #merge with a block.
[05:47:52] baweaver: getting to that.
[05:48:03] juria_roberts: https://repl.it/CAym/3 doesnt work
[05:48:22] baweaver: >> [{a: 1}, {b: 2}, {c: 3}].reduce({}) { |new_hash, hash| new_hash.merge!(hash) }
[05:48:23] ruby[bot]: baweaver: # => {:a=>1, :b=>2, :c=>3} (https://eval.in/545371)
[05:48:50] baweaver: >> [{a: 1}, {b: 2, c: 2}, {c: 3}].reduce({}) { |new_hash, hash| new_hash.merge!(hash) { |k,o,n| o + n } }
[05:48:51] ruby[bot]: baweaver: # => {:a=>1, :b=>2, :c=>5} (https://eval.in/545374)
[05:49:39] Ox0dea: juria_roberts: https://eval.in/545376
[05:49:57] baweaver: the shorthand was because they mentioned it being different logic as a setup to mentioning the rest of it.
[05:50:21] hotpancakes: has joined #ruby
[05:50:53] Aswebb_: has joined #ruby
[05:51:12] juria_roberts: Ox0dea: so if i have 10 hashes that becomes infeasible
[05:51:25] rmulligan: has joined #ruby
[05:51:28] Ox0dea: juria_roberts: How come?
[05:52:26] baweaver: give it a try with 10 hashes
[05:52:28] Ox0dea: If you've got ten related Hashes, they should probably be in an Array already, and you just #reduce over that.
[05:52:53] jorum: has joined #ruby
[05:53:16] baweaver: noted that reduce is dense the first few times you see it.
[05:53:31] juria_roberts: Ox0dea: i was wrong i misunderstood
[05:53:48] sandelius: has joined #ruby
[05:54:16] juria_roberts: Ox0dea: yeah my hashes will have the same keys
[05:56:00] GitGud: has joined #ruby
[05:56:13] baweaver: http://www.sitepoint.com/guide-ruby-collections-iii-enumerable-enumerator/ - that has a section on reduce that looks fairly good
[05:57:48] benlieb: has joined #ruby
[05:58:29] chouhoulis: has joined #ruby
[05:59:45] nando293921: has joined #ruby
[05:59:55] Ox0dea: juria_roberts: Another approach worth considering: https://eval.in/545384
[05:59:57] Xeago: has joined #ruby
[06:02:10] karioleez: has joined #ruby
[06:03:08] GitGud: has joined #ruby
[06:03:32] juria_roberts: Ox0dea: Thanks thats awesome..ill read up and try to understand what's happening
[06:03:52] karioleez: has joined #ruby
[06:04:18] jkahn: has joined #ruby
[06:04:37] torandu: has joined #ruby
[06:07:23] hotpancakes: has joined #ruby
[06:07:23] frozen3: has joined #ruby
[06:07:31] lyoshajapan: has joined #ruby
[06:09:18] dtzuzu: has joined #ruby
[06:10:23] Ox0dea: juria_roberts: Sure thing. Feel free to ask for clarification.
[06:10:59] Ox0dea: It's almost 5x faster and than the reduce+merge approach, *and* you don't have to artificially bracket your values. :)
[06:11:27] juria_roberts: Ox0dea: Thanks a lot!
[06:11:44] Ox0dea: juria_roberts: Happy to help.
[06:12:43] baweaver: Ox0dea: is it really? huh
[06:12:51] baweaver: ACTION tinkers with benchmark
[06:13:02] baweaver: wait, merge or merge!?
[06:13:13] Ox0dea: baweaver: https://eval.in/545404
[06:13:20] Ox0dea: Oh, you're right that #merge! would be faster, though.
[06:14:01] Ox0dea: Wow, or not... at all.
[06:15:15] Ox0dea: baweaver: Are you seeing what I'm seeing?
[06:15:32] baweaver: give me a sec
[06:16:47] baweaver: ACTION checks ruby version
[06:17:35] skade: has joined #ruby
[06:18:10] Ox0dea: On trunk, swapping #merge for #merge! makes that approach ~100x slower!
[06:18:16] jenrzzz: has joined #ruby
[06:19:12] baweaver: is it the block?
[06:19:26] uglybandersnatch: has joined #ruby
[06:19:28] baweaver: also: Array(o) + [n] is slower
[06:19:41] ruby[bot]: baweaver: # => [1, 2] (https://eval.in/545407)
[06:20:03] baweaver: 2.3 doesn't have ips, odd.
[06:20:28] Ox0dea: It should totally be in stdlib by now.
[06:21:39] rmulligan: has joined #ruby
[06:22:03] jkahn: has joined #ruby
[06:22:43] Ox0dea: At any rate, the speedier approach just makes more sense if all the Hashes have the same keys.
[06:23:00] pawnbox: has joined #ruby
[06:23:01] mrgrieves: has joined #ruby
[06:23:37] Ox0dea: Still not sure why #merge! makes it crawl rather than give it a little boost.
[06:25:30] baweaver: something screwy with the block
[06:26:20] baweaver: using Benchmark#benchmark with 10k repeats
[06:26:27] baweaver: merge! is still waiting
[06:26:53] baweaver: merge took under half a second
[06:26:57] Ox0dea: I swapped the body for `[*o, n]` to no real gain.
[06:26:58] baweaver: this has been going for several
[06:27:21] Ox0dea: It's very strange.
[06:27:23] nickjj_: has joined #ruby
[06:27:44] sandstrom: has joined #ruby
[06:27:52] Ox0dea: It must be that far more objects are being allocated than intuition reveals.
[06:27:54] sandelius: has joined #ruby
[06:27:59] Radar: just run strace on it
[06:28:00] Radar: ACTION runs
[06:28:01] araujo: has joined #ruby
[06:29:30] MyMind: has joined #ruby
[06:29:33] baweaver: https://eval.in/545413
[06:30:02] Ox0dea: baweaver: I found my derp.
[06:30:16] Ox0dea: #merge! is faster than #merge if you pass an init Hash.
[06:30:24] theRealAlexz: has joined #ruby
[06:30:29] baweaver: Radar: we good
[06:30:36] baweaver: shenanigans were had
[06:30:40] Ox0dea: So write locking of some kind?
[06:31:12] baweaver: oh I see it
[06:31:24] baweaver: merge! kept mutating it
[06:31:28] baweaver: making the thing giant
[06:31:35] baweaver: only shows up on large sets
[06:31:52] jtoy: has joined #ruby
[06:32:16] Ox0dea: Not sure I follow.
[06:32:23] segy: has joined #ruby
[06:32:48] baweaver: what happens when you don't pass an init?
[06:33:28] baweaver: https://eval.in/545414 - in any case, yours is faster still
[06:33:57] baweaver: the gist of it is without an init, it keeps merging down onto the first element mutating them all along the way
[06:34:14] baweaver: repeat for thousands of times and....
[06:35:08] bruce_lee: has joined #ruby
[06:35:47] Ox0dea: Yep, I see it now.
[06:35:55] CausaMortis: has joined #ruby
[06:36:20] User458764: has joined #ruby
[06:36:25] baweaver: memory doesn't like us
[06:36:34] sorbo_: has joined #ruby
[06:36:34] blackgoat: has joined #ruby
[06:36:46] Ox0dea: Memory wants to be finite.
[06:36:57] Ox0dea: Entropy wins. :(
[06:37:57] rkazak: has joined #ruby
[06:37:59] CausaMortis_: has joined #ruby
[06:38:49] LoneHerm_: has joined #ruby
[06:39:29] bkxd: has joined #ruby
[06:41:56] baweaver: well, good thing it was just a mistake
[06:42:03] baweaver: otherwise that'd be terrifying :D
[06:44:17] Ox0dea: A universe where allocating new objects is faster than reusing old ones? I want to go to there.
[06:44:31] the_drow: has joined #ruby
[06:44:44] anisha: has joined #ruby
[06:44:49] andikr: has joined #ruby
[06:45:06] tomaz_b: has joined #ruby
[06:45:57] kam270: has joined #ruby
[06:46:37] davee_: has joined #ruby
[06:46:43] baweaver: I hear Haskell Curry greets you upon arrival
[06:47:11] Ox0dea: I'd've expected Bagwell.
[06:48:07] madgen: has joined #ruby
[06:49:51] minimalism: has joined #ruby
[06:49:53] djbkd: has joined #ruby
[06:50:21] baweaver: well allocating a new object is free, so why not
[06:50:29] baweaver: Bagwell is there with them
[06:50:58] hotpancakes: has joined #ruby
[06:51:08] vale_tudo: has joined #ruby
[06:52:12] krz: has joined #ruby
[06:52:20] baweaver: Ablesson and Sussman are teaching the acolytes in the garden
[06:52:46] Ox0dea: I really like this picture you're painting.
[06:53:01] baweaver: I could actually paint it
[06:54:19] tubuliferous_: has joined #ruby
[06:55:33] Ox0dea: Something like "The Garden of Earthly Delights" + http://i.imgur.com/aqg21UI.jpg
[06:56:12] Polysics: has joined #ruby
[06:56:36] Ox0dea: Love the hat.
[06:56:55] baweaver: you notice the oregano there?
[06:57:07] baweaver: ACTION man oregano
[06:57:33] aganov: has joined #ruby
[06:58:12] noServic1: has joined #ruby
[06:58:53] DoubleMalt: has joined #ruby
[06:59:09] chouhoulis: has joined #ruby
[06:59:16] Ox0dea: SPICE -> ngspice -> Oregano.
[06:59:38] djbkd: has joined #ruby
[07:01:17] biberu: has joined #ruby
[07:02:58] tvw: has joined #ruby
[07:05:50] neanderslob_: has joined #ruby
[07:06:09] frozen3: has joined #ruby
[07:06:11] yfeldblum: has joined #ruby
[07:07:27] brt: has joined #ruby
[07:07:29] CloCkWeRX: has joined #ruby
[07:09:07] mark2: has joined #ruby
[07:10:17] wethu: has joined #ruby
[07:13:23] ruby-lang390: has joined #ruby
[07:13:42] theRealAlexz: has joined #ruby
[07:14:58] torandu: has joined #ruby
[07:16:11] codecop: has joined #ruby
[07:16:12] codecop_: has joined #ruby
[07:17:17] rmulligan: has joined #ruby
[07:18:26] Couch: has joined #ruby
[07:18:33] ur5us: has joined #ruby
[07:20:14] Gooer__: has joined #ruby
[07:21:07] Gooer: has joined #ruby
[07:26:07] sandstrom: has joined #ruby
[07:26:25] aufi: has joined #ruby
[07:28:09] mark2: has joined #ruby
[07:29:34] mark2: has left #ruby: ()
[07:29:46] mark2: has joined #ruby
[07:30:51] sorbo_: has joined #ruby
[07:32:04] jorum: has joined #ruby
[07:33:45] blaxter: has joined #ruby
[07:33:56] anaeem1: has joined #ruby
[07:34:34] kwd: has joined #ruby
[07:35:55] mikecmpbll: has joined #ruby
[07:36:35] dikaio: has joined #ruby
[07:37:02] the_drow: has joined #ruby
[07:38:29] bronson: has joined #ruby
[07:43:02] jackjackdripper: has joined #ruby
[07:43:06] dling: has joined #ruby
[07:44:46] GitGud: has joined #ruby
[07:49:35] mikecmpbll: has joined #ruby
[07:49:48] edwinvdgraaf: has joined #ruby
[07:50:23] Gooer_: has joined #ruby
[07:50:32] hotpancakes: has joined #ruby
[07:50:41] tildes: has joined #ruby
[07:51:20] Gooer: has joined #ruby
[07:51:28] kristofferR: has joined #ruby
[07:51:53] Aswebb_: has joined #ruby
[07:52:20] sarbs: has joined #ruby
[07:53:13] jtoy: has joined #ruby
[07:54:54] Gooer__: has joined #ruby
[07:55:14] blindsight: has joined #ruby
[07:55:33] marr: has joined #ruby
[07:55:46] Gooer: has joined #ruby
[07:56:31] artmann: has joined #ruby
[07:59:44] Gooer_: has joined #ruby
[07:59:51] dtzuzu: has joined #ruby
[08:00:14] chouhoulis: has joined #ruby
[08:00:40] Gooer: has joined #ruby
[08:01:33] Xeago: has joined #ruby
[08:03:28] frozen3: has joined #ruby
[08:04:11] blindsight: has joined #ruby
[08:05:09] sjohnsen: has left #ruby: ("WeeChat 1.4")
[08:05:12] mikecmpbll: has joined #ruby
[08:05:52] Gooer__: has joined #ruby
[08:07:35] nanoz: has joined #ruby
[08:07:53] blindsight: has joined #ruby
[08:08:30] workmad3: has joined #ruby
[08:10:02] krz: has joined #ruby
[08:11:57] Gooer: has joined #ruby
[08:11:57] Gooer_: has joined #ruby
[08:12:32] rmulligan: has joined #ruby
[08:14:07] baweaver: has joined #ruby
[08:14:24] Xeago_: has joined #ruby
[08:15:42] blindsight: has joined #ruby
[08:15:59] User458764: has joined #ruby
[08:17:12] miah: has joined #ruby
[08:20:00] mrgrieves: has joined #ruby
[08:21:18] agit0: has joined #ruby
[08:21:54] Spami: has joined #ruby
[08:21:59] pandaant: has joined #ruby
[08:24:23] the_drow: has joined #ruby
[08:24:35] PaulCapestany: has joined #ruby
[08:31:17] AlexRussia: has joined #ruby
[08:31:59] hotpancakes: has joined #ruby
[08:32:26] myntcake: has joined #ruby
[08:32:58] uglybandersnatch: has joined #ruby
[08:33:42] tubuliferous_: has joined #ruby
[08:35:48] f4cl3y: has joined #ruby
[08:36:48] sorbo_: has joined #ruby
[08:37:33] edwinvdgraaf: has joined #ruby
[08:37:48] decoponio: has joined #ruby
[08:37:50] brt: has joined #ruby
[08:39:15] drewo: has joined #ruby
[08:40:08] bkxd: has joined #ruby
[08:40:44] bigkevmcd: has joined #ruby
[08:41:45] joonty: has joined #ruby
[08:45:59] Suntzu: has joined #ruby
[08:50:32] johnmilton: has joined #ruby
[08:50:36] dionysus69: has joined #ruby
[08:50:49] hotpancakes: has joined #ruby
[08:51:19] PaulCape_: has joined #ruby
[08:55:03] benlovell: has joined #ruby
[08:58:20] bruce_lee: has joined #ruby
[08:58:21] Xeago: has joined #ruby
[09:00:58] chouhoulis: has joined #ruby
[09:03:39] noService: has joined #ruby
[09:03:43] noService: has joined #ruby
[09:04:16] frozen3: has joined #ruby
[09:04:26] hotpancakes: has joined #ruby
[09:06:19] tubuliferous_: has joined #ruby
[09:06:43] rmulligan: has joined #ruby
[09:07:59] torandu: has joined #ruby
[09:09:02] CausaMortis: has joined #ruby
[09:12:32] pawnbox: has joined #ruby
[09:13:10] binaryplease1: has joined #ruby
[09:13:27] evidex: has joined #ruby
[09:13:46] LowLifePerv: has joined #ruby
[09:15:18] LowLifePerv: has joined #ruby
[09:15:48] rolha: has joined #ruby
[09:16:56] PaulCapestany: has joined #ruby
[09:18:19] Azure|dc: has joined #ruby
[09:18:30] SweetHeart: has joined #ruby
[09:23:43] noService: has joined #ruby
[09:26:32] merida: has joined #ruby
[09:30:43] adaedra: has joined #ruby
[09:30:57] uglybandersnatch: has joined #ruby
[09:31:49] skislak: has joined #ruby
[09:32:27] User458764: has joined #ruby
[09:33:42] TvL2386: has joined #ruby
[09:33:45] Ropeney: has joined #ruby
[09:36:05] hogetaro: has joined #ruby
[09:36:18] m8: has joined #ruby
[09:36:26] sorbo_: has joined #ruby
[09:36:33] Gasher: has joined #ruby
[09:37:28] tvw: has joined #ruby
[09:40:32] bronson: has joined #ruby
[09:42:50] _blizzy_: has joined #ruby
[09:43:29] ferr: has joined #ruby
[09:45:48] hotpancakes: has joined #ruby
[09:46:11] GitGud: has joined #ruby
[09:48:48] GitGud: has joined #ruby
[09:48:52] benlovell: has joined #ruby
[09:50:45] evidex: has joined #ruby
[09:51:43] noService: has joined #ruby
[09:51:43] chagel: has joined #ruby
[09:52:57] Aswebb_: has joined #ruby
[09:57:58] snowy: has joined #ruby
[09:59:06] sarbs: has joined #ruby
[10:00:47] madgen: has joined #ruby
[10:00:48] rmulligan: has joined #ruby
[10:01:05] Peteykun: has joined #ruby
[10:02:52] sarbs_: has joined #ruby
[10:02:57] chouhoulis: has joined #ruby
[10:02:58] vondruch_: has joined #ruby
[10:03:00] bluOxigen: has joined #ruby
[10:03:12] User458764: has joined #ruby
[10:03:43] hotpancakes: has joined #ruby
[10:04:53] cibs_: has joined #ruby
[10:06:27] patrick_star: has joined #ruby
[10:09:16] frozen3: has joined #ruby
[10:09:44] PaulCape_: has joined #ruby
[10:11:11] d0nn1e: has joined #ruby
[10:11:28] cibs: has joined #ruby
[10:12:01] Spami: has joined #ruby
[10:15:10] baweaver: has joined #ruby
[10:17:20] n008f4g_: has joined #ruby
[10:17:54] PlasmaStar: has joined #ruby
[10:18:19] krz: has joined #ruby
[10:19:36] sepp2k: has joined #ruby
[10:20:41] _blizzy_: has joined #ruby
[10:22:35] pawnbox: has joined #ruby
[10:24:21] blaxter: has joined #ruby
[10:26:13] bkxd: has joined #ruby
[10:27:30] drewo: has joined #ruby
[10:29:40] ixti: has joined #ruby
[10:31:58] wethu: has joined #ruby
[10:32:18] Spami: has joined #ruby
[10:34:45] Spami_: has joined #ruby
[10:36:10] FooMunki: has joined #ruby
[10:37:54] Azure: has joined #ruby
[10:38:33] Silox|: has joined #ruby
[10:42:28] CloCkWeRX: has joined #ruby
[10:43:00] blaxter: has joined #ruby
[10:43:26] ponga: has joined #ruby
[10:45:09] Gasher: hello, is erb included with Ruby? I couldn't install it as a gem
[10:45:13] hotpancakes: has joined #ruby
[10:45:24] Polysics_: has joined #ruby
[10:45:27] yorickpeterse: Gasher: Yes, just require 'erb'
[10:45:34] yorickpeterse: >> require 'erb'
[10:45:35] ruby[bot]: yorickpeterse: # => true (https://eval.in/545578)
[10:46:03] jaruga: has joined #ruby
[10:47:30] jaruga_: has joined #ruby
[10:49:58] mikeiniowa: has joined #ruby
[10:50:25] millerti: has joined #ruby
[10:50:54] djellemah_: has joined #ruby
[10:51:03] merida_: has joined #ruby
[10:52:29] bluOxigen: has joined #ruby
[10:52:29] sandstrom: has joined #ruby
[10:54:50] crazydiamond: has joined #ruby
[10:55:04] rmulligan: has joined #ruby
[10:59:22] rodfersou: has joined #ruby
[11:00:13] noService: has joined #ruby
[11:01:19] brt: has joined #ruby
[11:01:27] biberu: has joined #ruby
[11:02:21] platzhirsch: has joined #ruby
[11:03:42] yfeldblum: has joined #ruby
[11:03:44] chouhoulis: has joined #ruby
[11:04:13] jaruga_: has joined #ruby
[11:04:47] dvinciguerra__: has joined #ruby
[11:04:51] brt_: has joined #ruby
[11:05:02] merida: has joined #ruby
[11:07:15] MyMind: has joined #ruby
[11:08:31] vale_tudo: has joined #ruby
[11:13:26] roelof: has joined #ruby
[11:13:35] woodruffw: has joined #ruby
[11:13:58] roelof: How can I improve this code :https://gist.github.com/rwobben/6f52289d9d0dc686ff270fb19faad5b4
[11:14:05] woodruffw: has joined #ruby
[11:14:58] sdothum: has joined #ruby
[11:15:28] Balzrael: has joined #ruby
[11:16:50] Xiti: has joined #ruby
[11:17:25] noService: has joined #ruby
[11:18:51] mja: has joined #ruby
[11:19:22] solocshaw: has joined #ruby
[11:20:14] norc: has joined #ruby
[11:20:50] vqrs_: has joined #ruby
[11:20:53] Zarthus_: has joined #ruby
[11:21:28] neanderslob: has joined #ruby
[11:21:37] drewo: has joined #ruby
[11:21:41] Some-body_: has joined #ruby
[11:21:53] crankharder: has joined #ruby
[11:22:05] hays: has joined #ruby
[11:22:37] juanfra_: has joined #ruby
[11:22:50] MalcolmReynolds: has joined #ruby
[11:22:52] kkirsche: has joined #ruby
[11:22:53] bihi_: has joined #ruby
[11:22:55] jhass: has joined #ruby
[11:22:58] atmosx_alt: has joined #ruby
[11:23:00] djcp: has joined #ruby
[11:23:05] bqscott_: has joined #ruby
[11:23:12] David_H_Smith: has joined #ruby
[11:23:14] mtkd: has joined #ruby
[11:23:14] hyperdrive: has joined #ruby
[11:23:21] lianj: has joined #ruby
[11:23:22] lianj: has joined #ruby
[11:23:26] Alina-malina: has joined #ruby
[11:23:28] TheBrayn: has joined #ruby
[11:23:28] D9: has joined #ruby
[11:23:29] WebDawg: has joined #ruby
[11:23:30] brixen_: has joined #ruby
[11:23:58] frozen3: has joined #ruby
[11:24:07] flopsec: has joined #ruby
[11:24:09] Log1x: has joined #ruby
[11:24:09] Log1x: has joined #ruby
[11:24:09] roelof: Another question : why is answer not a array here ; number = array.shuffle.join.to_i answer << number unless answer.include? number ???
[11:24:11] Alina-malina: has joined #ruby
[11:24:33] kriskropd: has joined #ruby
[11:24:49] Cork: has joined #ruby
[11:25:09] mdw: has joined #ruby
[11:25:12] gregf_: roelof: youre finding the permutations for a number?
[11:25:32] kam270: has joined #ruby
[11:25:44] roelof: gregf_: yep, that is the challenge I have to solve
[11:25:45] madgen: how is answer declared?
[11:25:51] gregf_: >> "245".split("").permutation.to_a.map(&:join).map(&:to_i) # like that
[11:25:52] ruby[bot]: gregf_: # => [245, 254, 425, 452, 524, 542] (https://eval.in/545599)
[11:26:10] gregf_: roelof: you need to calculate the fatorial just once in that while?
[11:26:38] roelof: gregf_: yep, that factorial is a constant
[11:27:12] gregf_: so change that :) # btw, whiles in ruby are *rare* &
[11:27:17] roelof: and the answer has to be for 24 . [24,42] and I see 24 42
[11:29:45] roelof: gregf_: change that . the calculation is now a seperate variable
[11:30:04] gregf_: # [1,2,3].permutations.map(*.perl) # Perl6 ftw!
[11:30:15] roelof: But still I think answer << number schould be a array not seperate numbers
[11:30:16] norc: roelof: Calling join on an array coerces all elements to string and then joins them together. Thus [10, 11].join would produce a String "1011". Calling to_i on that converts that string back to a number.
[11:30:19] madgen: well the answer is an array and you are adding all permutations
[11:30:20] norc: Just to answer your initial question.
[11:30:25] madgen: it is an array
[11:30:35] madgen: puts prints all array values in a newline
[11:30:40] madgen: puts [1,2,3]
[11:30:40] nachoman: has joined #ruby
[11:30:49] madgen: ?? puts [1,2,3]
[11:30:52] madgen: >> puts [1,2,3]
[11:31:11] ruby[bot]: norc: # => 1 ...check link for more (https://eval.in/545600)
[11:31:23] norc: madgen: You have to be identified with NickServ for it to work I believe.
[11:31:35] roelof: >> puts [1,2,3]
[11:32:05] madgen: norc: I think it worked, no?
[11:32:33] norc: It just reacted to my statement.
[11:32:37] norc: >> puts [1,2,3]
[11:32:38] ruby[bot]: norc: # => 1 ...check link for more (https://eval.in/545601)
[11:32:45] quazimodo: has joined #ruby
[11:32:57] madgen: indeed, thanks for warning
[11:33:14] roelof: >> puts [1,2,3]
[11:33:15] ruby[bot]: roelof: # => 1 ...check link for more (https://eval.in/545602)
[11:33:57] roelof: oke, how can I tell ruby I want the whole array
[11:34:03] GodFather: has joined #ruby
[11:36:06] benlovell: has joined #ruby
[11:37:24] madgen: >> puts [1,2,3] # i am registered now, I think...
[11:37:25] ruby[bot]: madgen: # => 1 ...check link for more (https://eval.in/545615)
[11:37:50] madgen: roelof: that's the whole array
[11:37:57] manveru: roelof: puts returns one element per line
[11:37:57] madgen: you can do the following though
[11:38:06] madgen: >> p [1,2,3]
[11:38:07] ruby[bot]: madgen: # => [1, 2, 3] ...check link for more (https://eval.in/545616)
[11:38:14] manveru: >> [1,2,3].inspect
[11:38:15] roelof: yep, outs [1,2,3] returns 1 2 3 . I want to output [1,2,3]
[11:38:15] ruby[bot]: manveru: # => "[1, 2, 3]" (https://eval.in/545617)
[11:38:17] johnmilton: has joined #ruby
[11:38:41] manveru: >> puts [1,2,3].inspect
[11:38:42] ruby[bot]: manveru: # => [1, 2, 3] ...check link for more (https://eval.in/545618)
[11:40:56] the_drow: has joined #ruby
[11:41:37] hotpancakes: has joined #ruby
[11:41:54] roelof: pff , with answer.inspect I see this rspec error : expected: [123, 132, 213, 231, 312, 321] got: "[\"231\", \"132\", \"321\", \"312\", \"123\", \"213\"]"
[11:42:26] manveru: ok, you want to just return your array
[11:42:40] manveru: then don't use puts or inspect
[11:42:45] ldnunes: has joined #ruby
[11:42:54] bronson: has joined #ruby
[11:42:55] manveru: >> [1,2,3]
[11:42:57] ruby[bot]: manveru: # => [1, 2, 3] (https://eval.in/545621)
[11:42:59] manveru: just do that
[11:43:04] roelof: manveru: so just answer
[11:45:22] roelof: Thanks, this works : https://gist.github.com/rwobben/adc2c28e2bb674dd59b1179bf5d1628d
[11:45:42] roelof: but I still wonder if it can be done with lesser code
[11:45:50] madgen: also you can replace inject
[11:45:59] madgen: >> [1,2,3,4].inject(:*)
[11:46:01] ruby[bot]: madgen: # => 24 (https://eval.in/545622)
[11:46:01] manveru: i'm still not sure what it's supposed to do...
[11:46:41] manveru: running inject on each iterations is bad
[11:47:39] mdw7: has joined #ruby
[11:48:18] manveru: more like (1..array.size).reduce(:+).times{}
[11:48:44] vondruch: has joined #ruby
[11:49:11] rmulligan: has joined #ruby
[11:49:18] solars: has joined #ruby
[11:49:19] nfk|laptop: has joined #ruby
[11:49:21] manveru: oh, you try to get all combinations?
[11:50:04] manveru: >> [1,2,3].permutation(3).to_a.map(&:join)
[11:50:06] ruby[bot]: manveru: # => ["123", "132", "213", "231", "312", "321"] (https://eval.in/545624)
[11:50:07] manveru: like that?
[11:50:30] c999: has joined #ruby
[11:50:38] andywojo: has joined #ruby
[11:50:42] IrishGringo: has joined #ruby
[11:50:47] manveru: >> [1,2,3].permutation(3).map{|a| a.join.to_i }
[11:50:48] ruby[bot]: manveru: # => [123, 132, 213, 231, 312, 321] (https://eval.in/545625)
[11:51:20] but3k4: has joined #ruby
[11:53:31] Xeago: has joined #ruby
[11:54:05] roelof: manveru: thanks, have not learned about the permutations function
[11:55:48] Hanmac: has joined #ruby
[11:56:59] dtzuzu: has joined #ruby
[11:57:18] riffraff: has joined #ruby
[11:57:37] GitGud: has joined #ruby
[12:00:22] jdawgaz: has joined #ruby
[12:01:42] Polysics: has joined #ruby
[12:01:59] creat: has joined #ruby
[12:02:00] frozen3_: has joined #ruby
[12:03:53] m8: has joined #ruby
[12:04:28] leon_ee: has joined #ruby
[12:04:31] chouhoulis: has joined #ruby
[12:06:18] dravine: has joined #ruby
[12:06:30] SCHAAP137: has joined #ruby
[12:06:41] User458764: has joined #ruby
[12:07:51] benlovell: has joined #ruby
[12:09:22] StyXman: has left #ruby: ()
[12:09:27] LoneHerm_: has joined #ruby
[12:15:43] drewo: has joined #ruby
[12:16:15] baweaver: has joined #ruby
[12:17:19] ruby[bot]: -b *!*@5.53.114.32$#ruby-banned
[12:17:21] n008f4g_: has joined #ruby
[12:18:18] inukshuk_: has joined #ruby
[12:19:30] krz: has joined #ruby
[12:21:03] Xeago: has joined #ruby
[12:22:37] benlovel1: has joined #ruby
[12:23:04] hotpancakes: has joined #ruby
[12:23:38] joonty: has joined #ruby
[12:25:12] zzzak: has joined #ruby
[12:26:01] pawnbox: has joined #ruby
[12:26:20] jdawgaz: has joined #ruby
[12:26:52] bkxd: has joined #ruby
[12:29:39] aupadhye: has joined #ruby
[12:30:49] User458764: has joined #ruby
[12:33:42] duckpuppy: has joined #ruby
[12:36:32] Xeago: has joined #ruby
[12:38:49] Vile`: has joined #ruby
[12:41:40] neanderslob: has joined #ruby
[12:43:09] rmulligan: has joined #ruby
[12:45:04] NightMonkey: has joined #ruby
[12:46:05] snowy: has joined #ruby
[12:48:20] aryaching: has joined #ruby
[12:48:54] madgen: has joined #ruby
[12:48:55] pawnbox: has joined #ruby
[12:49:14] jaruga_: has joined #ruby
[12:49:24] statelesscode: has joined #ruby
[12:49:47] jaruga_: has joined #ruby
[12:51:42] hightower3: has joined #ruby
[12:53:12] Gasher: has joined #ruby
[12:53:56] lyoshajapan: has joined #ruby
[12:55:02] aryaching: has joined #ruby
[12:55:06] CloCkWeRX: has joined #ruby
[12:55:10] gaf_: has joined #ruby
[12:55:34] krz: has joined #ruby
[12:55:47] cpup: has joined #ruby
[13:00:50] skweek: has joined #ruby
[13:03:16] tvw: has joined #ruby
[13:04:20] djcp1: has joined #ruby
[13:04:30] hotpancakes: has joined #ruby
[13:05:13] chouhoulis: has joined #ruby
[13:08:01] ekinmur: has joined #ruby
[13:09:20] lyoshajapan: has joined #ruby
[13:09:37] konsolebox: has joined #ruby
[13:09:50] drewo: has joined #ruby
[13:10:04] torandu: has joined #ruby
[13:10:07] krobzaur: has joined #ruby
[13:10:22] Peteykun: has joined #ruby
[13:14:10] ekinmur: has joined #ruby
[13:16:11] hxegon: has joined #ruby
[13:17:52] hightower3: has joined #ruby
[13:21:16] cdg: has joined #ruby
[13:21:30] sudoubuntu: has joined #ruby
[13:21:50] sgambino: has joined #ruby
[13:22:47] jeffsouz4: has joined #ruby
[13:22:53] jeffsouz4: has left #ruby: ("WeeChat 1.4")
[13:22:55] jeffsouz4: has joined #ruby
[13:24:29] AlexJakeGreen: has joined #ruby
[13:25:16] jeffsouz4: has left #ruby: ("WeeChat 1.4")
[13:26:27] Ishido: has joined #ruby
[13:28:04] skade: has joined #ruby
[13:29:37] rbennacer: has joined #ruby
[13:30:36] decoponio: has joined #ruby
[13:30:50] _stu_: has joined #ruby
[13:30:56] malconis: has joined #ruby
[13:30:59] chagel: has joined #ruby
[13:32:46] IrishGringo: has joined #ruby
[13:33:20] Spami_: has joined #ruby
[13:36:45] Xeago: has joined #ruby
[13:37:19] rmulligan: has joined #ruby
[13:38:06] MaienM: has joined #ruby
[13:38:13] roelof: has joined #ruby
[13:38:30] aryaching: has joined #ruby
[13:38:39] roelof: why do I get a non-method error here : nums.inject(1) { |answer, number| sum = sum * number } I thought I could multiply with * ?
[13:39:29] patrick_star: has joined #ruby
[13:40:14] dtzuzu: has joined #ruby
[13:40:39] noService: has joined #ruby
[13:41:19] apeiros: roelof: read your code. pay attention to the variable names.
[13:41:59] pandaant: has joined #ruby
[13:43:34] benlovell: has joined #ruby
[13:44:24] roelof: apeiros: thanks, I think I need a break
[13:44:59] freerobby: has joined #ruby
[13:45:21] konsolebox: has joined #ruby
[13:45:55] hotpancakes: has joined #ruby
[13:46:53] inukshuk_: has joined #ruby
[13:48:42] aryaching: has joined #ruby
[13:50:07] uglybandersnatch: has joined #ruby
[13:51:42] nanoz: has joined #ruby
[13:52:23] hxegon: has joined #ruby
[13:53:16] hamed_r: has joined #ruby
[13:53:39] madgen: roelof: also that's now how you want to use inject it suffices to state the operation in the block eg. sum * number and the assignment back to sum is not necessary.
[13:54:14] madgen: >> (1..10).inject(1) { |sum, number| sum * number }
[13:54:34] benlovell: has joined #ruby
[13:55:07] hotpancakes: has joined #ruby
[13:55:37] dhollinger: has joined #ruby
[13:55:38] madgen: and even the argument to inject is optional as when you don't pass that argument, inject just initialises the accumulator to the first element in the list. In this case very conveniently 1, but for just doing a product it doesn't even have to be 1.
[13:57:20] aegis3121: has joined #ruby
[13:57:37] bkxd: has joined #ruby
[13:57:55] CloCkWeRX: has joined #ruby
[14:00:09] roshanavand: has joined #ruby
[14:00:17] GodFodder: has joined #ruby
[14:00:37] GodFodder: has joined #ruby
[14:00:55] quazimodo: has joined #ruby
[14:01:02] GodFodder: has joined #ruby
[14:01:32] GodFodder: has joined #ruby
[14:02:08] fexilal: has joined #ruby
[14:03:58] drewo: has joined #ruby
[14:05:15] idletask: has joined #ruby
[14:05:40] openstruct: has joined #ruby
[14:05:57] chouhoulis: has joined #ruby
[14:06:01] ChiefAlexander: has joined #ruby
[14:08:41] bry4n_: has joined #ruby
[14:09:32] krz: has joined #ruby
[14:10:51] stannard: has joined #ruby
[14:15:08] apeiros: madgen: they could even just do .inject(:*)
[14:19:20] madgen: I suggested that earlier it got lost I think
[14:20:26] Tref: has joined #ruby
[14:21:24] aryaching_: has joined #ruby
[14:22:54] wilbert: has joined #ruby
[14:23:28] Rubie: has joined #ruby
[14:29:20] Brando753: has joined #ruby
[14:30:02] VeryBewitching: has joined #ruby
[14:30:13] blandflakes: has joined #ruby
[14:31:27] rmulligan: has joined #ruby
[14:32:19] madgen: has joined #ruby
[14:32:37] hotpanca_: has joined #ruby
[14:32:44] Guest14434: has joined #ruby
[14:34:18] bry4n_: has joined #ruby
[14:36:39] siaW: has joined #ruby
[14:37:37] krz: has joined #ruby
[14:39:00] bkxd: has joined #ruby
[14:39:32] mdw: has joined #ruby
[14:40:56] yqt: has joined #ruby
[14:43:06] Es0teric: has joined #ruby
[14:45:34] ekinmur: has joined #ruby
[14:45:42] krz: has joined #ruby
[14:47:02] bkxd: has joined #ruby
[14:50:59] Guest6001: has joined #ruby
[14:51:59] b|ackwolf: has joined #ruby
[14:52:35] b|ackwolf: what is the common way to sandboxing dependencies these days?
[14:52:36] Devalo: has joined #ruby
[14:52:40] rippa: has joined #ruby
[14:53:21] apeiros: b|ackwolf: bundler
[14:53:46] FooMunki: has joined #ruby
[14:55:18] Devalo: has joined #ruby
[14:55:31] b|ackwolf: apeiros, for example; when I install rails, 4.2.1 (in vendor/bundle) and I try to create a new Rails application bundler tries to install dependencies again for that project.
[14:56:20] dvinciguerra__: has joined #ruby
[14:56:33] b|ackwolf: apeiros, how can I get rid of downloading the gems every time I run bundle exec rails new app_name ?
[14:56:34] stunder: has joined #ruby
[14:56:47] apeiros: b|ackwolf: I'm afk now, but I'm pretty sure it's somewhere in bundlers docs
[14:57:02] kies: has joined #ruby
[14:57:14] joonty: has joined #ruby
[14:57:15] b|ackwolf: apeiros, oh sorry, thanks for your mention.
[14:57:23] melter: has joined #ruby
[14:58:07] drewo: has joined #ruby
[14:59:08] DEac-: has joined #ruby
[14:59:40] twistedpixels: has joined #ruby
[14:59:54] karioleez: has joined #ruby
[14:59:58] djcp1: has joined #ruby
[15:00:48] sgambino: has joined #ruby
[15:08:22] FooMunki: has joined #ruby
[15:09:00] Rubie: has joined #ruby
[15:09:17] madgen: has joined #ruby
[15:10:45] skweek: has joined #ruby
[15:11:54] rkazak: has joined #ruby
[15:12:03] x77686d: has joined #ruby
[15:14:55] goodroot: has joined #ruby
[15:16:04] ekinmur: has joined #ruby
[15:16:21] phpwebdev: has joined #ruby
[15:19:20] platzhirsch: has left #ruby: ()
[15:19:28] krz: has joined #ruby
[15:20:17] polishdub: has joined #ruby
[15:23:47] x77686d: has joined #ruby
[15:25:35] rmulligan: has joined #ruby
[15:26:05] johnny56_: has joined #ruby
[15:26:14] mrgrieve1: has joined #ruby
[15:26:40] dopamean_: has joined #ruby
[15:27:16] riffraff_: has joined #ruby
[15:27:33] dikaio: has joined #ruby
[15:27:40] roshanavand: has joined #ruby
[15:28:11] davee_: has joined #ruby
[15:28:42] whippythellama: has joined #ruby
[15:30:53] dravine_: has joined #ruby
[15:31:59] FooMunki: has joined #ruby
[15:32:58] GitGud: has joined #ruby
[15:34:40] dikaio_: has joined #ruby
[15:35:56] wilbert: has joined #ruby
[15:36:04] dikaio_: has joined #ruby
[15:38:37] Maletor: has joined #ruby
[15:39:17] Devalo: has joined #ruby
[15:39:44] ssiris: has joined #ruby
[15:42:26] madgen: has joined #ruby
[15:42:44] torandu: has joined #ruby
[15:43:43] mistermocha: has joined #ruby
[15:44:22] freerobby: has joined #ruby
[15:44:51] KensoDev: has joined #ruby
[15:44:57] skade: has joined #ruby
[15:45:07] rkazak: has joined #ruby
[15:47:21] Kimm: has joined #ruby
[15:47:45] dc4: has joined #ruby
[15:47:54] bkxd: has joined #ruby
[15:49:07] gregf: has joined #ruby
[15:49:38] forest: has joined #ruby
[15:50:19] dmr8: has joined #ruby
[15:50:19] Kimm: Hi, I'm trying to use ruby c api, i'm trying to compile like so gcc call.c -o call -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/ but i get error `ruby.h:24:25: fatal error: ruby/config.h: No such file or directory`
[15:51:44] Gasher: has joined #ruby
[15:53:30] rbennacer: has joined #ruby
[15:53:37] howdoi: has joined #ruby
[15:53:50] pandaant: has joined #ruby
[15:55:01] benlieb: has joined #ruby
[15:55:07] rbennacer: has joined #ruby
[15:55:13] karioleez: has joined #ruby
[15:55:23] amclain: has joined #ruby
[15:55:55] benlieb: are "class instance variables" the same as "instance variables"
[15:55:59] diegoaguilar: has joined #ruby
[15:56:30] apeiros: benlieb: yes
[15:56:54] apeiros: it's just a fancy way to say that they're associated with an object whose class is Class (or Module)
[15:57:14] smathy: has joined #ruby
[15:57:47] machinewar: has joined #ruby
[15:57:48] bronson: has joined #ruby
[15:58:10] benlieb: gotcha, I guess most developers just say "instance variable", but a lot of blogs (being formal) use "class instance variable". I just wanted to make double sure
[15:58:10] shredding: has joined #ruby
[15:58:20] machinewar: anyone experienced using CSV setting headers: true. When I give it a afile with only one row (the headers) it doesn't recongnize them as headers
[15:58:26] Hanmac: has joined #ruby
[15:58:38] machinewar: has anyone seen this before / have a non-hacky solution (i.e. adding a fake row beneath)
[15:58:47] benlieb: I'm trying to make sure my rails app is thread safe, and it's kinda scary
[15:59:03] axl_: has joined #ruby
[15:59:43] karioleez: has joined #ruby
[15:59:49] workmad3_: has joined #ruby
[15:59:57] baweaver: has joined #ruby
[16:00:23] nanoz: has joined #ruby
[16:01:00] benlieb: apeiros: actually I'm still confused.
[16:01:04] mistermocha: has joined #ruby
[16:01:14] benlieb: I'm reading this article about thread safety: https://bearmetal.eu/theden/how-do-i-know-whether-my-rails-app-is-thread-safe-or-not/
[16:01:48] benlieb: There is a section called "Class instance variables" that says that "Class instance variables" can be not thread safe
[16:01:58] benlieb: "In this case, calling the layout method causes Rails to set the class instance variable @_layout for the controller class. If two concurrent requests (served by two threads) hit this code simultaneously, they might end up in a race condition and overwrite each others’ layout."
[16:02:42] benlieb: So it seems like class instance vars are set outside of a method, and a "instance" var isn't?
[16:02:44] mistermo_: has joined #ruby
[16:02:47] A124: has joined #ruby
[16:03:03] rkazak: has joined #ruby
[16:03:15] Kero: has joined #ruby
[16:03:39] hightower3: has joined #ruby
[16:05:33] rolha: has joined #ruby
[16:06:04] imperator: has joined #ruby
[16:06:10] stunder: has joined #ruby
[16:06:38] imperator: good morning
[16:07:15] TomyLobo: has joined #ruby
[16:09:28] mistermocha: has joined #ruby
[16:09:51] graywh: has joined #ruby
[16:10:08] imperator: anyone know how to parse an iso 8601 interval string into a Ruby object?
[16:10:13] smathy: has joined #ruby
[16:10:14] imperator: e.g. "P10675199DT2H48M5.4775807S"
[16:10:16] graywh: has left #ruby: ()
[16:10:40] imperator: is there a core/stdlib method out there somewhere i'm missing?
[16:11:46] n008f4g_: has joined #ruby
[16:12:20] benlovell: has joined #ruby
[16:12:24] Frem: has joined #ruby
[16:13:18] Don_John: has joined #ruby
[16:13:22] Xeago: has joined #ruby
[16:13:37] symm-: has joined #ruby
[16:14:18] cjbottaro: has joined #ruby
[16:15:16] nando293921: has joined #ruby
[16:15:50] djcp1: has joined #ruby
[16:17:48] bhaak: has joined #ruby
[16:18:49] tristanp_: has joined #ruby
[16:19:44] rmulligan: has joined #ruby
[16:20:25] Miron: has joined #ruby
[16:21:31] marxarelli: has joined #ruby
[16:22:15] sgambino: has joined #ruby
[16:22:35] merida: has joined #ruby
[16:22:49] poguez_: has joined #ruby
[16:23:19] chouhoulis: has joined #ruby
[16:24:45] benlovell: has joined #ruby
[16:26:38] whippythellama: has joined #ruby
[16:27:54] User458764: has joined #ruby
[16:28:11] Mon_Ouie: has joined #ruby
[16:30:10] hxegon: has joined #ruby
[16:30:25] shevy: I think there is not
[16:31:15] LaT0rtue: has joined #ruby
[16:31:55] zast: has joined #ruby
[16:32:07] Rubie: has joined #ruby
[16:32:16] drewo: has joined #ruby
[16:32:57] freerobby: has joined #ruby
[16:33:54] freerobby1: has joined #ruby
[16:34:07] merida: has joined #ruby
[16:34:42] darix: imperator: that's not correct iso date no?
[16:35:11] darix: that would be more in the line of 2016-03-31T16:35:04+00:00
[16:37:28] hightower2: has joined #ruby
[16:37:57] thomashaw: has joined #ruby
[16:40:29] tristanp: has joined #ruby
[16:40:38] cwong_on_irc: has joined #ruby
[16:40:39] ruby[bot]: +b cwong_on_irc*!*@*$#ruby-fix-your-connection
[16:40:40] ruby[bot]: ruby[bot] kicked cwong_on_irc: banned before
[16:41:32] benlieb: apeiros: I may have misunderstood you before, but on further reading it appears that "class instance variables" are definitely not the same as "instance variables".
[16:41:49] Spami_: has joined #ruby
[16:42:01] tristanp: has joined #ruby
[16:42:08] apeiros: benlieb: sorry, missed your earlier ping
[16:42:25] apeiros: benlieb: no, you didn't misunderstand me. class *instance* variables are definitively the same as instance variables
[16:42:43] apeiros: class variables are something different, though. @@class_variables, @instance_variables.
[16:42:58] apeiros: darix: he's talking about interval, not time. that's also specified by iso8601
[16:43:08] djbkd: has joined #ruby
[16:43:30] zapata: has joined #ruby
[16:43:39] benlovell: has joined #ruby
[16:44:15] apeiros: benlieb: I think "class instance variables can't be thread-safe" is a mischaracterization. I won't read the full article, but it's all about what they say at the start: it matters whether you share mutable state or not.
[16:44:30] benlieb: From this article (http://thoughts.codegram.com/understanding-class-instance-variables-in-ruby/) He explains that there class vars @@var, instance vars @var defined in method, and class instance vars, @var defined in class body outside of method, and only accessible from class methods
[16:44:34] apeiros: and as it is in ruby, you can share *all* variable types across threads, even local variables.
[16:45:08] apeiros: benlieb: yeah, "class methods" is again, just a fancy term for "instance methods on the object's singleton_class"
[16:45:23] apeiros: there's only one kind of methods in ruby, and that's instance methods.
[16:46:04] apeiros: it's just more convenient to say "class method". and it's widely understood what is meant. even though sadly many rubyists miss the technical background.
[16:49:26] imperator: darix, is it not correct? quite possible, this is coming from MS
[16:50:13] B1n4r10: has joined #ruby
[16:50:59] Spami: has joined #ruby
[16:51:14] ChiefAlexander: has joined #ruby
[16:51:26] agit0: has joined #ruby
[16:53:16] Spami_: has joined #ruby
[16:53:30] imperator: apeiros, yes :)
[16:53:44] barajasfab: has joined #ruby
[16:53:44] m4dfry: has joined #ruby
[16:55:46] davedev24: has joined #ruby
[16:56:21] CausaMortis: has joined #ruby
[16:57:14] SCHAAP137: has joined #ruby
[16:57:39] IrishGringo: has joined #ruby
[16:57:55] imperator: well, i did find the iso8601 gem, which has ISO8601::Duration and seems to parse it properly
[17:00:52] tristanp_: has joined #ruby
[17:01:16] finisherr: has joined #ruby
[17:01:39] sepp2k1: has joined #ruby
[17:03:14] stannard_: has joined #ruby
[17:03:40] mjc_: has joined #ruby
[17:05:38] KensoDev: has joined #ruby
[17:06:06] dionysus69: has joined #ruby
[17:07:12] vF3hNGxc47h8: has joined #ruby
[17:08:23] Xeago: has joined #ruby
[17:09:12] karioleez: has joined #ruby
[17:09:13] merida_: has joined #ruby
[17:09:23] shevy: apeiros well "class method" is a lot shorter to write than "instance method on the object's singleton_class" - and you may have to explain what a singleton_class is in addition to that in a discussion :-)
[17:09:25] choke: has joined #ruby
[17:09:47] ramfjord: has joined #ruby
[17:09:58] agit0: has joined #ruby
[17:10:26] loc22: has joined #ruby
[17:10:26] apeiros: shevy: I trust in their ability to `ri singleton_class`
[17:10:38] apeiros: and alternatively in their ability to ask follow-up questions
[17:11:20] priodev: has joined #ruby
[17:11:29] fragtastic: has joined #ruby
[17:11:29] Zarthus_: i'm not sure if my brain is having a day off or not, I'm trying to default a value if it is not set, my IDE is complaining that this always evaluates to true: myvar = config['item'] || true -- it is probably right, but I find the alternative of config['item'].nil? ? true : config['item'] longwinded, surely there is a better way I'm just unable to think of right now?
[17:11:41] Spami: has joined #ruby
[17:12:03] Kero: has joined #ruby
[17:13:53] rmulligan: has joined #ruby
[17:14:07] rcvalle: has joined #ruby
[17:14:15] sneakerhax: has joined #ruby
[17:14:31] shinnya: has joined #ruby
[17:14:39] shevy: Zarthus_ well it evaluates to true right? because one argument will always be true
[17:14:53] Zarthus: yeah, I want it to be the first one if it is set at all
[17:15:22] Zarthus: the default value should be true, but whenever the config item is made in a yaml file, it should be that value.
[17:15:54] djellemah: Zarthus_: That expression only evaluates to true when config['item'] is nil (or config['item'] is true). Which is what you want.
[17:16:24] shevy: when will it not be true?
[17:16:43] Zarthus: when the user's value in the yaml file is false, or any string
[17:16:56] Zarthus: (but the latter won't be a case)
[17:16:56] wilbert: has joined #ruby
[17:17:03] shevy: no I mean
[17:17:05] shevy: in the evaluation
[17:17:17] shevy: I can't seem to find a result where it will be false
[17:17:32] Zarthus: config['item'] is loaded from a yaml file, so it's user edited
[17:17:56] Zarthus: it may essentially be anything (but it'd be pebcak if they fill in a non-boolean value)
[17:18:06] Zarthus: when that value is not in the yaml file though, it should default to true.
[17:18:08] shevy: I mean the myvar = config['item'] || true
[17:19:35] Zarthus: does this help describe my problem? https://eval.in/545826
[17:19:53] Zarthus: i'm looking for something that would make for better-readable code than the last case
[17:20:17] Zarthus: Some of the YAML items go pretty deep, and you'd be reading much of the same code essentially.
[17:21:17] Zarthus: and the only solution I seem to be thinking of is to make a method that accepts an item and does it behind the scenes, but this is ruby - surely there's something I'm missing to make my life easier (like a strict null coalising operator)
[17:21:52] hxegon: has joined #ruby
[17:22:25] ocbtec: has joined #ruby
[17:23:22] shevy: Zarthus I haven't been able to go to that part, I am still pondering about what djellemah wrote ;)
[17:23:23] Cohedrin: has joined #ruby
[17:23:43] shevy: what I do in my projects is to usually sanitize the configuration dataset
[17:23:58] Zarthus: i'm not very worried about sanitizing of the data
[17:23:59] shevy: like I can do "use_colours: t" and it'll become "yes we will use colours"
[17:24:35] Cohedrin: has joined #ruby
[17:24:46] shevy: Zarthus can you set a state of default values?
[17:24:51] shevy: and then load up the configuration?
[17:24:53] Zarthus: the defaults that the user will copy (example.config.yaml) will contain all values with predefined values, and there's documentation of what each item expects. If they go and fill in a string where a boolean previously was, they're just dummies.
[17:25:09] Zarthus: shevy: sorta, I'd prefer not to. I'm aware of ||=
[17:25:27] Kimm: Hi, I'm trying to use ruby c api, i'm trying to compile like so gcc call.c -o call -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/ but i get error `ruby.h:24:25: fatal error: ruby/config.h: No such file or directory`
[17:26:18] roelof: has joined #ruby
[17:26:18] Zarthus: in all fairness the once innocent configuration.rb is becoming a bit big right now, but this should be the last edit I make to it and I'm not in the mood of refactoring :)
[17:26:30] Zarthus: famous last words, anyways.
[17:26:45] shevy: I have all sort of different size ranges for config values... lemme count
[17:27:22] roelof: Can anyone help me with this problem : https://gist.github.com/rwobben/3700b514db89aba2b8d583acf717f32a
[17:27:26] shevy: ah... rbt has 61 entries... diashell 57, but these are the upper ranges. I guess the project average I have is 2-4
[17:27:53] karioleez: has joined #ruby
[17:27:55] Spami: has joined #ruby
[17:28:37] bronson: has joined #ruby
[17:29:17] sudoubuntu: has joined #ruby
[17:30:40] rmulligan: has joined #ruby
[17:31:21] workmad3: has joined #ruby
[17:33:24] jenrzzz: has joined #ruby
[17:33:39] jenrzzz: has joined #ruby
[17:33:46] bkxd: has joined #ruby
[17:34:10] GitGud: has joined #ruby
[17:34:36] smathy: roelof, gty vs qty
[17:36:06] sorbo_: has joined #ruby
[17:36:15] sudoubuntu: has joined #ruby
[17:36:55] n008f4g_: has joined #ruby
[17:37:40] LowLifePerv: has joined #ruby
[17:38:03] drbrain: has joined #ruby
[17:39:30] edwinvdgraaf: has joined #ruby
[17:39:31] shevy: hah good catch
[17:40:26] Cyrus: has joined #ruby
[17:41:34] tildes: has joined #ruby
[17:42:27] baweaver: has joined #ruby
[17:42:31] smathy: Copy, find, paste - I didn't do much.
[17:42:50] Sammichmaker: has joined #ruby
[17:42:59] jrafanie: has joined #ruby
[17:43:26] thoraxe: is there a way with haml to set the heading depth programmatically?
[17:43:33] thoraxe: %h#{varname} doesn't seem to work
[17:43:39] borodin: has joined #ruby
[17:43:41] thoraxe: at least not buried in asciidoctor
[17:44:24] borodin: guys I have rbenv installed using puppet on a centos box. Root's ruby is /opt/rbenv/shims/ruby but a regular user's ruby is /usr/bin/ruby
[17:44:34] borodin: how do I get all regular users to have the rbenv ruby?
[17:44:57] borodin: when I try to execute /optrbenv/shims/ruby as a regular user, I get permission denied
[17:45:09] djbkd: has joined #ruby
[17:45:16] AlexRussia: has joined #ruby
[17:45:55] jason^: has joined #ruby
[17:46:12] karioleez: has joined #ruby
[17:47:12] mdw: has joined #ruby
[17:47:24] User458764: has joined #ruby
[17:47:38] Rubie: has joined #ruby
[17:48:01] mdw: has joined #ruby
[17:48:08] jason^: is there a way to return multiple objects within a array.map?
[17:48:09] freerobby: has joined #ruby
[17:48:42] apeiros: jason^: as always - by returning an array
[17:49:05] jason^: then it ends up being [a,b,c,[d,e,f]]
[17:50:56] jason^: i'd rather it be a,b,c,d,e,f so it's not nested
[17:51:10] apeiros: then write the code accordingly
[17:51:19] apeiros: from map alone it won't end up as [a,,
[17:51:25] apeiros: whoops, premature enter
[17:51:33] roelof: thanks, it's not my day today with coding
[17:51:33] jason^: yeah i can write around it
[17:51:34] apeiros: from map alone it won't end up as [a,b,c,[d,e,f]]
[17:51:50] apeiros: so if you get that, you're leaving out something.
[17:51:56] Spami_: has joined #ruby
[17:51:59] uglybandersnatch: has joined #ruby
[17:52:13] iy: has joined #ruby
[17:52:24] apeiros: anyway, I think:
[17:52:27] apeiros: ?code jason^
[17:52:28] ruby[bot]: jason^: We can't help you without your code, please post it to https://gist.github.com
[17:53:00] smathy: thoraxe, you'll have to use `= content_tag "h#{varname}"...
[17:55:45] alexherbo2: has joined #ruby
[17:55:51] juanfra: has joined #ruby
[17:55:55] djbkd: has joined #ruby
[17:56:47] dopie: has joined #ruby
[17:57:18] jason^: apeiros: https://gist.github.com/jcarr/8cb3500091b9f72dac44d928ff5323e8
[17:57:49] apeiros: jason^: always return an array and use flat_map
[17:58:11] kellabyte: has joined #ruby
[17:58:16] smathy: thoraxe, which you could, of course, make into your own helper method, but don't call it `h` :)
[17:58:53] kellabyte: I'm trying to use %Q() to run a curl command that works on the command line but I'm getting this error, any thoughts? I feel like I'm doing something really dumb somewhere: https://gist.github.com/kellabyte/84235c207df7c53c0ac9cec05b26cf04
[17:59:01] jason^: apeiros: never knew flat_map existed
[17:59:23] jenrzzz: has joined #ruby
[17:59:23] jenrzzz: has joined #ruby
[17:59:36] jason^: thank you ;)
[18:00:19] smathy: kellabyte, you don't have a |
[18:00:41] kellabyte: smathy: I'm not sure what you mean?
[18:01:08] baweaver: has joined #ruby
[18:01:19] aegis3121: has joined #ruby
[18:01:29] thoraxe: smathy: ah ok. there's also haml_tag
[18:01:34] thoraxe: but i will look at content_tag that might work better for me
[18:01:56] smathy: kellabyte, read the Kernel#open docs. You're telling ruby to open a file with that string as a name.
[18:02:02] thoraxe: is content_tag a rails thing? I'm not using rails.
[18:02:16] kellabyte: smathy: I have other curl commands working fine though, not sure why this specific one isn't
[18:02:36] dopie: has joined #ruby
[18:03:10] djellemah: shevy: you're right, I didn't think of the case where config['item'] => false
[18:03:17] djellemah: >> [{'item' => 42}, {'item' => true}, {'item' => false}, {'item' => nil}, {}].map{|config| config['item'] || true}
[18:03:19] ruby[bot]: djellemah: # => [42, true, true, true, true] (https://eval.in/545841)
[18:03:55] karioleez: has joined #ruby
[18:04:19] stannard: has joined #ruby
[18:04:51] skweek: has joined #ruby
[18:05:14] rubie_: has joined #ruby
[18:05:40] smathy: kellabyte, I couldn't say why the others are working, you must be doing something differently there.
[18:05:55] chouhoul_: has joined #ruby
[18:06:16] kellabyte: where does the | go? I'm new to ruby so trying to interpret what you're telling me
[18:06:23] smathy: thoraxe, ah, yes it is. Sorry, I thought I was in #ror. Yeah, haml_tag then.
[18:06:50] smathy: kellabyte, the Kernel#open docs are pretty clear. Which part didn't you understand?
[18:07:26] smathy: kellabyte, I realized you were new to Ruby, because you're shelling out to curl :)
[18:07:46] roelof: has joined #ruby
[18:07:50] kellabyte: fair point :P
[18:07:52] imperator: has left #ruby: ("Leaving")
[18:08:17] DoubleMalt: has joined #ruby
[18:08:26] smathy: Props for finding %Q - most people spend a long time in backslash hell.
[18:08:42] kellabyte: I mostly found it because it was already in the code base lol
[18:09:11] roelof: hopefully the last question for today . Why do I not see the quantity here : https://gist.github.com/rwobben/5c81ca3f8d29bf18293ab9c6b26ef690
[18:09:27] smathy: Oh, ok. You should take a look at %x btw, but it'd also be good to solve this method before moving on.
[18:09:57] smathy: roelof, FFS, for the same reason I mentioned that was causing your other problem.
[18:10:08] smathy: [11:34:35] smathy: roelof, gty vs qty
[18:10:12] kellabyte: smathy: yeah, I like to learn my mistakes before going down an alternative route and then not learning what I did wrong
[18:10:53] roelof: oke, I will look for new glasses :(
[18:11:16] smathy: roelof, or, y'know, copy paste into a find.
[18:11:16] dvinciguerra: has joined #ruby
[18:11:39] smathy: OSX has a nice zoom feature.
[18:11:43] kellabyte: ok read the docs, clear about | but thats strange that the other curl commands work without it
[18:11:53] smathy: Also, maybe you need a different font in your editor.
[18:11:59] djellemah: Kimm: You'll needs another -I something like -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/x86_64-linux
[18:12:13] abyx: has joined #ruby
[18:12:16] smathy: kellabyte, if you want to add them to your gist I'll explain your confusion.
[18:12:53] kellabyte: sweet, sure :) I have to obfuscate the exact url details for business purposes
[18:13:22] baweaver: has joined #ruby
[18:14:45] smathy: kellabyte, yeah, the URL isn't important.
[18:15:22] Xeago: has joined #ruby
[18:15:31] tristanp: has joined #ruby
[18:15:40] blandflakes: has joined #ruby
[18:16:13] moeabdol1: has joined #ruby
[18:17:28] kellabyte: smathy: https://gist.github.com/kellabyte/84235c207df7c53c0ac9cec05b26cf04
[18:17:30] stannard: has joined #ruby
[18:17:33] cdg: has joined #ruby
[18:18:17] jdawgaz: has joined #ruby
[18:18:31] mburns: has joined #ruby
[18:18:45] adamsilver: has joined #ruby
[18:18:46] Outlastsheep: has joined #ruby
[18:18:54] jenrzzz: has joined #ruby
[18:18:54] jenrzzz: has joined #ruby
[18:19:25] Success: has joined #ruby
[18:19:29] adamsilver: HI guys, new to Ruby. Which application server I should be using here: http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine
[18:20:04] drewo: has joined #ruby
[18:20:49] jtoy: has joined #ruby
[18:21:16] baweaver: kellabyte: oh hey, didn't know you were on irc
[18:21:38] baweaver: (keystonelemur on twitter)
[18:21:54] karioleez: has joined #ruby
[18:22:01] krz: has joined #ruby
[18:22:15] mikecmpbll: has joined #ruby
[18:22:26] havenwood: adamsilver: What you linked shows Nginx as a reverse proxy to the Thin rack webserver.
[18:22:35] smathy: kellabyte, that first line is opening a file, not a command.
[18:22:58] smathy: kellabyte, oh, wait, `source` is a URL prefix.
[18:22:59] havenwood: adamsilver: Say more about what you're wanting to know?
[18:23:34] smathy: kellabyte, so that first one is opening a URL not a full `curl` command.
[18:23:41] kellabyte: ok let me show another example
[18:23:45] baweaver: Would Net::HTTP not work for this? At least for running a system command, why not use backticks?
[18:24:18] smathy: kellabyte, that works because of open-uri, you'll be `require "open-uri"` somewhere in your code, which mixes this into Kernel#open: http://ruby-doc.org/stdlib-2.3.0/libdoc/open-uri/rdoc/OpenURI.html
[18:24:19] baweaver: or system, or %x, or .... ok, maybe we have a lot of those.
[18:24:33] baweaver: smathy: TIL
[18:24:58] smathy: baweaver, yeah, already talking about backticks, but she (admirably) wants to understand why one open works and the other doesn't.
[18:24:59] kellabyte: smathy: oh I see, interesting. what about this second example? https://gist.github.com/kellabyte/84235c207df7c53c0ac9cec05b26cf04
[18:25:25] baweaver: yeah, I was scratching my head on why that worked myself
[18:25:46] smathy: kellabyte, nope, that `status = ` line doesn't work, maybe it's %x instead of %Q ?
[18:25:57] borodin: I installed rbenv using puppet-rbenv module, but ruby is still the ols system ruby for regular users. Does anyone know what could be wrong or how to troubleshoot?
[18:26:00] baweaver: https://simpleror.wordpress.com/2009/03/15/q-q-w-w-x-r-s/
[18:26:07] smathy: kellabyte, well, it works, but it doesn't do anything - just assigns a string to a variable.
[18:26:39] rmulligan: has joined #ruby
[18:26:43] thoraxe: so, using haml_tag inside a haml document seems to be giving me grief
[18:26:48] thoraxe: http://www.rubydoc.info/github/haml/haml/Haml%2FHelpers%3Ahaml_tag
[18:26:50] kellabyte: smathy: sorry there's an open() there too, I forgot to paste that
[18:27:01] smathy: baweaver, I'm not, for even a second, recommending using open-uri, I think it's such a PHP-esque API.
[18:27:24] baweaver: yeah, fair. I just didn't reconcile how in the world that worked
[18:27:40] baweaver: thoraxe: Might check #RubyOnRails
[18:27:42] smathy: kellabyte, copy and paste exactly what's there, then you can remove the sensitive things.
[18:27:55] smathy: baweaver, thoraxe isn't using Rails, pure haml.
[18:28:12] baweaver: ACTION is off to a bad start today
[18:28:37] IrishGringo: has joined #ruby
[18:29:01] x77686d: has joined #ruby
[18:30:01] shevy: this is not a good day for beavers it seems
[18:30:32] codecop_: has joined #ruby
[18:30:43] baweaver: http://www.sitepoint.com/ruby-net-http-library/ - that covers a good amount on Net::HTTP
[18:31:37] Dimik: has joined #ruby
[18:31:39] baweaver: anyways, off I go
[18:32:17] havenwood: I've been enjoying using HTTP.rb: https://github.com/httprb/http
[18:32:29] adamsilver: has joined #ruby
[18:32:35] adamsilver: havenwood: I want to install Redmine on production
[18:32:52] blackjid: has joined #ruby
[18:33:00] shevy: there is so much on github related to ruby that I don't know
[18:33:20] symm-: has joined #ruby
[18:33:36] miah: endless amounts of code on github really
[18:34:10] havenwood: shevy: Must. Read. All the code!
[18:34:26] shevy: I believe that :)
[18:35:55] shredding: has joined #ruby
[18:40:07] karioleez: has joined #ruby
[18:41:26] the_drow: has joined #ruby
[18:41:39] zeroDivisible: has joined #ruby
[18:42:07] kellabyte: smathy: ooooh I see the difference, some do an IO.open
[18:42:13] sorbo_: has joined #ruby
[18:42:36] bphogan: has joined #ruby
[18:44:45] shadoi: has joined #ruby
[18:45:56] djbkd_: has joined #ruby
[18:46:42] Polysics_: has joined #ruby
[18:47:19] eam: does irb have anything like binding.pry to drop back to a prompt?
[18:47:47] vikaton: has joined #ruby
[18:48:21] eam: (obviously pry is ideal but I was just in an environment without it)
[18:49:31] adaedra: I think there's IRB.start, but this does not use current context
[18:49:53] ur5us: has joined #ruby
[18:49:55] eam: yeah that blows up if you're already in an irb
[18:50:39] apeiros: eam: I think I released irb_drop as a gem
[18:50:56] apeiros: if not, should be easy to find
[18:51:11] eam: apeiros: nice! but, damn, if it's a gem I can just install pry :D
[18:51:12] kellabyte: in ruby how can I check something["foo"]["bar"][0]["baz"]["foo"] exists before trying to access it and crash?
[18:51:24] apeiros: eam: it's ~10 lines of code
[18:51:25] apeiros: https://github.com/apeiros/irb_drop
[18:51:26] kellabyte: I know in ruby you can check that without having to check each level right?
[18:51:32] Papierkorb: kellabyte: See Hash#dig
[18:51:32] eam: aha, looks like the magic is ARGV stuff - apeiros thx
[18:51:33] adaedra: &ri Array#dig kellabyte
[18:51:33] `derpy: kellabyte: http://ruby-doc.org/core-2.3.0/Array.html#method-i-dig
[18:51:37] Papierkorb: kellabyte: Part of Ruby2.3
[18:51:40] apeiros: but IMO yeah, just use pry
[18:51:42] apeiros: irb is horrible :)
[18:51:44] adaedra: or Hash, but it's the same
[18:51:53] Musashi007: has joined #ruby
[18:52:30] apeiros: eam: ah, hehe, the code comments are gold
[18:52:37] apeiros: # IRB is being stupid (it processes ARGV, destroying it in the process)
[18:52:42] rbennacer: has joined #ruby
[18:53:34] eam: kellabyte: you can also just do something[:foo][:bar} rescue nil
[18:54:02] eam: let it raise, let it raise
[18:54:06] shevy: hah cool that irb_drop gem
[18:54:37] adaedra: eam: typo aside, ewwww.
[18:54:50] eam: adaedra: it's fine, don't worry about it. it's ... fine
[18:55:30] kellabyte: can I mix dig with keys and array locations too?
[18:55:38] Papierkorb: kellabyte: Yes.
[18:56:16] eam: should work with any object that implements #dig yeah?
[18:56:17] aegis3121: has joined #ruby
[18:56:18] adaedra: Hash#dig and Array#dig call #dig on the next object each time if they respond to it.
[18:56:44] jdawgaz: has joined #ruby
[18:56:58] adaedra: >> class Blackhole; def dig(*); self; end; end; [Blackhole.new].dig(0, 1, 2, 3, 4)
[18:56:59] ruby[bot]: adaedra: # => #<Blackhole:0x40f658d4> (https://eval.in/545855)
[18:57:31] jackjackdripper: has joined #ruby
[19:02:47] Xeago: has joined #ruby
[19:03:49] karioleez: has joined #ruby
[19:04:53] cpruitt: has joined #ruby
[19:06:57] sarbs: has joined #ruby
[19:07:25] shevy: the undertaker
[19:08:13] baweaver: has joined #ruby
[19:08:40] jackjackdripper: has joined #ruby
[19:09:10] Kimm: undefined reference to `rb_require' when using ruby c api, what is the ruby library name?
[19:09:13] adaedra: ?rimshot havenwood
[19:09:13] ruby[bot]: havenwood: Badum-Tshh! https://www.youtube.com/watch?v=oShTJ90fC34
[19:10:28] Acontius: has joined #ruby
[19:13:40] dn`: has joined #ruby
[19:14:03] kobain: has joined #ruby
[19:14:08] dc4: has joined #ruby
[19:16:50] nikger: has joined #ruby
[19:16:57] sandstrom: has joined #ruby
[19:17:51] sergey_makagon: has joined #ruby
[19:19:44] yqt: has joined #ruby
[19:21:46] madgen: has joined #ruby
[19:22:06] Cohedrin_: has joined #ruby
[19:22:06] krz: has joined #ruby
[19:23:24] Cohedrin_: has joined #ruby
[19:23:44] symm-: has joined #ruby
[19:24:35] mdw7: has joined #ruby
[19:24:37] ramfjord: has joined #ruby
[19:25:07] BSaboia: has joined #ruby
[19:27:23] yfeldblum: has joined #ruby
[19:27:43] moss: has joined #ruby
[19:28:16] mdw: has joined #ruby
[19:28:34] Kimm: rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) "test.rb", &error); //causes segfault, anyone had this problem?
[19:28:55] jdawgaz: has joined #ruby
[19:29:14] bronson: has joined #ruby
[19:31:07] Ox0dea: Kimm: You can't just cast a char * to VALUE like that.
[19:31:19] sudoubuntu: has joined #ruby
[19:31:26] Kimm: I forgot to ruby_init()
[19:31:46] spider-mario: has joined #ruby
[19:34:21] bkxd: has joined #ruby
[19:36:25] moss: hi. i'm trying to do the following and am having trouble getting started: find directory names located at /sys/class/net/* - for every directory name, get the value of /sys/class/net/{dirname}/operstate, if the value is up, check /etc/sysconfig/network-scripts/ifcfg-{dirname} for the string 'BOOTPROTO="dhcp"' - if it exists, return true.
[19:36:26] jenrzzz: has joined #ruby
[19:36:34] stannard: has joined #ruby
[19:36:38] moss: If anyone's willing to help me get started with this, I'd appreciate it
[19:36:39] sergey_makagon: has joined #ruby
[19:38:12] Papierkorb: moss: See Dir#glob for finding the folders, File.exist? to check for the file (Or Pathname#file?), File.read or Pathname#read to read the file, Pathname#dir? for the network-scripts stuff, and Array#grep for the "contains this string" stuff
[19:39:02] Papierkorb: moss: I think using Pathname() is much nicer on the long run when dealing with path magic and files/directories, but you can also use File.exist? and friends if you like them more
[19:39:22] moss: Papierkorb: Thank you
[19:39:26] moss: I will look into this
[19:39:33] moss: This is all for puppet facter..
[19:41:05] moss: Papierkorb: won't Dir.glob return all the files in that folder?
[19:42:16] Papierkorb: moss: Nope, .glob works like in bash
[19:42:54] baweaver: has joined #ruby
[19:43:01] Papierkorb: moss: You can also write Dir['foo/bar*'] instead of Dir.glob('foo/bar*') ;)
[19:45:06] lemur: has joined #ruby
[19:46:42] djbkd_: has joined #ruby
[19:46:48] Aviio: has joined #ruby
[19:46:48] sarbs: has joined #ruby
[19:47:44] bphogan: has left #ruby: ()
[19:47:52] moss: Papierkorb: the problem is that I need ruby to find the names of the directories and edit files based on the name of the directory
[19:47:54] CausaMortis: has joined #ruby
[19:48:08] Aviio: has joined #ruby
[19:48:10] moss: so how do i include a variable in File.open?
[19:48:24] pawnbox: has joined #ruby
[19:48:46] moss: or File.read
[19:49:21] stunder: has joined #ruby
[19:49:59] sigurding: has joined #ruby
[19:50:10] tvon: has joined #ruby
[19:50:19] snowy: has joined #ruby
[19:50:46] Kimm: If anyone mind please take a look at this https://gist.github.com/anonymous/d0d539c1249e073a3b4b427c789fa7d5, error im having when calling a ruby function from c
[19:50:55] majuscule: how can i use a hash in an erb template?
[19:51:03] Papierkorb: moss: Are you new to ruby?
[19:51:13] moss: Papierkorb: yes, very
[19:51:16] moss: new to ruby, programming in general
[19:52:18] majuscule: ahh you just need to use :key instead of 'key'
[19:52:23] Papierkorb: moss: Claims to take 20mins, but gets you started: https://www.ruby-lang.org/en/documentation/quickstart/
[19:53:18] moss: Great :)
[19:55:03] Ox0dea: Kimm: rb_require("./e.rb");
[19:55:05] diegoviola: has joined #ruby
[19:56:29] Ox0dea: `require` searches $LOAD_PATH, which doesn't contain the current working directory by default.
[19:56:46] dvinciguerra: has joined #ruby
[19:56:52] mdelgadonyc: has joined #ruby
[19:58:13] sarbs: has joined #ruby
[19:59:17] hahuang61: has joined #ruby
[19:59:35] Rubie: has joined #ruby
[19:59:43] rkazak: has joined #ruby
[20:00:07] KensoDev: has joined #ruby
[20:01:55] hahuang65: has joined #ruby
[20:05:01] sarbs: has joined #ruby
[20:06:20] Kimm: Thanks Ox0dea, I get different segfault now https://gist.github.com/anonymous/34c71e7ef6bd385485042319918161fa
[20:07:53] benlovell: has joined #ruby
[20:11:48] Ox0dea: Kimm: `obj` is uninitialized.
[20:11:50] Hanmac: Kimm did you maybe forgot to set obj ?
[20:12:37] agit0_: has joined #ruby
[20:13:04] sarbs: has joined #ruby
[20:15:28] kith: has joined #ruby
[20:15:44] MaienM: has joined #ruby
[20:17:30] dex7: has joined #ruby
[20:17:37] majuscule: How can I use .map(&method:foo), where foo is a method of the objects being mapped over?
[20:18:15] Ox0dea: majuscule: You just say `map(&:foo)`.
[20:18:22] kirun: has joined #ruby
[20:18:27] majuscule: ahh perfect
[20:18:31] Ox0dea: Sure thing.
[20:18:34] Kimm: Intialize obj to what? I followed https://silverhammermba.github.io/emberb/c/ "Send" section
[20:19:13] Ox0dea: Kimm: Anything, really. Top-level method definitions become private instance methods on Object, so you just need to initialize `obj` to *some* Ruby value.
[20:20:22] cdg: has joined #ruby
[20:20:48] dtzuzu: has joined #ruby
[20:22:52] cdg: has joined #ruby
[20:22:53] n008f4g_: has joined #ruby
[20:23:12] Kimm: obj=rb_str_new_cstr(""); // this is ok?
[20:23:17] Kimm: I still get the error
[20:23:24] Ox0deb: Ox0dea: I'm one upping you
[20:23:53] Spami_: has joined #ruby
[20:25:19] snowy: has joined #ruby
[20:25:59] Ox0dea: Kimm: That has to happen after ruby_init().
[20:26:30] LHdez: has joined #ruby
[20:27:37] Kimm: https://gist.github.com/anonymous/1c02584a32620b335d6199ccedb5a23f
[20:28:13] Ox0dea: Works fine here. :/
[20:28:48] Kimm: Wow, thats scary then :)
[20:30:18] Kimm: maybe i compile it wrong
[20:30:24] sorbo_: has joined #ruby
[20:30:25] alsu: has joined #ruby
[20:30:27] Kimm: gcc e.c -o e.out -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/x86_64-linux -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0 -L/home/wh/.rbenv/versions/2.1.6/lib/ -lruby-static -lm -pthread -lcrypt -ldl
[20:30:39] alsu: does this encoding error make sense to anyone? https://gist.github.com/anonymous/1199866ce36dbc4185c74715a80318fe
[20:30:42] Hanmac: man i wanted to test it on evalin but it does say: "fatal error: ruby.h: No such file or directory" ;P
[20:30:45] Kimm: -rdynamic
[20:31:22] alsu: ruby seems to accept it as UTF-8, but the JSON serializer can’t handle it
[20:32:00] alsu: YAML does fine, but I need JSON
[20:35:23] GodFather: has joined #ruby
[20:36:10] nando293921: has joined #ruby
[20:37:16] Radar: alsu: "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').force_encoding('UTF-8').to_json
[20:37:26] alsu: Radar: yes but why
[20:37:44] Radar: "\xE0\xA4\xB8".to_json
[20:37:46] Radar: Works on my machine
[20:37:53] pawnbox: has joined #ruby
[20:37:55] Radar: I don't know why you're doing this force_encoding dance at all.
[20:38:00] alsu: Radar: this is burried deep in a nested dictionary, I’d rather not scrub all the values
[20:38:15] Radar: Where did I say anything about scrubbing? It works on my machine
[20:38:19] Radar: please provide an example which does not work
[20:38:28] darix: alsu: it might depend on your locale
[20:38:32] alsu: Radar: "\xE0\xA4\xB8".force_encoding('ASCII-8BIT') is what I’ve got burried in this dictionary. that came from the JSON parser, actually
[20:39:03] alsu: or, maybe the YAML parser. I forget.
[20:40:04] uglybandersnatch: has joined #ruby
[20:41:01] Radar: Show me code which I can use to reproduce a valid issue on my machine and then I can take a look
[20:41:05] Radar: until then it's just guessing
[20:43:25] freerobby: has joined #ruby
[20:44:51] djbkd: has joined #ruby
[20:47:01] smathy: alsu, force_encoding just changes the encoding flag of the string, so "a utf-8 string".force_encoding("anything you like").force_encoding("utf-8") will always be valid, because you've not changed the string, just changed the encoding flag to something else, and then (back) to UTF-8.
[20:47:26] djbkd_: has joined #ruby
[20:47:33] alsu: smathy: but the enoding is valid, according to “valid_encoding?”
[20:47:50] alsu: smathy: so why can’t the JSON serializer convert it?
[20:47:51] smathy: alsu, right, because by the time you're calling that, you're calling it on a UTF-8 string.
[20:48:24] majuscule: how can i force a hash to be created from a mapped array? aka, this_should_be_a_hash = [1,2].map do |i| Hash[ a => 1 ] end'
[20:48:29] uglybandersnatch: has joined #ruby
[20:48:45] dopamean_: has joined #ruby
[20:49:01] stunder: has joined #ruby
[20:49:20] Radar: majuscule: Mind chucking that code up on gist.github.com?
[20:49:33] smathy: alsu, but, eg., if you do this then you'll see your error: "\xE0\xA4\xB8".force_encoding('windows-1252').encode("UTF-8")
[20:49:49] jtoy: has joined #ruby
[20:50:02] smathy: Sorry, that first encoding should have been ASCII-8BIT
[20:50:19] smathy: alsu, ie. "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').encode("UTF-8")
[20:50:24] x77686d: has joined #ruby
[20:50:59] snowy: has joined #ruby
[20:50:59] majuscule: Radar: https://gist.github.com/majuscule/a3658398134c44db42032e12676d078c
[20:51:01] alsu: smathy: why is the JSON serializer trying to encode it to UTF-8? why not just write the escaped bytes?
[20:51:07] Radar: majuscule: thank you :)
[20:51:41] grill: has joined #ruby
[20:51:42] majuscule: i am realizing why that's dumb though :-)
[20:52:16] Radar: >> Hash[[1,2].map { |i| [i,1] }]
[20:52:17] ruby[bot]: Radar: # => {1=>1, 2=>1} (https://eval.in/545902)
[20:52:21] Radar: majuscule: ^
[20:53:03] majuscule: ooo super cool
[20:53:24] djellemah: >> [1,2].map{|i| [i,1]}.to_h
[20:53:26] ruby[bot]: djellemah: # => {1=>1, 2=>1} (https://eval.in/545903)
[20:53:27] Radar: The code makes a 2D array and then Hash#[] converts it into a Hash
[20:53:33] smathy: alsu, you mean just write the backslash x etc.. ? Because \x is a special sequence in a ruby string.
[20:53:42] Radar: djellemah: I use Hash#[] because I'm a traditionalist :P
[20:53:51] smathy: alsu, I think this character is MEANT to be UTF-8 btw.
[20:53:53] djellemah: Radar: I noticed ;-p
[20:54:09] Suntzu: has joined #ruby
[20:54:19] smathy: alsu, the three latin chars don't seem to make much sense to me: स
[20:54:26] alsu: smathy: I mean just write the JSON escape equivalent: \u00E0 etc
[20:54:32] smathy: alsu, vs what it is if treated as UTF-8: स
[20:55:04] Ox0dea: Radar: *Hash.[]
[20:55:13] Radar: Ox0dea: thank you. I am still booting this AM
[20:55:48] baweaver: has joined #ruby
[20:58:19] djellemah: >> Hash[1,2,3,4]
[20:58:20] ruby[bot]: djellemah: # => {1=>2, 3=>4} (https://eval.in/545904)
[21:00:21] sergey_makagon: has joined #ruby
[21:01:35] Ox0dea: Which I guess is nice?
[21:02:51] Spami_: has joined #ruby
[21:03:16] Ox0dea: >> Hash[[[1,2],[3,4]]] # Better than this monstrousness.
[21:03:17] ruby[bot]: Ox0dea: # => {1=>2, 3=>4} (https://eval.in/545905)
[21:03:43] eam: >> Hash[*%w{omg a ha sh}]
[21:03:44] ruby[bot]: eam: # => {"omg"=>"a", "ha"=>"sh"} (https://eval.in/545906)
[21:04:37] drewo: has joined #ruby
[21:05:04] djbkd: has joined #ruby
[21:05:12] Polysics: has joined #ruby
[21:05:12] bkxd: has joined #ruby
[21:06:05] _djbkd: has joined #ruby
[21:06:13] djellemah: >> [[1,2],[3,4]].to_h
[21:06:14] ruby[bot]: djellemah: # => {1=>2, 3=>4} (https://eval.in/545907)
[21:06:18] baweaver: &ri Enumerable#to_h
[21:06:18] `derpy: http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-to_h
[21:07:13] eam: to_h really oughta process a flat list >=/
[21:07:44] djellemah: that's what Hash[] is for, traditionally ;-)
[21:08:19] eam: weird and unintuitive!
[21:09:19] _blizzy_: has joined #ruby
[21:10:18] SCHAAP137: has joined #ruby
[21:11:09] choke: has joined #ruby
[21:12:51] Mon_Ouie: has joined #ruby
[21:13:15] mistermo_: has joined #ruby
[21:13:25] alsu: Radar: here’s a simple way to express my question: File.binread(‘any.jpeg’).to_json
[21:13:37] Ox0dea: eam: https://eval.in/545908
[21:13:46] alsu: why can’t the json serializer encode binary data without trying to make UTF-8 out of it?
[21:14:25] eam: alsu: because that's how json works
[21:14:30] eam: json must be utf-8
[21:14:46] eam: and yes, that means the json format fundamentally cannot represent some kinds of data in strings
[21:15:04] eam: you can uuencode your strings to get around it
[21:15:04] alsu: the *encoded* json must be utf-8. but it has escape sequences for byte values
[21:15:35] eam: nope, json strings must be valid utf-8
[21:17:08] smathy: OMG, `File.binread(‘any.jpeg’).to_json` is what you were doing?!?!? Talk about a misleading presentation.
[21:17:29] alsu: no, that’s not what I’m doing. but it demonstrates my question
[21:18:33] alsu: I’m not sure exactly where this ruby dictionary is coming from that it has ASCII-8BIT fields. ultimately, a different JSON encoder from a different language. some part of the ruby JSON parser or the ruby YAML parser decided it must be binary data, not UTF-8
[21:18:59] alsu: and turning it back into JSON is failing, which is absurb. it started as JSON
[21:19:21] smathy: alsu, how long are you planning on going on without showing actual code here?
[21:19:42] alsu: smathy: actually code won’t help. I need the original input string, which I don’t have
[21:20:02] diegoaguilar: has joined #ruby
[21:20:15] davedev24: has joined #ruby
[21:20:30] smathy: alsu, no idea what you mean by "decided it must be binary data" - all data is binary.
[21:20:41] alsu: the code is effectively YAML.parse(JSON.parse(input).to_yaml).to_json
[21:21:29] blackmesa: has joined #ruby
[21:21:29] alsu: smathy: I mean, the YAML encoded version says “binary”, and when parsed it makes an ASCII-8BIT string instead of a UTF-8 string
[21:22:32] Azure: has joined #ruby
[21:22:40] rolha: has joined #ruby
[21:23:03] alsu: I don’t know why the YAML serializer thought it was binary. it doesn’t seem to make sense that JSON.parse would return anything as ASCII-8BIT, does it?
[21:24:41] sorbo_: has joined #ruby
[21:24:48] smathy: alsu, "says “binary”" sounds like my grandfather explaining how the computer told him he had a virus. Make a gist, show your problem with a small sample of data, demonstrate the issue, explain which method is returning the string "binary", etc.. Then we'll have some hope of helping.
[21:25:40] alsu: smathy: yaml writes the word “binary” when encoding data. are you familiar with yaml?
[21:27:58] alsu: smathy: it looks like this: https://gist.github.com/anonymous/e272f20df65878e330a2f52ee957b531
[21:28:28] shortdudey123: when i install the json rubygem 1.8.3, it installs the extentions to /usr/local but 1.7.3 installed them to /usr... that good? bad? indifferent? its causing problems for me trying to build the rubygems-json rpm
[21:29:12] n008f4g_: has joined #ruby
[21:29:14] shevy: shortdudey123 have a look at "gem env" output, also if you have several different ruby versions and different gem versions, thing can become confusing
[21:29:16] dopie: has joined #ruby
[21:29:55] smathy: shortdudey123, the gem doesn't decide where to install things, it's related to the location of the ruby you're running gem (or bundle) with.
[21:29:59] daivyk: has joined #ruby
[21:30:00] shortdudey123: gem env points to /usr, using the sae ruby version (2.0), and 1.7.3 vs 1.8.3
[21:30:10] Madplatypus: has joined #ruby
[21:30:28] bronson: has joined #ruby
[21:30:47] djbkd: has joined #ruby
[21:31:23] shortdudey123: gem bin is at /usr/bin/gem
[21:31:56] shortdudey123: gem env shows /usr first and /usr/local 2nd
[21:32:40] shortdudey123: however, when doing rpmbuild, gem_extdir_mri is pointing to /usr and not /usr/local
[21:32:58] sandstrom: has joined #ruby
[21:33:03] Azure: has joined #ruby
[21:34:33] Azure: has joined #ruby
[21:34:56] yfeldblum: has joined #ruby
[21:35:08] diego2: has joined #ruby
[21:35:13] Azure: has joined #ruby
[21:36:11] Azure: has joined #ruby
[21:36:30] alsu: smathy: does this help? https://gist.github.com/anonymous/edacfafeb6d73573d951b28a2551d2c9
[21:37:03] tvon: has joined #ruby
[21:38:14] Azure: has joined #ruby
[21:39:52] rmulligan: has joined #ruby
[21:40:23] Azure: has joined #ruby
[21:40:34] Gasher: has joined #ruby
[21:40:35] cdg: has joined #ruby
[21:41:15] smathy: alsu, no, find out what input is.
[21:41:26] alsu: smathy: that could take days
[21:41:47] fnux: has joined #ruby
[21:42:10] uglybandersnatch: has joined #ruby
[21:42:19] axl__: has joined #ruby
[21:42:41] smathy: alsu, ok.
[21:43:58] mistermo_: has joined #ruby
[21:44:04] bahar: has joined #ruby
[21:44:04] bahar: has joined #ruby
[21:44:29] EvilJStoker: has joined #ruby
[21:48:08] djbkd_: has joined #ruby
[21:48:46] darkf: has joined #ruby
[21:48:46] gix-: has joined #ruby
[21:48:53] JStoker: has joined #ruby
[21:49:39] apeiros: did somebody already tell alsu that json is specified to be utf-8 only?
[21:49:51] apeiros: ACTION only skimmed the backlog
[21:50:02] alsu: yes, smathy mentioned that.
[21:50:24] alsu: the JSON parser doesn’t seem to agree with that, though. it’s accepting input it cannot later encode
[21:52:07] Aviio: has joined #ruby
[21:52:20] blackmes1: has joined #ruby
[21:52:38] apeiros: got an example for that?
[21:53:44] Rubie: has joined #ruby
[21:54:46] alsu: apeiros: pasted above, but I’m lacking the original input string. I’ll have to try to catch one in the wild
[21:54:48] rehat: has joined #ruby
[21:54:57] Kimm: has joined #ruby
[21:55:11] apeiros: the above is not an example for something JSON.parse accepts but JSON.dump fails on.
[21:55:13] rehat: is there a different gem for SQLite3 or is this the best one?
[21:55:14] rehat: https://github.com/sparklemotion/sqlite3-ruby
[21:55:40] alsu: apeiros: it would be if I had the input string
[21:55:52] apeiros: "it would be" = "it is not"
[21:56:02] apeiros: I highly doubt your claim
[21:56:20] alsu: I promise I wouldn’t have come in here asking if it hadn’t occurred
[21:56:33] apeiros: I do believe you that you have a problem
[21:56:44] apeiros: but I also believe that you're misunderstanding what problem you're having
[21:56:58] alsu: the exception is pretty clear, as is the yaml I have a record of
[21:57:20] apeiros: because I doubt it is such that you have an input for which JSON.parse(input) succeeds, but JSON.dump(JSON.parse(input)) fails
[21:57:29] alsu: and the only way that yaml gets made is directly from the json parser output
[21:57:46] alsu: maybe the yaml serializer acts funny, I guess.
[21:58:37] klka: has joined #ruby
[21:59:16] apeiros: what version of ruby and what version of yaml are you using?
[22:00:56] diego2: has joined #ruby
[22:01:11] abyx: has joined #ruby
[22:01:40] alsu: ruby 2.2.1p85, yaml appears to be provided by psych 2.0.8
[22:02:09] apeiros: and `"\xE0\xA4\xB8".to_yaml` does not give you "--- \"स\"\n"?
[22:02:40] alsu: it does.
[22:03:23] alsu: but the yaml I have a record of is different. it looks like: "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').to_yaml #=> "--- !binary |-\n 4KS4\n"
[22:03:44] apeiros: "--- !binary |-\n 4KS4\n" is your precise yaml or are you making it up from parts?
[22:04:18] alsu: that’s a truncated bit. let me find a small but precise sample.
[22:05:47] apeiros: and in https://gist.github.com/anonymous/edacfafeb6d73573d951b28a2551d2c9 - there's truly no steps between JSON.parse(input) and to_yaml?
[22:06:22] IrishGringo: has joined #ruby
[22:08:04] patrick_star_2: has joined #ruby
[22:08:59] baweaver: has joined #ruby
[22:09:56] bronson: has joined #ruby
[22:12:11] Chunlea: has joined #ruby
[22:12:18] ssiris: has joined #ruby
[22:13:09] Icey: has joined #ruby
[22:13:46] alsu: apeiros: "\xEF\xBF\xBD\x1F"
[22:15:00] alsu: ruby says it’s utf-8, and that it’s valid. to_yaml makes "--- !binary |-\n 77+9Hw==\n"
[22:15:08] Cohedrin: has joined #ruby
[22:16:34] alsu: "\xEF\xBF\xBD\x1F".to_json works, but YAML.load("\xEF\xBF\xBD\x1F".to_yaml).to_json does not
[22:16:38] jdawgaz: has joined #ruby
[22:16:49] Polysics: has joined #ruby
[22:17:55] pawnbox: has joined #ruby
[22:18:34] rolha_: has joined #ruby
[22:19:22] sorbo_: has joined #ruby
[22:19:26] benlieb: has joined #ruby
[22:20:29] Cohedrin: has joined #ruby
[22:21:30] threh: has joined #ruby
[22:22:44] apeiros: to_yaml iirc choooses binary representation when there's too many non-printable characters (like \u001f)
[22:23:15] apeiros: and the problem is that loading that yaml will cause the encoding to be set to binary, instead of the original utf-8
[22:23:39] apeiros: I'm not sure, but I think that actually qualifies as a bug in yaml.
[22:24:19] quazimodo: has joined #ruby
[22:24:29] ljames: has joined #ruby
[22:24:45] apeiros: >> require "yaml"; "foobar\u001f\u001f".to_yaml # enough printable characters
[22:24:46] ruby[bot]: apeiros: # => "--- \"foobar\\x1F\\x1F\"\n" (https://eval.in/545911)
[22:24:54] apeiros: >> require "yaml"; "foobar\u001f\u001f\u001f".to_yaml # not enough printable characters
[22:24:55] ruby[bot]: apeiros: # => "--- !binary |-\n Zm9vYmFyHx8f\n" (https://eval.in/545912)
[22:25:07] alsu: is there a way to turn that off?
[22:25:17] apeiros: I'd have to read the docs the same as you
[22:25:24] eam: why not just force the encoding to what you want?
[22:25:30] baweaver: has joined #ruby
[22:25:43] Cohedrin_: has joined #ruby
[22:25:54] alsu: eam: it’s inside a huge nested structure. I’d have to walk the whole thing detecing strings and forcing their encoding
[22:26:20] apeiros: I'd check the yaml repository and see whether somebody else had that issue too
[22:26:23] apeiros: if not, file one
[22:27:22] Cohedrin_: has joined #ruby
[22:27:32] krobzaur: has joined #ruby
[22:27:55] alsu: hm. Syck and Psych both do this
[22:27:55] damonkelley: has joined #ruby
[22:28:06] x77686d: has joined #ruby
[22:28:40] minimalism: has joined #ruby
[22:28:58] Cohedrin: has joined #ruby
[22:29:20] jrafanie: has joined #ruby
[22:31:25] stunder: has joined #ruby
[22:34:33] duckpuppy: has joined #ruby
[22:34:45] krasnus: has joined #ruby
[22:36:52] al2o3-cr: has joined #ruby
[22:37:13] ekinmur: has joined #ruby
[22:37:14] sarbs: has joined #ruby
[22:37:21] B1n4r10: has joined #ruby
[22:38:13] jdawgaz: has joined #ruby
[22:38:15] heyimwill: has joined #ruby
[22:38:38] zenlot: has joined #ruby
[22:41:04] abyx: has joined #ruby
[22:43:46] blackmes1: has joined #ruby
[22:44:34] Suntzu: has joined #ruby
[22:44:51] shinnya: has joined #ruby
[22:45:26] dvinciguerra_: has joined #ruby
[22:46:12] alexherbo2: has joined #ruby
[22:48:57] djbkd_: has joined #ruby
[22:49:16] sarbs: has joined #ruby
[22:50:13] sarbs: has joined #ruby
[22:50:32] Regulati_: has joined #ruby
[22:51:00] bkxd: has joined #ruby
[22:53:03] Es0teric: has joined #ruby
[22:53:43] Es0teric: has joined #ruby
[22:53:56] Rubie: has joined #ruby
[22:55:02] dvinciguerra__: has joined #ruby
[22:55:26] jtoy: has joined #ruby
[22:56:41] finisherr: has joined #ruby
[22:56:50] ChiefAlexander: has joined #ruby
[22:57:58] yfeldblum: has joined #ruby
[22:59:07] pawnbox: has joined #ruby
[22:59:39] Es0teric: has joined #ruby
[23:00:11] jdawgaz: has joined #ruby
[23:00:18] tubuliferous_: has joined #ruby
[23:00:24] Es0teric: has joined #ruby
[23:01:07] Es0teric: has joined #ruby
[23:01:48] Es0teric: has joined #ruby
[23:02:01] Rubie: has joined #ruby
[23:02:28] Es0teric: has joined #ruby
[23:03:01] P4Titan: has joined #ruby
[23:03:02] blackgoat: has joined #ruby
[23:03:50] solocshaw: has joined #ruby
[23:04:24] P4Titan: Hello all. I have this code; how could I condense/write it better? http://pastie.org/10781278
[23:05:25] Ox0dea: P4Titan: %w[- network friends].index(share_type).to_i
[23:05:31] Ox0dea: But probably don't.
[23:07:11] drewo: has joined #ruby
[23:07:25] ramfjord_: has joined #ruby
[23:07:31] alsu: bugs filed. apeiros, smathy, Radar: thanks for your help
[23:07:53] alsu: has left #ruby: ()
[23:08:05] GitGud: has joined #ruby
[23:08:17] mistermocha: has joined #ruby
[23:08:43] al2o3-cr: so simple, just like an italian mama
[23:08:44] Yiota: has joined #ruby
[23:09:40] smathy: P4Titan, looks like an enum to me.
[23:10:15] P4Titan: smathy: but I want to replace the contents in link_info
[23:10:35] P4Titan: and even if I were to substitute the constants w/ an enum, it would still be clunky
[23:10:40] mistermo_: has joined #ruby
[23:11:02] Radar: Are you saving this number to a database
[23:11:09] Radar: WTB question marks I have run out
[23:11:15] smathy: P4Titan, no idea what constants you're talking about.
[23:11:22] Radar: Why are you saving the number and not the string? Do you want to on-purpose confuse future developers?
[23:11:49] uglybandersnatch: has joined #ruby
[23:11:58] Radar: and you'll have a whole heap of link_info[:share_type] == 1 type code in your codebase too, which is just smellllllly
[23:12:22] Radar: Source: done a ton of code reviews on apps that do exactly this and my god what dumpster fires.
[23:12:23] P4Titan: Radar: ok, I'll replace the bare numbers w/ an enum
[23:12:53] jdawgaz: has joined #ruby
[23:12:54] P4Titan: but why should I contain the entire string when I only need some representation of it
[23:13:01] P4Titan: the string bears on more meaning that an enum
[23:13:10] P4Titan: yet is bigger, slower, etc.
[23:13:24] smathy: Bigger?!?!
[23:13:41] P4Titan: I simply wish to condense my case statement to something more elegant/clever
[23:13:42] Radar: ACTION is boggling over here
[23:13:54] krz: has joined #ruby
[23:13:58] Radar: P4Titan: I have a tip for condensing it: don't write a case statement when you don't need one.
[23:14:03] Radar: P4Titan: 0 lines of code, 0 bugs.
[23:14:10] Radar: Store the string in the DB
[23:14:29] P4Titan: Tho may u give me a reason as to why?
[23:14:34] Radar: [10:12:22] <Radar> Source: done a ton of code reviews on apps that do exactly this and my god what dumpster fires.
[23:14:43] smathy: What do you think we're writing here? The head move routines for a hard drive?
[23:14:46] Radar: You will make life hard for future-you and future-other-people.
[23:14:53] Dimik: has joined #ruby
[23:15:02] d0nn1e: has joined #ruby
[23:15:10] Radar: You need to make it EXPLICIT in your codebase that when the share_type is "network" it really means "network"
[23:15:17] smathy: P4Titan, your reason, "bigger, slower" is absurd - that's our reason for picking the option that is easier to implement and understand.
[23:15:20] Radar: becuase nobody knows that 1 == "network" unless they've really looked hard into the problem before.
[23:16:32] FooMunki: has joined #ruby
[23:16:54] shevy: he wants a tiny database!
[23:18:02] P4Titan: I just feel that the marginal benefit of a more readable database doesn't convince me
[23:18:30] djbkd: has joined #ruby
[23:18:47] Radar: P4Titan: A smaller database doesn't convince me.
[23:18:51] jackjackdripper: has joined #ruby
[23:18:54] P4Titan: I will see if I can store enums in an Active Records databse
[23:18:56] Radar: oh wow you get a 0.0000000001 optimisation
[23:19:04] KensoDev: has joined #ruby
[23:19:55] P4Titan: Radar: I fear your sarcasm does not impact *my* project. Moreover, I simply wish to learn some Ruby posing an interesting question which surely can be simplied in some clever manner, tickling ur inner rubyist brains.
[23:20:13] Radar: ok, glhf bye
[23:20:24] smathy: P4Titan, comprehensible, explicit values are not a marginal benefit, but no one's going to stop you, but we're the wrong people to ask for opinions on shitty workarounds to bad choices.
[23:21:03] smathy: P4Titan, and while you're at it, you should definitely switch away from ruby if the slowness of using strings bothers you.
[23:21:19] jackjackdripper: has joined #ruby
[23:22:03] P4Titan: I would say that my general mentaility (for this project at least) is: if it can be better, why not make it better.
[23:22:23] P4Titan: Anyway, I appreciate your input and will take it into future consideration.
[23:22:47] Cohedrin_: has joined #ruby
[23:25:28] Ormm: has joined #ruby
[23:27:32] early90spants: has joined #ruby
[23:27:44] GodFather: has joined #ruby
[23:29:08] pawnbox: has joined #ruby
[23:29:31] astrobunny: has joined #ruby
[23:30:55] Yiota: has joined #ruby
[23:31:12] uglybandersnatch: has joined #ruby
[23:31:37] baweaver: has joined #ruby
[23:31:45] rehat: so lost, I am reading a file of words into an array but for some reason I can't find the index of a string that is in the array. '==' doesn't seem to work
[23:32:23] havenwood: >> %w[a b c d].index 'c'
[23:32:24] Ox0dea: rehat: You... shouldn't need `==`?
[23:32:24] ruby[bot]: havenwood: # => 2 (https://eval.in/545924)
[23:32:43] CloCkWeRX: has joined #ruby
[23:33:30] rehat: I tried just array_var.index("bat") but that returned nothing
[23:33:36] Canar: watching you ruby pros answer newbie questions has honestly advanced my ruby understanding so much... i haven't ever joined an irc channel that improved my understanding quite so much
[23:35:35] havenwood: rehat: Then you're batless.
[23:35:43] Ox0dea: rehat: Needs more bat.
[23:35:48] Ox0dea: Or else you forgot to #chomp your lines.
[23:36:18] havenwood: rehat: Check: array_var.grep /bat/
[23:36:35] havenwood: rehat: Or just sanity check: p array_var
[23:36:59] dostoyevsky: hmmmm... there is no unicode symbol for batman... how are you supposed to call him when you need him?
[23:37:24] rehat: do I need to do anything special with strings read from a file? I printed out the .class and is say String and there are no '\n' or '\r' in the puts. I made another array and hard coded the strings and index("bat") worked
[23:38:01] DLSteve: has joined #ruby
[23:38:01] finisherr: has left #ruby: ()
[23:39:09] Canar: dostoyevsky: .svg so you don't get artefacting from scaling the symbol up to be 2 miles wide
[23:39:33] mdelgadonyc: has left #ruby: ("Leaving")
[23:39:49] baweaver: files have newlines
[23:41:00] Ox0dea: rehat: `puts` will conceal line endings from you; use `p` for debug printing.
[23:41:57] baweaver: &ri String#chomp
[23:41:57] `derpy: http://ruby-doc.org/core-2.3.0/String.html#method-i-chomp
[23:42:16] rehat: ugh I found my problem, I'm a tard. I did gsub("\n", ' ') and it added a space to the end
[23:42:20] Inside: has joined #ruby
[23:42:20] Inside: has joined #ruby
[23:42:31] baweaver: use chomp instead
[23:42:47] Ox0dea: Use #split with no arguments.
[23:42:55] yosafbridge: has joined #ruby
[23:43:05] Ox0dea: >> "foo \s\t\n bar \s\t\n baz".split
[23:43:06] ruby[bot]: Ox0dea: # => ["foo", "bar", "baz"] (https://eval.in/545936)
[23:43:16] n_blownapart: has joined #ruby
[23:43:43] rehat: baweaver: ahh chomp is nicer thanks
[23:44:06] baweaver: see Ox0dea's post above
[23:44:36] al2o3-cr: it's like leaving candy around a child, they gonna chomp, chomp, chomp
[23:45:13] Inside_: has joined #ruby
[23:46:48] pwnd_nsfw: has joined #ruby
[23:47:39] al2o3-cr: shit, did i say candy i meant chips
[23:48:34] baweaver: This took a dark turn O_o
[23:48:51] krz: has joined #ruby
[23:49:00] al2o3-cr: not if you do em' at 180c
[23:50:14] baweaver: aaand new topic
[23:50:31] al2o3-cr: hows ya father?
[23:51:22] tomchapin: has joined #ruby
[23:54:24] wethu: has joined #ruby
[23:54:54] FooMunki: has joined #ruby
[23:56:10] diegoaguilar: has joined #ruby
[23:56:40] vikaton: has joined #ruby