« Back to channel list

#ruby - 01 April 2016

« Back 1 day Forward 1 day »
[00:00:01] BSaboia: has joined #ruby
[00:00:02] yfeldblum: has joined #ruby
[00:02:46] LoneHerm_: has joined #ruby
[00:04:34] benlieb: has joined #ruby
[00:04:43] Vile`: has joined #ruby
[00:04:46] mwlang: ACTION deletes loooong question he figured out for himself… :-D
[00:07:14] speaking1ode: has joined #ruby
[00:09:09] speakingcode: anyone know about issues with installing/compiling 2.1.3 with rvm? keep getting an error uncommon.mk:180: recipe for target 'build-ext' failed
[00:10:00] Radar: speakingcode: Have you tried using ruby-install + chruby instead?
[00:10:18] Radar: speakingcode: I've seen people who have had problems with RVM try that combination and then it has worked for them.
[00:11:24] statelesscode: has joined #ruby
[00:11:58] FooMunki: has joined #ruby
[00:12:18] QualityAddict: has joined #ruby
[00:12:26] speakingcode: nope, never heard of either of them. so it's an rvm issue perhaps?
[00:12:35] Radar: speakingcode: perhaps
[00:12:54] Ox0dea: speakingcode: Which extension failed to build?
[00:13:03] Ox0dea: ACTION bets on OpenSSL.
[00:13:43] Gasher: I have a questions about erb - how do you do things like "==yield" or "include" in there? so you have things like head and navbar shared across pages?
[00:14:07] i_luv_radar: has joined #ruby
[00:14:35] i_luv_radar: just me Radar, testing about. Cheers.
[00:14:38] uglybandersnatch: has joined #ruby
[00:15:04] Radar: Gasher: Is this relating to Rails?
[00:15:59] diegoaguilar: has joined #ruby
[00:16:44] Gasher: Radar, any Ruby framework
[00:16:55] Radar: Gasher: Ok. I don't understand the question.
[00:17:00] Gasher: and erb is included with ruby, so it's a legit question for this channel
[00:17:05] jdawgaz: has joined #ruby
[00:17:11] Gasher: what templating engine did you use Radar ?
[00:17:22] Radar: The code you wrote is not ERB-ish.
[00:17:30] speakingcode: loks like it's an openssl issue actually but there's a patch
[00:17:35] Radar: I don't know what you mean by "== yield"
[00:17:55] Ropeney: has joined #ruby
[00:18:31] ur5us: has joined #ruby
[00:18:47] pawnbox: has joined #ruby
[00:19:04] Gasher: Radar, "==yield" is on Slim
[00:19:16] Radar: [11:13:43] <Gasher> I have a questions about erb -
[00:19:20] Radar: [11:19:04] <Gasher> Radar, "==yield" is on Slim
[00:19:58] Radar: And we still haven't got to the real questions yet.
[00:20:32] Gasher: I'm asking for the equivelant with erb
[00:20:47] Gasher: so you have things like head and navbar shared across pages?
[00:20:55] Gasher: real question, there were 2 actually
[00:21:04] Radar: <%= yield %>
[00:21:08] Radar: I don't know what you mean by "include"
[00:21:45] safe: has joined #ruby
[00:22:04] speakingcode: Radar, Ox0dea it was an openssl issue but applying the patch worked, thanks
[00:22:07] Gasher: yes, exactly, partials
[00:22:28] Ox0dea: speakingcode: Huzzah! Glad you got it sorted.
[00:22:35] baweaver: http://www.getinterface.com/support/user-manual/entry/partial-tag-erb/
[00:23:54] hiyosi: has joined #ruby
[00:24:58] rehat: is there a way to trigger a ruby script with erb? Like user enters something in a textfield and when they press submit it would trigger a ruby script that would reload the page. Just running it locally not on a server
[00:26:12] B1n4r10: has joined #ruby
[00:27:41] Radar: >> [[1,2,3,4,5]].any? { |a| a.include?(2) }
[00:27:42] ruby[bot]: Radar: # => true (https://eval.in/545948)
[00:27:59] FooMunki: has joined #ruby
[00:28:07] smathy: rehat, not with erb, erb is a template language. You could do something with JS.
[00:28:31] smathy: ...not really "trigger a ruby script" though, not without a server, JS is in a sandbox.
[00:28:42] djbkd: has joined #ruby
[00:29:25] rehat: smathy: ok thanks
[00:30:06] rkazak: has joined #ruby
[00:34:04] Aviio: has joined #ruby
[00:34:13] duckpuppy: has joined #ruby
[00:34:19] andywojo: has joined #ruby
[00:35:10] Gasher: <a href="/upload/<%= image %>">
[00:35:13] Gasher: will that work?
[00:35:59] preyalone: has joined #ruby
[00:36:05] rodfersou: has joined #ruby
[00:36:21] stunder: has joined #ruby
[00:40:29] sgambino: has joined #ruby
[00:42:15] benzrf: well, there *is* opal
[00:42:48] Gasher: what does it have to do with anything?
[00:43:29] B1n4r10: has joined #ruby
[00:43:44] benzrf: er, i was remarking on rehat's question
[00:45:15] rehat: benzrf: ahh neat, thanks
[00:45:18] Gasher: I'm going, gnight all
[00:45:25] Gasher: has left #ruby: ("Leaving")
[00:45:31] benzrf: rehat: it's probably not the right solution to what it is you want to do, though
[00:47:23] Maletor: has joined #ruby
[00:47:49] cdg: has joined #ruby
[00:48:30] pawnbox: has joined #ruby
[00:49:35] BSaboia: has joined #ruby
[00:51:53] bkxd: has joined #ruby
[00:52:56] tomchapin: has joined #ruby
[00:54:50] RegulationD: has joined #ruby
[00:54:57] shazaum_: has joined #ruby
[00:55:08] Yiota: has joined #ruby
[00:56:07] moei: has joined #ruby
[00:57:39] mistermocha: has joined #ruby
[00:59:24] mbff: has joined #ruby
[00:59:36] mbff: Hello! I am getting a strange result when using AMS!
[00:59:54] abyx: has joined #ruby
[00:59:55] mbff: I https://gist.github.com/anonymous/77f293f51b566d7d98180bc10199c619
[01:00:10] mbff: any idea what is going on here?
[01:03:44] Nawn: has joined #ruby
[01:04:57] chipotle: has joined #ruby
[01:06:55] mbff: nevermind, just dumb
[01:08:02] skweek: has joined #ruby
[01:15:01] rmulligan: has joined #ruby
[01:17:44] hplar: has joined #ruby
[01:18:38] hxegon: has joined #ruby
[01:18:59] benlovell: has joined #ruby
[01:19:33] _stu_: has joined #ruby
[01:22:39] mistermo_: has joined #ruby
[01:22:48] hays: has joined #ruby
[01:23:13] tubuliferous_: has joined #ruby
[01:23:44] ekinmur: has joined #ruby
[01:25:09] monoprotic: has joined #ruby
[01:28:48] pawnbox: has joined #ruby
[01:33:17] B1n4r10: has joined #ruby
[01:33:28] rmulligan: has joined #ruby
[01:34:11] jtran: has joined #ruby
[01:34:58] duckpuppy: has joined #ruby
[01:36:26] cjbottaro: has joined #ruby
[01:39:57] MyMind: has joined #ruby
[01:41:14] chouhoulis: has joined #ruby
[01:41:23] kies: has joined #ruby
[01:45:39] sorbo_: has joined #ruby
[01:46:46] jdawgaz: has joined #ruby
[01:46:49] tubuliferous_: has joined #ruby
[01:47:49] rbennacer: has joined #ruby
[01:51:46] leon_e: has joined #ruby
[01:52:18] FooMunki: has joined #ruby
[01:55:10] tristanp: has joined #ruby
[01:57:12] sudo: has joined #ruby
[01:58:44] rmulligan: has joined #ruby
[02:01:40] nando293921: has joined #ruby
[02:02:36] Digpig: has joined #ruby
[02:05:12] A124: has joined #ruby
[02:06:17] Yzguy: has joined #ruby
[02:07:37] bkxd: has joined #ruby
[02:08:29] aeterne: has joined #ruby
[02:10:10] chriskeele: has joined #ruby
[02:10:21] chriskeele: why is my if statement not working? http://bit.ly/1UGtjGt
[02:13:03] _stu_: has joined #ruby
[02:13:32] bronson: has joined #ruby
[02:13:57] banister: has joined #ruby
[02:14:01] banister: anyone here use 'jira' ?
[02:15:08] ekinmur: has joined #ruby
[02:17:54] adminm: has joined #ruby
[02:18:31] pawnbox: has joined #ruby
[02:18:45] mistermo_: has joined #ruby
[02:19:36] Radar: banister: yes
[02:20:01] arescorpio: has joined #ruby
[02:20:02] shevy: chriskeele use a sane pastie site
[02:20:08] banister: Radar cool, how do you attach a github PR to a given jira ticket?
[02:20:24] Radar: !ban chriskeele
[02:20:24] ruby[bot]: +bbb $a:chriskeele$#ruby-banned chriskeele!*@*$#ruby-banned *!*@gateway/web/freenode/ip.207.244.66.129$#ruby-banned
[02:20:25] ruby[bot]: ruby[bot] kicked chriskeele: offense, see http://ruby-community.com/pages/user_rules
[02:20:26] ruby[bot]: -bbb cwong_on_irc*!*@*$#ruby-fix-your-connection jackcom!*@*$#ruby-banned *!*@gateway/web/freenode/ip.70.35.48.190$#ruby-banned
[02:20:44] josephan: has joined #ruby
[02:20:46] Radar: banister: Great question.
[02:20:59] Radar: banister: We do it, but I don't know how it's done. Let me look at the things.
[02:21:03] ruby-lang324: has joined #ruby
[02:21:21] banister: in trello it was trivial, but now we're using jira i can't figure out how, and the docs are terrible
[02:21:34] ruby-lang324: I used to have one large file and it's test file counterpart: poker.rb and poker_test.rb
[02:21:49] Radar: banister: We've setup webhooks for https://<our subdomain>.atlassian.net/rest/bitbucket/1.0/repository/64/sync (push events only)
[02:21:55] ruby-lang324: Now I broke up the files for each seperate class and they are all under the poker module
[02:22:13] Radar: banister: Oh, and it's Pull requests, pull request review comment and issue comments too.
[02:22:28] Radar: banister: Your repository number may be different?
[02:22:33] ruby-lang324: I have to require them all in a seperate file is that correct? For example if I want to load all those classes in pry
[02:22:36] adminm: has left #ruby: ()
[02:22:46] banister: Radar thanks
[02:26:56] x77686d: has joined #ruby
[02:28:30] Thai_: has joined #ruby
[02:29:07] moeabdol2: has joined #ruby
[02:29:07] benlieb: has joined #ruby
[02:30:31] Eiam_: has joined #ruby
[02:36:36] bry4n_: has joined #ruby
[02:37:45] gregf: has joined #ruby
[02:39:04] shazaum__: has joined #ruby
[02:44:10] tubuliferous_: has joined #ruby
[02:48:34] pawnbox: has joined #ruby
[02:48:50] Devalo: has joined #ruby
[02:50:05] rickmasta: has joined #ruby
[02:52:01] djbkd: has joined #ruby
[02:53:32] rmulligan: has joined #ruby
[02:55:50] freerobby: has joined #ruby
[02:56:16] ramfjord: has joined #ruby
[02:56:18] RegulationD: has joined #ruby
[03:02:27] G: has joined #ruby
[03:07:13] benlovell: has joined #ruby
[03:07:27] zast: has joined #ruby
[03:12:58] BTRE: has joined #ruby
[03:14:10] uglybandersnatch: has joined #ruby
[03:15:08] braincrash: has joined #ruby
[03:16:24] Yiota: has joined #ruby
[03:16:40] stunder: has joined #ruby
[03:17:32] krobzaur: has joined #ruby
[03:21:17] IrishGringo: has joined #ruby
[03:22:30] marcdel: has joined #ruby
[03:25:17] Yiota: has joined #ruby
[03:25:47] Dimik: has joined #ruby
[03:29:35] baweaver: has joined #ruby
[03:34:32] triangles: has joined #ruby
[03:35:44] duckpuppy: has joined #ruby
[03:36:04] Aviio: has joined #ruby
[03:37:55] gix: has joined #ruby
[03:38:05] fedexo: has joined #ruby
[03:38:09] Aviio: has joined #ruby
[03:38:11] pawnbox: has joined #ruby
[03:38:12] grill: has joined #ruby
[03:38:20] bkxd: has joined #ruby
[03:40:05] finisherr: has joined #ruby
[03:41:27] benlieb: has joined #ruby
[03:41:45] chipotle: has joined #ruby
[03:42:31] stunder: has joined #ruby
[03:43:20] benlieb: has joined #ruby
[03:47:12] rmulligan: has joined #ruby
[03:49:32] hahuang61: has joined #ruby
[03:49:42] cdg: has joined #ruby
[03:49:51] chipotle: has joined #ruby
[03:50:51] Inside: has joined #ruby
[03:50:51] Inside: has joined #ruby
[03:52:27] Meow-J: has joined #ruby
[03:52:53] djbkd: has joined #ruby
[03:54:14] codecop: has joined #ruby
[03:54:17] pawnbox: has joined #ruby
[04:01:35] hk238: has joined #ruby
[04:04:24] Yzguy: has joined #ruby
[04:07:02] tercenya: has joined #ruby
[04:07:43] tAn: has joined #ruby
[04:12:37] chagel: has joined #ruby
[04:13:16] hinbody: has joined #ruby
[04:13:27] bluOxigen: has joined #ruby
[04:13:42] bronson: has joined #ruby
[04:16:56] uglybandersnatch: has joined #ruby
[04:17:35] mistermo_: has joined #ruby
[04:20:08] Renich: has joined #ruby
[04:26:39] tubuliferous_: has joined #ruby
[04:32:35] karioleez: has joined #ruby
[04:35:02] jenrzzz: has joined #ruby
[04:35:02] jenrzzz: has joined #ruby
[04:40:26] hxegon: has joined #ruby
[04:41:16] rmulligan: has joined #ruby
[04:46:36] drewo: has joined #ruby
[04:47:03] Aviio: has joined #ruby
[04:48:19] abyx: has joined #ruby
[04:48:38] Suntzu: has joined #ruby
[04:48:56] Asher: has joined #ruby
[04:53:44] djbkd: has joined #ruby
[04:54:01] merida: has joined #ruby
[04:54:19] duncannz: has joined #ruby
[04:55:25] benlovell: has joined #ruby
[04:55:47] jtoy: has joined #ruby
[04:56:45] Digpig: has joined #ruby
[04:56:52] marcdel: has joined #ruby
[04:56:54] ICantCook: has joined #ruby
[04:57:05] mistermo_: has joined #ruby
[05:02:39] yfeldblum: has joined #ruby
[05:05:07] triangles2: has joined #ruby
[05:06:38] torandu: has joined #ruby
[05:07:46] sauvin: has joined #ruby
[05:08:50] Aviio: has joined #ruby
[05:08:56] Aviio: Morning folks
[05:09:09] bkxd: has joined #ruby
[05:09:30] torandu: has joined #ruby
[05:09:49] Yzguy: so for something like
[05:09:55] Yzguy: if running_instances.empty?
[05:10:08] Yzguy: if i want to negate it, the only way is !running_instances.empty? correct
[05:10:21] Yzguy: nothing like if not running_instances.empty?
[05:10:30] Ox0dea: Yzguy: Use `unless`.
[05:11:14] Ox0dea: Ruby loves you. :)
[05:11:22] Aviio: I found that hard to read at first
[05:11:58] Yzguy: i guess I'd say I'm still pretty beginner to ruby
[05:12:14] Yzguy: like i can write ruby in a procedural manner but haven't done much more than scripts
[05:12:21] Aviio: Its real fun to learn
[05:12:26] Yzguy: I love it
[05:12:37] Yzguy: my buddy is against it, he's all "I'm only doing python and go"
[05:12:49] Aviio: I only started a few months ago, actually preferring it to my day job which is .net
[05:12:57] Yzguy: except the company we work for, mostly is ruby
[05:13:08] Yzguy: for internal stuff
[05:13:18] Aviio: I wish we could do ruby @ work
[05:13:21] Yzguy: New Relic haha
[05:13:30] Yzguy: so its all languages
[05:13:48] jtoy: has joined #ruby
[05:13:49] Yzguy: cuz that's what our product monitors
[05:14:27] sauvin: has joined #ruby
[05:15:00] baweaver: we use Ruby for most ops over here
[05:16:43] Aviio: Heres one for you guys - im trying to automate the wordpress installation (https://github.com/WordPress/WordPress/blob/master/wp-admin/install.php), using curl.. so far ive got 'curl -d "weblog_title=testTitle&user_name=testUser&admin_password=carhorsebatterystaple&admin_password2=carhorsebatterystaple&admin_email=test@testserver.test&blog_public=0" http://127.0.0.1/wordpress/wp-admin/install.php' but this just returns me some
[05:18:04] tAn: has joined #ruby
[05:18:14] Emmanuel_Chanel: has joined #ruby
[05:18:39] nanoz: has joined #ruby
[05:19:10] Devalo: has joined #ruby
[05:19:51] uglybandersnatch: has joined #ruby
[05:23:13] sigurding: has joined #ruby
[05:23:14] Radar: how is this Ruby related
[05:23:24] Aviio: It really isnt
[05:23:32] Radar: Ok, please go ask in #wordpress?
[05:31:47] aganov: has joined #ruby
[05:36:29] duckpuppy: has joined #ruby
[05:37:10] howdoi: has joined #ruby
[05:38:38] Digpig: has joined #ruby
[05:40:53] mistermo_: has joined #ruby
[05:41:12] hahuang61: has joined #ruby
[05:41:54] norc: has joined #ruby
[05:41:56] norc: has joined #ruby
[05:41:57] norc: has joined #ruby
[05:46:17] Yzguy: this is what i was working on
[05:46:17] Yzguy: https://github.com/yzguy/yzguy-sandbox/blob/master/ruby/aws-sdk/ec2/stopinstances.rb
[05:46:40] Yzguy: just a quick "turn all instances off except these ones" script
[05:49:40] Aviio: has left #ruby: ()
[05:51:49] solars: has joined #ruby
[05:52:11] Aviio: has joined #ruby
[05:52:33] moeabdol: has joined #ruby
[05:54:09] Aviio: has joined #ruby
[05:54:12] djbkd: has joined #ruby
[05:54:56] skade: has joined #ruby
[05:55:26] moeabdol1: has joined #ruby
[05:58:44] aufi: has joined #ruby
[05:59:02] Aviio: has joined #ruby
[06:03:15] pawnbox: has joined #ruby
[06:03:31] rkazak: has joined #ruby
[06:04:51] karioleez: has joined #ruby
[06:05:56] karioleez: has joined #ruby
[06:06:47] webus: has joined #ruby
[06:06:58] joonty: has joined #ruby
[06:07:17] baweaver: Yzguy: running_instances = resp.instance_status.select { |i| i.instance_state.name == 'running' }.map(&:instance_id) - instances_to_skip
[06:07:45] baweaver: select the running instances, transform it to a list of instance ids, subtract your skip list
[06:10:42] solars: has joined #ruby
[06:13:00] noService: has joined #ruby
[06:15:49] abyx: has joined #ruby
[06:15:54] bronson: has joined #ruby
[06:20:13] abyx: has joined #ruby
[06:20:31] pawnbox: has joined #ruby
[06:20:41] noService: has joined #ruby
[06:21:16] uglybandersnatch: has joined #ruby
[06:27:53] mistermo_: has joined #ruby
[06:28:05] nando293921: has joined #ruby
[06:29:37] shmuli: has joined #ruby
[06:30:21] nando293921: has joined #ruby
[06:30:39] haraoka: has joined #ruby
[06:30:51] last_staff: has joined #ruby
[06:32:32] tvw: has joined #ruby
[06:32:58] tvw: has joined #ruby
[06:34:13] nando293921: has joined #ruby
[06:35:14] andikr: has joined #ruby
[06:35:36] CausaMortis: has joined #ruby
[06:35:39] AnoHito_: has joined #ruby
[06:36:05] kollex: has joined #ruby
[06:36:55] bigkevmcd: has joined #ruby
[06:37:13] Polysics: has joined #ruby
[06:37:26] Polysics: has joined #ruby
[06:38:17] CausaMortis_: has joined #ruby
[06:39:15] chouhoulis: has joined #ruby
[06:41:07] Eiam_: has joined #ruby
[06:41:47] ur5us: has joined #ruby
[06:43:34] benlovell: has joined #ruby
[06:44:37] Xeago: has joined #ruby
[06:45:44] pawnbox: has joined #ruby
[06:47:01] choke: has joined #ruby
[06:47:40] qhp: has joined #ruby
[06:48:25] jackjackdripper: has joined #ruby
[06:48:46] nando293921: has joined #ruby
[06:51:52] norc: Hi, I have written a small module that brings AR association semantics to regular classes (providing for #foo, #foo=, #foo_id, #foo_id= accessor methods). I seem to have found myself in a circlejerk for writing specs for this.
[06:52:09] sandstrom: has joined #ruby
[06:52:35] norc: I cannot sensibly test a reader without invoking a writer or the other way around.
[06:54:16] apeiros: then don't. test them in tandem.
[06:54:51] apeiros: unless you want to do whitebox testing. then you can test it by using rubys reflection capabilities.
[06:54:57] djbkd: has joined #ruby
[06:55:08] JohnBat26: has joined #ruby
[06:55:53] nikger: has joined #ruby
[06:56:06] sergey_makagon: has joined #ruby
[06:59:30] DoubleMalt: has joined #ruby
[06:59:31] claw: has joined #ruby
[07:00:44] biberu: has joined #ruby
[07:00:57] norc: apeiros: Okay guess it makes sense to test them in tandem. Not sure what you meant by testing it by using reflection though.
[07:01:22] apeiros: I assume the accessor methods change something within the object
[07:01:42] ericlee: has joined #ruby
[07:01:50] norc: Indeed. I have some internal hashes to keep track of things and caching.
[07:02:11] apeiros: and with whitebox-testing, you'd read that internal state. e.g. using instance_variable_get
[07:04:32] norc: Okay I understand what you mean.
[07:05:43] mark2: has joined #ruby
[07:08:44] AlexJakeGreen: has joined #ruby
[07:08:59] bruce_lee: has joined #ruby
[07:08:59] bruce_lee: has joined #ruby
[07:09:57] bkxd: has joined #ruby
[07:12:58] ur5us: has joined #ruby
[07:14:33] claw: has joined #ruby
[07:18:20] Couch: has joined #ruby
[07:18:57] dn`: has joined #ruby
[07:19:12] terlar: has joined #ruby
[07:21:59] claw: has joined #ruby
[07:23:07] krz: has joined #ruby
[07:26:09] sandstrom: has joined #ruby
[07:26:22] pandaant: has joined #ruby
[07:26:49] Xeago: has joined #ruby
[07:29:48] merida: has joined #ruby
[07:32:45] djbkd: has joined #ruby
[07:32:46] mr_oh: has joined #ruby
[07:36:49] vondruch: has joined #ruby
[07:37:04] dc4: has joined #ruby
[07:37:14] duckpuppy: has joined #ruby
[07:38:48] mrgrieves: has joined #ruby
[07:39:18] Ox0dea: You broke your screen, innit?
[07:40:28] chouhoulis: has joined #ruby
[07:43:01] dionysus69: has joined #ruby
[07:43:19] Sembei: has joined #ruby
[07:43:32] sigurding: has joined #ruby
[07:44:34] mr_oh: Screen is good
[07:45:10] bkxd: has joined #ruby
[07:45:16] abyx: has joined #ruby
[07:47:43] anisha: has joined #ruby
[07:49:09] noService: has joined #ruby
[07:50:03] Ox0dea: And, so, but, then, well, why the 0x5adface?
[07:50:38] norc: Ox0dea: So ever since I have started writing my own compiler for a subset of C, I began to realise the uglificationess of the MRI lexer/parser...
[07:51:01] norc: The lexer is pure magic.
[07:51:04] Ox0dea: norc: But... parser combinators.
[07:51:16] mr_oh: No one was typing
[07:51:23] edwinvdgraaf: has joined #ruby
[07:53:52] norc: adaedra: I wish you the best of luck fixing your capslock key.
[07:53:57] norc: Hello on that note.
[07:54:12] adaedra: Fun fact: my caps lock key produces '\'.
[07:54:26] apeiros: that's indeed more useful than what it normally does
[07:55:13] norc: Indeed, it is probably the one key I practically never use on my keyboard. Remapping it to \ might actually be sensible on this damn apple keyboard.
[07:55:25] Dreamer3: has joined #ruby
[07:55:36] manveru: ACTION always remaps caps to ctrl
[07:55:47] adaedra: norc: https://pqrs.org/osx/karabiner/seil.html.en
[07:55:49] jtoy: has joined #ruby
[07:55:51] djbkd_: has joined #ruby
[07:57:06] uglybandersnatch: has joined #ruby
[07:57:25] mr_oh: I bought an old(er) used thinkpad. Keyboard is epic except no separate num pad.
[07:57:28] norc: Mm, that does not seem very trustworthy.
[07:57:59] PaulCapestany: has joined #ruby
[07:58:04] norc: I just bought a unicomp keyboard for my home computer, because I was getting sick of having no Windows button on my IBM Model M. :-)
[07:59:07] mr_oh: windows won't run on this p.c. convertible!
[08:00:18] sepp2k: has joined #ruby
[08:01:35] ericlee: has joined #ruby
[08:01:44] mikecmpbll: has joined #ruby
[08:03:14] moeabdol1: has joined #ruby
[08:04:39] mr_oh: craving french fries...
[08:05:18] skade: has joined #ruby
[08:09:07] jenrzzz: has joined #ruby
[08:09:07] jenrzzz: has joined #ruby
[08:16:10] uniqm: has joined #ruby
[08:16:17] baweaver: has joined #ruby
[08:16:18] Xeago: has joined #ruby
[08:16:28] quazimodo: has joined #ruby
[08:16:42] uniqm: has left #ruby: ()
[08:18:12] bronson: has joined #ruby
[08:18:54] Xeago: has joined #ruby
[08:19:42] jaruga_: has joined #ruby
[08:21:38] shmuli: has joined #ruby
[08:21:48] pawnbox: has joined #ruby
[08:21:58] dn`: has joined #ruby
[08:23:34] norc_: has joined #ruby
[08:24:02] ferr: has joined #ruby
[08:24:19] PaulCape_: has joined #ruby
[08:24:55] Spami: has joined #ruby
[08:25:43] Ropeney: has joined #ruby
[08:27:13] AimlessRAven: has joined #ruby
[08:27:19] AimlessRAven: hi all, i have 1 question
[08:27:22] Emmanuel_Chanel_: has joined #ruby
[08:27:43] AimlessRAven: https://gist.github.com/anonymous/b2e1f87a34ea255160cd1c2c390bcb2c here is my code i always select my second product prices
[08:27:47] AimlessRAven: but if product have 1 price
[08:27:54] AimlessRAven: i want this price is be selected
[08:29:52] marr: has joined #ruby
[08:30:09] norc: AimlessRaven: I would use the decorator pattern to elegantly solve this.
[08:31:20] norc: AimlessRaven: Also it is not a wise choice to have any business logic in your views. Make it so that your views get complete collections.
[08:31:31] norc: As opposed to having sql fragments in your views.
[08:32:13] Emmanuel_Chanel: has joined #ruby
[08:32:21] shmuli: has joined #ruby
[08:32:30] Spami_: has joined #ruby
[08:32:56] norc: So in short: Have your controller prepare the collection, ordering it the way you want it, wrap it inside a decorator which then provides some utility method that gives you the index of the pre-selected price.
[08:34:42] ruby-lang220: has joined #ruby
[08:34:45] AimlessRAven: but in code how would be looks like
[08:35:39] rmulligan: has joined #ruby
[08:36:22] apeiros: hm, too late for ?crosspost
[08:36:56] Spami: has joined #ruby
[08:37:03] apeiros: they left somebody on #rubyonrails hanging on a follow-up question and instead cross-posted here. pondering to ban.
[08:38:37] SCHAAP137: has joined #ruby
[08:39:28] jenrzzz: has joined #ruby
[08:39:28] jenrzzz: has joined #ruby
[08:41:14] chouhoulis: has joined #ruby
[08:41:15] evidex: has joined #ruby
[08:46:53] benlovell: has joined #ruby
[08:47:16] ferr: has joined #ruby
[08:47:25] qhp: has joined #ruby
[08:48:55] marr: has joined #ruby
[08:49:08] vale_tudo: has joined #ruby
[08:49:16] staticfox: has joined #ruby
[08:50:04] GitGud: has joined #ruby
[08:50:34] hays: has joined #ruby
[08:50:45] drbrain: has joined #ruby
[08:50:47] jtoy: has joined #ruby
[08:51:34] PaulCapestany: has joined #ruby
[08:53:25] sepp2k: has joined #ruby
[08:54:40] pawnbox: has joined #ruby
[08:55:24] skislak: has joined #ruby
[08:56:44] djbkd_: has joined #ruby
[08:58:29] RegulationD: has joined #ruby
[08:58:34] bruce_lee: has joined #ruby
[09:05:14] rsc___: has joined #ruby
[09:05:35] ur5us: has joined #ruby
[09:10:43] snowy: has joined #ruby
[09:11:34] cpup: has joined #ruby
[09:12:30] platzhirsch: has joined #ruby
[09:15:31] polll: has joined #ruby
[09:16:31] quazimodo: has joined #ruby
[09:16:56] PaulCape_: has joined #ruby
[09:16:57] chihhsin: has joined #ruby
[09:17:01] GriffinHeart: has joined #ruby
[09:17:54] Zai00: has joined #ruby
[09:18:22] Xeago: has joined #ruby
[09:18:58] Xeago: has joined #ruby
[09:22:52] Ox0dea: $ gem install cant_even
[09:23:25] apeiros: $ gem install can_odd
[09:24:20] chagel: has joined #ruby
[09:29:17] patrick_star_3: has joined #ruby
[09:29:24] Suntzu: has joined #ruby
[09:29:35] blackmes1: has joined #ruby
[09:30:04] rmulligan: has joined #ruby
[09:35:53] Guest51156: has joined #ruby
[09:36:58] Xeago: has joined #ruby
[09:38:02] duckpuppy: has joined #ruby
[09:38:09] qhp: has joined #ruby
[09:38:19] CloCkWeRX: has joined #ruby
[09:40:33] GitGud: has joined #ruby
[09:40:40] Xeago: has joined #ruby
[09:42:30] nobitanobi: has joined #ruby
[09:42:32] mikecmpbll: has joined #ruby
[09:43:19] chouhoulis: has joined #ruby
[09:43:22] nanoz: has joined #ruby
[09:44:30] mosez: has joined #ruby
[09:45:21] PaulCapestany: has joined #ruby
[09:45:46] Spami: has joined #ruby
[09:45:58] merida: has joined #ruby
[09:46:22] DuneMan: has joined #ruby
[09:47:17] Es0teric: has joined #ruby
[09:48:13] madgen: has joined #ruby
[09:49:17] zeroDivisible: has joined #ruby
[09:49:34] TvL2386: has joined #ruby
[09:50:20] krobzaur: has joined #ruby
[09:50:21] triangles2: has joined #ruby
[09:51:37] triangles2: has joined #ruby
[09:52:49] triangles2: has joined #ruby
[09:53:00] pawnbox: has joined #ruby
[09:53:10] binaryplease1: has joined #ruby
[09:53:37] triangles2: has joined #ruby
[09:54:27] triangles2: has joined #ruby
[09:56:06] roelof: has joined #ruby
[09:57:12] roelof: Hello, Anyone a tip how I can capitalize this : the Bridge over the river kwai to this : The Bridge over the River Kwai
[09:57:32] roelof: Expecially about the dubble the
[09:57:35] Es0teric: has joined #ruby
[09:57:49] roelof: one time it has to be capitalized and another time not
[09:58:02] nanoz: has joined #ruby
[10:00:51] FooMunki: has joined #ruby
[10:01:15] lxsameer: has joined #ruby
[10:01:38] chrisjohnson: has joined #ruby
[10:02:00] chrisjohnson: my code isn't working http://j.gs/7c5u
[10:03:03] roelof: chrisjohnson: why not use th gist.github link ?
[10:03:39] chrisjohnson: i don't like using github becuse i use my real name on there and i don't want people to know me who i am on irc because of security reasons
[10:04:50] roelof: oke, but the link you use , you first see a lot of advertising and I do not think people will help you
[10:05:09] roelof: chrisjohnson: you can also use lpaste or another pastebin
[10:05:11] manveru: yeah, gave up after it complained about my adblocker :P
[10:05:53] QualityAddict: has joined #ruby
[10:06:07] Antiarc: has joined #ruby
[10:06:44] roelof: I have this : https://gist.github.com/rwobben/63ff6a68da3858d30c4fd005ed75feaa but then both the are not capitalized. Is there a better way ?
[10:06:45] millerti: has joined #ruby
[10:08:42] PaulCape_: has joined #ruby
[10:08:56] scepticulous: has joined #ruby
[10:11:20] BLuEGoD: has joined #ruby
[10:12:25] ur5us: has joined #ruby
[10:12:33] yfeldblum: has joined #ruby
[10:14:54] roelof: oke, this is working but it feels like double work : https://gist.github.com/rwobben/754220ff20741b00cd896ec72ebff210
[10:15:04] roelof: can I somehow improve it
[10:15:38] pawnbox: has joined #ruby
[10:17:22] baweaver: has joined #ruby
[10:18:22] Coldblackice_: has joined #ruby
[10:20:17] bronson: has joined #ruby
[10:22:29] workmad3: roelof: `ignore_list = %w(and or the); word.split.map{ |word| ignore_list.include?(word) ? word : word.capitalize }` for starters
[10:24:08] kollex: has left #ruby: ()
[10:24:25] nfk: has joined #ruby
[10:24:46] roelof: workmad3: expected: "The Bridge over the River Kwai" got: "the Bridge Over the River Kwai"
[10:25:45] workmad3: roelof: if you notice, I only addressed the first line, not the second (where you're ensuring word 1 is capitalized)
[10:26:01] workmad3: roelof: i.e. don't just copy-paste, spend some time understanding
[10:26:02] roelof: workmad3: the first "the" must be capitalized. the second not
[10:26:42] roelof: of course, I try to understand
[10:26:59] workmad3: roelof: then can you see that I didn't write a complete replacement?
[10:27:20] roelof: the problem is when I have one word like jaws it is already capitalized, so the second do not have to work
[10:27:49] roelof: I was hoping there is a solution that does not have to work with 2 lines ?
[10:28:26] gregf_: roelof: what workmad3's suggested is something you can build on?
[10:28:58] gregf_: presumably they're trying to test your logical abilities and not use of functions/methods?
[10:29:08] roelof: nope, I do not see how I can capitalize the first "then" but not the second one
[10:30:13] roelof: I could capitalize the first one but then I have to make a iterate that begins at the second word
[10:30:32] gregf_: roelof: fair enough. thats logic very *specific* to what you want. perhaps, so that you can get your logic right :)
[10:31:13] roelof: both cases I can not find a solution for
[10:31:28] roelof: each or map looks to start from the beginning
[10:33:18] roelof: gregf_: so Im stuck in my mind how to handle this :(
[10:35:19] gregf_: >> str = "the Bridge over the river kwai";ignore_list = [ %r{\s+the}, %r{^[A-Z]} , %r{over} ]; p str.split.map{ |s| ignore_list.select {|i| s =~ i }.size > 0 ? s : s.capitalize }.join(" ") # roelof: run that and go away happy now
[10:35:21] ruby[bot]: gregf_: # => "The Bridge over The River Kwai" ...check link for more (https://eval.in/546111)
[10:35:30] roelof: or can I do something like this : answer.slice(0,1).capitalize + answer.slice(1..-1) if word.length > 1 so the second line only works if there are more words
[10:37:03] rsc___: has joined #ruby
[10:37:36] the_drow: has joined #ruby
[10:37:53] PaulCapestany: has joined #ruby
[10:37:55] codecop: has joined #ruby
[10:39:51] sphex_: has joined #ruby
[10:40:13] Ox0dea: &ri #with_index roelof
[10:40:13] `derpy: roelof: http://ruby-doc.org/core-2.3.0/Enumerator.html#method-i-with_index
[10:40:31] Ox0dea: You want to treat index 0 specially.
[10:40:42] FooMunki: has joined #ruby
[10:41:20] roelof: gregf_: why does this not work : %r{\s+and}
[10:42:10] gregf_: er, prolly you need anchors?
[10:42:29] gregf_: but that said, are you familiar with regular expressions?
[10:42:53] roelof: gregf_: a little bit
[10:43:33] gregf_: >> ["and", " and"].select{ |w| w =~ %r{\A\s+and\z} }
[10:43:34] ruby[bot]: gregf_: # => [" and"] (https://eval.in/546120)
[10:43:42] gregf_: roelof: ^^se
[10:43:54] roelof: I changed to this : ignore_list = [ %r{\s+the}, %r{over}, %r{\s+and}] and the and is still uppercase :(
[10:44:01] chouhoulis: has joined #ruby
[10:44:44] bulletxt: has joined #ruby
[10:44:57] apeiros: >> "the Bridge".split # roelof
[10:44:58] ruby[bot]: apeiros: # => ["the", "Bridge"] (https://eval.in/546122)
[10:45:16] apeiros: misremembered the default for split. ignore :)
[10:45:21] bulletxt: has left #ruby: ("Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is")
[10:47:39] roelof: bummer still the same problem : https://gist.github.com/rwobben/a1afd6aebc48171321ee5641eb3de512
[10:47:56] c355E3B: has joined #ruby
[10:48:33] joonty: has joined #ruby
[10:48:57] Ox0dea: roelof: https://eval.in/546125
[10:48:59] apeiros: >> "War and Peace".split
[10:49:00] ruby[bot]: apeiros: # => ["War", "and", "Peace"] (https://eval.in/546126)
[10:49:12] gregf_: roelof: ah - i see.. yeah, that wont work. the 'spaces' dissapear :|. its far more simpler . but.. meh
[10:49:13] apeiros: roelof: tell me what %{\s+and} matches in words
[10:49:38] roelof: a space and then the word and
[10:49:49] apeiros: roelof: does that occur in that array?
[10:50:10] roelof: oke, I will try without the /s
[10:50:26] apeiros: why do you use regex at all btw.?
[10:50:35] Ox0dea: Because gregf_. :(
[10:51:14] roelof: when I change it to this : ignore_list = [ %r{\s+the}, %r{over}, %r{and}] the "and" is still in uppercase even if it's in the ignore list
[10:51:34] apeiros: ah you changed your code
[10:51:37] apeiros: didn't notice before
[10:51:37] Veejay: has joined #ruby
[10:51:44] apeiros: roelof: how does Array#include? work?
[10:51:49] roelof: apeiros: I have to make a difference between the first "then" and the second 'then"
[10:51:51] apeiros: how does it figure whether an item is in the array?
[10:52:39] roelof: apeiros: as far as I understand, it looks if a item is a part of a array and give true if so and false if the item is not in the array
[10:52:45] apeiros: re differ first and second then - you won't be able to do that if you split the string
[10:53:07] apeiros: roelof: how does it do that? check whether an item is part of the array?
[10:53:51] roelof: apeiros: I think it's iterate through the array and compares the current item in the list with the item to look for
[10:54:01] apeiros: correct. what does it use to compare?
[10:54:09] apeiros: as in, which method?
[10:54:36] apeiros: so you have %r{and} (which is a regex) and compare it with == to "and" (which is a string)
[10:54:42] apeiros: those are not ==
[10:54:59] platzhirsch: has joined #ruby
[10:55:14] apeiros: so either you have to use something else than Array#include?, or something else than regexen in your ignore-list.
[10:55:40] roelof: oke, this is a dead end way
[10:56:17] roelof: I have to think how I can differ the first "then" and the second "then"
[10:56:40] apeiros: roelof: maybe take a look at what Ox0dea wrote you
[10:58:02] bkxd: has joined #ruby
[10:58:32] noService: has joined #ruby
[10:58:54] roelof: oke, so when its the first word or the word in not in the ignore list then capitalize otherwise return the word
[10:59:10] roelof: that is what I was looking for
[10:59:15] RegulationD: has joined #ruby
[10:59:16] sandstrom: has joined #ruby
[10:59:30] roelof: never knew that you can iterate with a index
[11:00:00] spiman: has joined #ruby
[11:00:04] Macaveli: has joined #ruby
[11:01:25] roelof: Thanks all, learned another thing. Pity I could not find this one myself
[11:01:35] blackgoat: has joined #ruby
[11:01:40] roelof: I think not using the right google terms
[11:01:51] Ox0dea: The docs are a closely guarded secret.
[11:02:35] apeiros: >> ignore = %w[and over the]; "War and Peace".gsub(/(?<!\A)\b(?!#{Regexp.union(ignore)})\w+\b/, &:capitalize) # regex solution
[11:02:36] ruby[bot]: apeiros: # => "War and Peace" (https://eval.in/546131)
[11:03:06] apeiros: >> ignore = %w[and over the]; "war and peace".gsub(/(?<!\A)\b(?!#{Regexp.union(ignore)})\w+\b/, &:capitalize) # regex solution - this time with an example where something actually changes
[11:03:07] ruby[bot]: apeiros: # => "war and Peace" (https://eval.in/546133)
[11:03:10] nighttime: has joined #ruby
[11:04:24] apeiros: Ox0dea: why whoops?
[11:05:01] Ox0dea: apeiros: The first word didn't get capitalized.
[11:05:09] apeiros: that's what he wanted, no?
[11:05:28] Ox0dea: I think #titleize is supposed to do what it says on the tin. :P
[11:05:31] apeiros: ah, I see. Misread.
[11:05:47] apeiros: should not be difficult to update the regex…
[11:06:05] apeiros: ignore = %w[and over the]; "war and peace".gsub(/\A\w+\b|\b(?!#{Regexp.union(ignore)})\w+\b/, &:capitalize) # and now according to spec :D
[11:06:16] apeiros: >> ignore = %w[and over the]; "war and peace".gsub(/\A\w+\b|\b(?!#{Regexp.union(ignore)})\w+\b/, &:capitalize) # and now according to spec :D
[11:06:17] ruby[bot]: apeiros: # => "War and Peace" (https://eval.in/546135)
[11:06:58] Ox0dea: And, but, well, the specs really ought to throw the "over and over" curveball.
[11:07:41] apeiros: ACTION doesn't know baseball and hence doesn't get metaphors relating to it
[11:08:41] Ox0dea: "over and over" => "Over and Over" is slightly tricksy.
[11:08:45] Rahul_Roy: has joined #ruby
[11:08:59] Ox0dea: Sneaky little Hobbitses.
[11:09:31] forest: has joined #ruby
[11:09:39] apeiros: ah, that's what you get for having silly casing rules.
[11:10:01] apeiros: (not that german casing rules were better)
[11:10:08] rodfersou: has joined #ruby
[11:10:57] noService: has joined #ruby
[11:11:11] Ox0dea: https://en.wikipedia.org/wiki/Studly_caps is objectively superior.
[11:11:39] apeiros: yes, lets use studly caps.
[11:12:40] apeiros: interesting hint regarding the meaning of shoebox…
[11:15:16] spiman_: has joined #ruby
[11:16:08] tomaz_b: has joined #ruby
[11:16:09] Devalo: has joined #ruby
[11:16:24] Xeago: has joined #ruby
[11:17:12] michael_mbp: has joined #ruby
[11:18:13] trinaldi: has joined #ruby
[11:20:09] freerobby: has joined #ruby
[11:25:01] Gasher: has joined #ruby
[11:27:24] tvw: has joined #ruby
[11:28:33] ldnunes: has joined #ruby
[11:36:20] hk238: has joined #ruby
[11:36:31] but3k4: has joined #ruby
[11:38:21] y0da: has joined #ruby
[11:38:45] duckpuppy: has joined #ruby
[11:41:02] chrisco: has joined #ruby
[11:41:54] chagel: has joined #ruby
[11:43:47] krz: has joined #ruby
[11:44:38] SHyx0rmZ: has joined #ruby
[11:44:57] chouhoulis: has joined #ruby
[11:49:16] rodferso1: has joined #ruby
[11:49:27] Dysp: has joined #ruby
[11:50:36] quazimodo: has joined #ruby
[11:50:39] Dysp: Hello lovely people! I have an array and I want to remove any element being below 2,5 % of X value. I do this by the following array.delete_if {|x| x >= value}
[11:50:40] Dysp: Works fine!
[11:50:45] Ox0dea: apeiros: You nerd-sniped me. I tried to do every single combination, but it'd've taken ages. The longest alternator is "UnPoRoUsNeSs".
[11:51:08] Dysp: However, how would I approach only assessing the first 50% of the array?
[11:51:34] apeiros: Dysp: array.first(array.size/2)
[11:51:36] Dysp: I guess I could create a new array with the first 50% and simply do it there and then put it back together, but is there an easier way?
[11:51:47] sdothum: has joined #ruby
[11:51:55] apeiros: Ox0dea: I did what now?
[11:51:58] Dysp: apeiros: The myth. The legend.
[11:52:13] apeiros: legendary myth
[11:52:15] Ox0dea: apeiros: The shoebox thing.
[11:52:28] Dysp: array.first(array.size/2).delete_if {|x| x >= value}
[11:52:30] Dysp: Would that do?
[11:52:42] Ox0dea: I started to find all the word pairs hidden in larger words, but I have a massive dictionary.
[11:52:48] apeiros: Dysp: depends on whether I understood you correctly.
[11:53:14] apeiros: Ox0dea: what does "upruns" mean?
[11:53:22] Dysp: I only want to run the "delete_if" on the first 50% of the array.
[11:53:35] Ox0dea: apeiros: Wiktionary says "uprun" is synonymous with "ascend".
[11:53:36] Ox0dea: ¯\_(ツ)_/¯
[11:53:51] apeiros: Ox0dea: interesting. online translator doesn't know the word :)
[11:53:53] Ox0dea: Dysp: And the problem is that #delete_if modifies the Array in-place, yes?
[11:53:55] pawnbox: has joined #ruby
[11:54:08] Dysp: No, that's fine. I want a new array.
[11:54:12] Es0teric: has joined #ruby
[11:54:15] Dysp: Or. A modified array
[11:54:21] apeiros: oh, is delete_if == select! ?
[11:54:32] Dysp: I simply do only want to run the delete_if on the first part of the array.
[11:54:37] apeiros: I thought it'd be == select
[11:54:48] apeiros: errr, reject
[11:55:04] Dysp: You are confusing me :D
[11:55:54] rahc: I want to find out what code is modifying a particular array
[11:56:03] Dysp: I mean; I could split the array, run the delete_if and then connect it again. But I would hope there would be an easier way.
[11:56:48] apeiros: rahc: freeze it and watch the explosion
[11:57:05] rahc: I've tried using byebug's "display" command but it doesn't watch the actual object, it simply evaluates a context-dependent variable name on each frame
[11:57:07] apeiros: Dysp: ah yes, the given solution does that
[11:57:18] rahc: apeiros: what do you mean?
[11:57:41] Dysp: apeiros: This? array.first(array.size/2).delete_if {|x| x >= value}
[11:57:44] apeiros: rahc: call .freeze on it. when something tries to modify it, it'll raise an exception. the exception tells you where it has been modified.
[11:57:56] rahc: apeiros: I see
[11:58:29] rahc: apeiros: that doesn't help me though because I need to see each invocation
[11:58:54] rahc: s/invocation/modification/
[11:58:59] Dysp: I had an error. Because I forgot to put in a value. I'm not a clever man, apeiros .
[11:59:30] rahc: apeiros: how can I do that?
[11:59:33] sudoubuntu: has joined #ruby
[11:59:47] apeiros: wrap it in a proxy object and log access
[11:59:48] rahc: apeiros: do you know how I can do that?
[12:00:05] rahc: apeiros: a proxy object for an array is going to be pretty extensive, no?
[12:00:13] rahc: apeiros: do you know of such a proxy object?
[12:00:48] apeiros: SimpleDelegator & co might work. It's easy to write one yourself, though.
[12:02:01] Ox0dea: >> a = [*1..10]; a.reject!.with_index { |e, i| i < a.size / 2 && e > 2 }; a # Dysp
[12:02:02] ruby[bot]: Ox0dea: # => [1, 2, 6, 7, 8, 9, 10] (https://eval.in/546218)
[12:02:04] dionysus69: has joined #ruby
[12:02:06] pawnbox: has joined #ruby
[12:02:13] Ox0dea: But that's wasteful since it'll still go through the whole collection.
[12:02:28] apeiros: Ox0dea: my premature optimization bone itches
[12:02:52] Dysp: Don't tickle that bone, Ox0dea!
[12:03:00] Ox0dea: Huehuehue.
[12:03:33] vale_tudo: has joined #ruby
[12:04:32] uglybandersnatch: has joined #ruby
[12:04:47] Ox0dea: This is one of those times where it'd be nice if #slice returned a reference.
[12:05:25] Ox0dea: ary[0, ary.size / 2].reject! { ... }
[12:05:25] bluOxigen_: has joined #ruby
[12:05:26] volCat: has joined #ruby
[12:05:43] joonty: has joined #ruby
[12:05:54] apeiros: while it does return a reference, it's COW :)
[12:06:06] duckpuppy: has joined #ruby
[12:06:15] Ropeney: has joined #ruby
[12:06:15] Ox0dea: Right, right.
[12:07:53] Vile`: has joined #ruby
[12:10:20] Cork: anyone know how to convert UTF-8 to 3 byte UTF-8 in ruby? (mysql string)
[12:11:28] Yiota: has joined #ruby
[12:11:51] adaedra: you don't have to do that.
[12:12:11] adaedra: mysql will just reject your unencodable characters.
[12:12:35] apeiros: the question sounded like they think those could be "translated", though
[12:12:41] Cork: adaedra: ya, it rejects the entire insert string
[12:13:00] adaedra: mysql utf-8 is just a less-capable utf-8
[12:13:01] Cork: ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: '\xF0\x9F\x98\x84\x0D\x0A...' for column 'body' at row 1: INSERT INTO
[12:13:25] Cork: "e😄\r\n" <--
[12:13:37] apeiros: iirc those longer sequences are beyond codepoint 2**32-1, so you could probably .unpack("U*").reject { |cp| cp >= 2**32 }.pack("U*")
[12:13:54] apeiros: alternatively read the WP page on unicode and write the proper regex. should not be hard.
[12:14:04] whippythellama: has joined #ruby
[12:14:06] Cork: hmm let me give it a try
[12:14:10] Cork: thx for the help!
[12:14:20] adaedra: Next time, go utf8mb4
[12:14:22] apeiros: sequence start is iirc fixed and unambiguous, no matter which byte you look at
[12:16:09] Cork: adaedra: ya, i was trying
[12:16:27] Cork: but the mysql client in debian doesn't support > utf8
[12:16:45] Cork: Mysql2::Error (Can't initialize character set utf16 (path: /usr/share/mysql/charsets/)):
[12:16:54] Cork: (same for utf8mb4)
[12:17:21] andywojo: has joined #ruby
[12:17:26] GodFather: has joined #ruby
[12:18:13] baweaver: has joined #ruby
[12:18:33] pietr0: has joined #ruby
[12:19:30] Cork: adaedra: had to change it to .unpack("U*").reject { |cp| cp >= 2**16 }.pack("U*") for it to work but ya
[12:19:42] Dysp: apeiros: Hm. What seems to happen is that array.first(array.size/2).delete_if {|x| x >= value} indeed scans the first 50% of the array and deletes any element >= value. However the second half of the array is also deleted.
[12:20:51] Dysp: Could you confirm this?
[12:20:53] CloCkWeRX: has joined #ruby
[12:21:13] apeiros: Dysp: yes, I thought that was obvious.
[12:21:22] apeiros: after array.first(array.size/2) you only have the first half of the array.
[12:21:23] Dysp: Nothing is obvious to me in programming yet, apeiros ;)
[12:22:04] bronson: has joined #ruby
[12:22:28] Dysp: My own idea for a solution would be to split the array up and then put it back together, but could you propose a more elegant solution?`
[12:26:56] apeiros: no. as I said before, my solution simply implements (a part of) your solution
[12:27:29] Dysp: Alrighty. I'll get it to work. Thanks for your help as always.
[12:27:59] al2o3-cr: has joined #ruby
[12:29:12] bkxd: has joined #ruby
[12:29:18] sudoubuntu: has joined #ruby
[12:32:03] Zai00: has joined #ruby
[12:32:53] nfk|laptop: has joined #ruby
[12:33:12] madgen: has joined #ruby
[12:33:21] merida: has joined #ruby
[12:33:57] aupadhye: has joined #ruby
[12:34:47] jrafanie: has joined #ruby
[12:35:31] but3k4: has joined #ruby
[12:36:21] bluOxigen: has joined #ruby
[12:37:06] apeiros: Dysp: I don't think it's a good solution, but sometimes a little magic is fun: https://gist.github.com/apeiros/6428ca06a6c2a8dd60e25c501c07a8de
[12:37:23] Ropeney_: has joined #ruby
[12:38:49] cdg: has joined #ruby
[12:39:02] Dysp: apeiros: Looks lovely, however I am still too newb to actually understand what you are doing there.
[12:39:52] djellemah: >> ry = [0.1,0.7,0.7,0.1]; stop_index = ry.size / 2; ry.reject!.each_with_index{|v,i| break if i >= stop_index; v < 0.5}; ry # Dysp
[12:39:53] ruby[bot]: djellemah: # => [0.7, 0.7, 0.1] (https://eval.in/546237)
[12:39:57] n0xff: has joined #ruby
[12:40:26] Mendenhall: has joined #ruby
[12:40:55] apeiros: Dysp: doesn't matter much, what matters is that you see how it's used and that it's a generic solution for all destructive methods :D
[12:42:00] Dysp: Generic solution for destructive methods? I'm so sorry, I actually don't understand the discourse
[12:42:08] Dysp: It's hard being new.
[12:42:33] apeiros: a destructive/mutating/in-place method is a method which modifies an object
[12:42:40] apeiros: select!, reject!, gsub! etc. do that
[12:43:09] apeiros: many of them have a non-destructive counterpart, which does not modify the object, but returns a copy with the changes applied there.
[12:43:18] apeiros: select, reject, gsub etc. would be the counterparts to those named above
[12:43:45] apeiros: and my solution lets you apply any destructive method to only a slice of the array
[12:44:24] millerti: has joined #ruby
[12:44:28] Dysp: Ah. So you mean that destructive methods deletes an object to create a new one, whereas the counterparts lets the other stay, but returns a new object too?
[12:44:58] apeiros: no, it does not delete an object. it modifies an object.
[12:45:12] IrishGringo: has joined #ruby
[12:45:13] apeiros: >> a = [1,2,3]; a.reject! { |x| x.odd? }; a
[12:45:15] ruby[bot]: apeiros: # => [2] (https://eval.in/546239)
[12:45:17] Dysp: So X = > X'
[12:45:20] apeiros: >> a = [1,2,3]; a.reject { |x| x.odd? }; a
[12:45:21] ruby[bot]: apeiros: # => [1, 2, 3] (https://eval.in/546240)
[12:45:27] apeiros: see the difference?
[12:45:28] Dysp: And X => X + Y
[12:45:31] chouhoulis: has joined #ruby
[12:46:44] haylon: has joined #ruby
[12:46:56] pawnbox: has joined #ruby
[12:46:57] Dysp: I understand that .reject! would modify (remove) the odd numbers in the array.
[12:47:06] apeiros: brb, reboot
[12:47:09] Dysp: I honestly do not understand what .reject does.
[12:47:21] jaroslav: it creates a new object
[12:47:23] apeiros: Dysp: run the code in pry, check the return value of both
[12:47:24] djellemah: Dysp: gives you back a new array without the odd numbers
[12:47:25] jaroslav: leaving original one as is
[12:47:48] apeiros: also run it where no change happens and check the return values
[12:48:11] Dysp: So, reject: X.reject => X + X2
[12:48:22] Dysp: And reject!: X.reject! => X'
[12:48:25] apeiros: Dysp: I don't think that notation helps anybody
[12:48:48] Dysp: Don't see it as code
[12:49:08] apeiros: yes, but it doesn't help if you have to explain your analogy first
[12:49:19] Dysp: Haha, you have a point there, good sir.
[12:50:18] Dysp: So. x.reject leaves me with two arrays. The original one and a new one? Reject! modifies the original one to create a new one with the applied method?
[12:50:24] jas02: has joined #ruby
[12:50:31] blackjid: has joined #ruby
[12:51:28] djellemah: Dysp: you've got reject now, and almost there with reject!
[12:52:20] tpendragon: has joined #ruby
[12:52:21] Dysp: So, Reject! modifies the original one with the applied method?
[12:52:48] Dysp: Hereuka!
[12:53:18] Dysp: Then one question remains in my mind; if I get two arrays from .reject, what is second one called?
[12:53:50] apeiros: Dysp: one part omitted - check the return value of reject!, once when it does change something, and once when it doesn't
[12:54:09] wlanboy: has joined #ruby
[12:54:13] Xeago: has joined #ruby
[12:54:16] djellemah: >> name_it_whatever_you_like = [1,2,3,4].reject{|v| v.odd?} # Dysp
[12:54:17] ruby[bot]: djellemah: # => [2, 4] (https://eval.in/546242)
[12:54:18] infernix: has joined #ruby
[12:54:23] apeiros: Dysp: the second one is called "return value", and you assign it to whatever variable you want
[12:54:38] apeiros: or maybe even pass it on directly. objects don't have names.
[12:54:47] Dysp: I think I geti t.
[12:55:02] Dysp: Thats nice. Learning something new every day!
[12:55:15] Dysp: May I ask what you two do for a living?
[12:56:06] n008f4g_: has joined #ruby
[12:56:31] djellemah: write code, and occasionally help others write code :-p
[12:56:36] kobain: has joined #ruby
[12:56:41] Dysp: Sounds like a very noble doing!
[12:56:57] pawnbox: has joined #ruby
[12:57:35] Dysp: In your before mentioned solution, you write break if i >= stop_index
[12:57:42] Dysp: What is that exactly for?
[12:58:05] snowy: has joined #ruby
[12:58:11] pawnbox: has joined #ruby
[12:58:33] Dysp: Oh, that's what keeps it from going beyond the predefined size. Alright.
[12:59:05] johnmilton: has joined #ruby
[13:00:05] djellemah: It's only fair - I've been using open source software for years.
[13:00:13] jas02: has joined #ruby
[13:00:23] jas02: has left #ruby: ()
[13:01:28] millerti: has joined #ruby
[13:03:19] dvinciguerra__: has joined #ruby
[13:05:37] Xeago: has joined #ruby
[13:05:39] Dysp: djellemah: Im getting Wrong number of arguments.
[13:06:17] Dysp: Hm. Ill return. It's probably not what you provided.
[13:07:58] millerti: has joined #ruby
[13:12:26] sigurding: has joined #ruby
[13:13:37] aegis3121: has joined #ruby
[13:14:01] whippythellama: has joined #ruby
[13:14:10] blackmesa: has joined #ruby
[13:14:28] sgambino: has joined #ruby
[13:15:21] ekinmur: has joined #ruby
[13:16:52] Dysp: djellemah: I must have misunderstood something, because it's not working. Would you take a look? https://gist.github.com/anonymous/79f1363fb1e503ece11e2be64a04613c
[13:17:09] chagel: has joined #ruby
[13:17:11] Devalo: has joined #ruby
[13:18:29] apeiros: what I do for a living? I professionally pet squirrels.
[13:18:52] Dysp: Sounds like an enjoyable living.
[13:19:06] Dysp: I am a one-time-use lighter repairman.
[13:19:53] ocbtec: has joined #ruby
[13:20:20] Dysp: Btw, "wrong number of argument.."
[13:20:47] banister: has joined #ruby
[13:21:30] Xeago: has joined #ruby
[13:22:25] cdg: has joined #ruby
[13:22:35] aganov: has joined #ruby
[13:24:52] krobzaur: has joined #ruby
[13:25:12] malconis: has joined #ruby
[13:25:47] Xeago: has joined #ruby
[13:27:18] malconis: has joined #ruby
[13:27:21] last_staff: has joined #ruby
[13:28:21] sigurding_: has joined #ruby
[13:28:23] davedev24: has joined #ruby
[13:28:34] swills: has joined #ruby
[13:28:52] zapata: has joined #ruby
[13:30:07] rbennacer: has joined #ruby
[13:30:50] Dysp: djellemah: Alright. Pinned it down. a.reject.each_with_index{|v,i| break if i >= stop_index; v > 10} produced nil. Why?
[13:31:16] apeiros: because it hit break
[13:31:29] apeiros: and break returns from the method, letting the method return nil
[13:31:40] apeiros: (in case of no argument to break)
[13:32:01] apeiros: djellemah's code used reject!, and didn't make use of the return value - if memory serves right
[13:32:13] sdothum: has joined #ruby
[13:32:16] krz: has joined #ruby
[13:32:36] Dysp: That's true. But I don't want to modify the already existing array.
[13:32:42] Dysp: Because I use it later for something else.
[13:33:02] apeiros: then you have to dup, assing to a variable, apply the reject! there.
[13:33:12] apeiros: but djellemah's approach won't work in a non-destructive manner
[13:34:15] luise_: has joined #ruby
[13:35:02] platzhirsch: has left #ruby: ()
[13:35:21] Dysp: apeiros: How do I produce a dup?
[13:35:33] apeiros: &ri Object#dup
[13:35:33] `derpy: http://ruby-doc.org/core-2.3.0/Object.html#method-i-dup
[13:35:33] radza_: has joined #ruby
[13:35:33] Dysp: Looking it up
[13:36:45] Dysp: Yay. I got it to work.
[13:36:50] Dysp: I love you.
[13:36:54] millerti: has joined #ruby
[13:37:08] Dysp: Now, off for beers with the research lab. If you are in Copenhagen, feel free to join ;)
[13:37:43] elzid: has joined #ruby
[13:37:51] apeiros: a couple hundred kilometers to the south
[13:38:09] shevy: Dysp off for bears?
[13:38:55] Dysp: I haven't been up there yet, but I have no idea if are any bears.
[13:39:04] Dysp: But can' tell without being there, I guess.
[13:39:08] Dysp: I'll go look for bears.
[13:39:11] Dysp: See you all.
[13:39:48] adaedra: Silly danes, keeping the beer for themselves.
[13:41:08] ChiefAlexander: has joined #ruby
[13:42:11] chouhoulis: has joined #ruby
[13:42:49] platzhirsch: has joined #ruby
[13:45:05] elzid: Hi, newb Q: if :symbols are immutable, how does this work? https://gist.github.com/anonymous/6a1e4a2b85028de36b2a03dadf8b1793
[13:45:32] apeiros: elzid: where do you think a symbol is being mutated there?
[13:46:49] elzid: aperios: I would've thought that the if else blocks are checking to see if the options have been passed to the script and then either uses predefined default or assigns a value?
[13:46:52] BSaboia: has joined #ruby
[13:46:59] elzid: unless the actual assignment isn't happening there...
[13:47:06] AlexJakeGreen: has joined #ruby
[13:47:07] apeiros: ?tabnick elzid
[13:47:07] ruby[bot]: elzid: pro-tip - use tab completion for nicks. avoids typos in nicks.
[13:47:18] Rixius: has joined #ruby
[13:47:30] elzid: apeiros: great thanks!
[13:47:35] apeiros: elzid: you're referring to line 18-22?
[13:47:58] rippa: has joined #ruby
[13:48:03] elzid: apeiros: yes
[13:48:44] elzid: ok, it's setting a hash I suppose but why is a symbol being used as the key?
[13:48:58] elzid: and when does it become immutable?
[13:49:00] apeiros: the block is only invoked when the option is present. but I guess it can be invoked multiple times. but again, where is it mutating a symbol there?
[13:49:13] apeiros: a symbol is always immutable. it does not become immutable.
[13:49:25] apeiros: and a symbol is used as a key because that's something it's good at.
[13:50:35] nando293921: has joined #ruby
[13:53:26] elzid: apeiros: ok, am I right in thinking that the :symbol itself holds no value, rather it's only used as a key to a value, which is being reset depending on whether the option is present or not? Say the option is present, the @options hash already has that symbol set to a default value, how can it then set a different value. Unless my first sentence here is correct...
[13:53:42] apeiros: :symbol holds a value - itself
[13:53:58] elzid: apeiros: and that's not changing, so it's ok right?
[13:54:09] apeiros: but I think you're confusing the hash and its key
[13:54:30] apeiros: the only thing which is mutated there is the options hash. and that's - as said - a hash, which is mutable.
[13:54:41] apeiros: setting a value in a hash does in no way mutate the key - why would it?
[13:56:37] elzid: apeiros: precisely - that's where I got lost - I've not come across :symbols in anywhere else and when I found it in ruby, I was a little lost and then I tried to look for examples and found this. Confused myself. Many thanks for your help indeed.
[13:56:50] apeiros: would you have the same issues understanding what's going on if the keys where strings? would you think the strings are being mutated when assigning a value to the hash?
[13:57:05] elzid: apeiros: not at all
[13:57:07] bkxd: has joined #ruby
[13:57:14] elzid: it's the :symbol concept that done me!
[13:57:34] apeiros: you have to separate that. it's unrelated.
[13:57:34] triangles: has joined #ruby
[13:57:40] apeiros: you can use any object as a key in a hash.
[13:57:53] apeiros: and none is mutated by being used as a key.
[13:58:28] apeiros: and the :symbol concept is just a convenient way to have a "named number".
[13:58:37] GitGud: has joined #ruby
[13:58:51] elzid: apeiros: and the benefit of using a :symbol as hash key is because it's always the same underlying object and therefore more memory efficient?
[13:59:15] apeiros: that's one aspect. the other is that being a number makes comparison very fast.
[13:59:39] elzid: apeiros: ah yes, it has a string and number representation
[13:59:54] apeiros: yeah. the string is for us puny meatbags.
[14:00:15] lkba: has joined #ruby
[14:00:25] elzid: apeiros: cool
[14:00:27] skade: has joined #ruby
[14:00:32] elzid: thank you
[14:00:37] madgen: has joined #ruby
[14:00:58] apeiros: last but not least - everything with a name in ruby has that name identified by a symbol
[14:01:50] bronson: has joined #ruby
[14:02:58] joneshf-laptop: has joined #ruby
[14:03:03] elzid: apeiros: "everything with a name"?
[14:03:34] tubuliferous_: has joined #ruby
[14:03:36] apeiros: methods, local variables, instance variables, class variables, globals, …
[14:04:43] zast: has joined #ruby
[14:05:16] bkxd: has joined #ruby
[14:06:04] parduse: has joined #ruby
[14:06:09] pagios: has joined #ruby
[14:06:31] pagios: has left #ruby: ("Leaving")
[14:06:44] pagios: has joined #ruby
[14:07:17] pagios: hello, i have a field that reads a date in utc format, i would like to create a query to select the dates that happen to be a friday, what is the best way to do it thanks.
[14:07:24] idle_task: has joined #ruby
[14:07:26] Silox|: has joined #ruby
[14:08:04] apeiros: pagios: the question as asked feels a bit like "please do it for me". to avoid that, please, show us what you've tried so far.
[14:08:33] pagios: apeiros, i tried .where (date.wday == 5)
[14:08:55] apeiros: ok, so we're indeed talking about activerecord
[14:09:49] apeiros: that'd be #rubyonrails. but what you have to do: instead of date.wday == 5, write that part as SQL. i.e. find your db's sql docs, and in there the appropriate date functions.
[14:10:49] stannard: has joined #ruby
[14:12:35] machinewar: has joined #ruby
[14:12:58] machinewar: is there a way to parse a csv string line by line? I know I could open a csv file and call readline
[14:13:13] machinewar: but I have a string and want to parse it line by line without using a block because some lines might have encoding issues
[14:13:16] apeiros: machinewar: check CSV lib's docs.
[14:13:19] apeiros: and yes, there is a way.
[14:13:30] apeiros: ah, a string
[14:13:30] hxegon: has joined #ruby
[14:13:37] machinewar: apeiros: currently looking in there
[14:13:38] grill: has joined #ruby
[14:13:43] machinewar: its already been opened from a file
[14:13:44] apeiros: StringIO might work
[14:13:54] skweek: has joined #ruby
[14:13:55] machinewar: apeiros: okay will check thanks
[14:13:57] apeiros: though why'd you parse it line by line if you have it already in memory?
[14:14:09] apeiros: ACTION should learn to read
[14:14:32] pagios: apeiros, i didnt get it
[14:14:44] machinewar: ahh maybe StringIO#each_line and pass that to CSV#parse_line
[14:15:02] apeiros: machinewar: no
[14:15:08] apeiros: a csv record can contain a newline
[14:15:16] apeiros: otherwise I'd have told you to use string.each_line
[14:15:31] pagios: apeiros, where('extract(day from date_column) = ?', desired_day_of_month)
[14:15:38] snowy: has joined #ruby
[14:16:01] apeiros: pagios: looks like the right direction. but you wanted day_of_week, no?
[14:16:16] Xiti: has joined #ruby
[14:16:22] apeiros: don't know about the sql function, since you failed to mention the db you use…
[14:16:37] apeiros: ?crosspost pagios
[14:16:37] ruby[bot]: pagios: Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
[14:16:49] apeiros: count me out on this question.
[14:18:12] workmad3: has joined #ruby
[14:18:18] fexilal: has joined #ruby
[14:18:23] khaki: has joined #ruby
[14:18:24] Rubie: has joined #ruby
[14:20:33] Yiota: has joined #ruby
[14:20:41] dhollinger: has joined #ruby
[14:20:41] barajasfab: has joined #ruby
[14:20:45] cpruitt: has joined #ruby
[14:21:03] imperator: has joined #ruby
[14:21:08] imperator: good morning
[14:21:24] imperator: just tinkering with a local proxy server that i'm using for testing: https://gist.github.com/djberg96/e9eca6387bca29043c0f1ec82a0b0352
[14:21:48] bry4n_: has joined #ruby
[14:21:52] imperator: but, confused why i can still connect without enabling SSL or using an https string
[14:25:09] nobitanobi: has joined #ruby
[14:25:23] sdothum: has joined #ruby
[14:25:44] imperator: e.g. this works: "curl -x localhost:8080 -U admin:passxxx123 http://www.google.com", but i would have expected the --ssl option to be required
[14:29:36] pagios: has left #ruby: ("Leaving")
[14:30:11] hiyosi: has joined #ruby
[14:30:51] RegulationD: has joined #ruby
[14:34:33] Donkoko: has joined #ruby
[14:37:14] Zai00: has joined #ruby
[14:37:57] djellemah: imperator: looks like HTTPProxyServer.new just ignores options it doesn't recognise, including SSLEnable.
[14:38:08] Macaveli_: has joined #ruby
[14:39:00] kies: has joined #ruby
[14:39:27] speakingcode: has joined #ruby
[14:39:45] imperator: djellemah, WEBrick::HTTPProxyServer ignores :SSLEnable ?
[14:40:28] norc: has joined #ruby
[14:41:09] Rubie: has joined #ruby
[14:41:19] imperator: it is a subclass of HTTPServer, which (supposedly) recognizes it, right?
[14:42:09] aeterne: has joined #ruby
[14:43:35] snowy: has joined #ruby
[14:44:27] jaruga_: has joined #ruby
[14:44:32] imperator: maybe it's the authenticator
[14:44:47] Ropeney: imperator, I wonder if https://github.com/nahi/webrick/blob/master/lib/webrick.rb#l151 and dropping permissions has something to do with it
[14:45:06] jaruga_: has joined #ruby
[14:45:27] baweaver: has joined #ruby
[14:46:22] dtzuzu: has joined #ruby
[14:47:03] norc: apeiros, Im close to pulling my hair out. It seems that aroea (activerecord-oracle_enhanced-adapter) is quite easy to break when you have it generate WHERE xxx IN (...) fragments with lists over 1000 entries. How do you deal with these random bugs..
[14:47:14] norc: Or the recent bug where the adapter randomly drops connection...
[14:47:36] havenwood: https://bugs.ruby-lang.org/issues/12240
[14:48:13] norc: havenwood, wtf...
[14:48:34] norc: I mean I get it, but that is a bit silly.
[14:48:44] bronson: has joined #ruby
[14:49:02] imperator: ah, april 1st, i should just stay offline today
[14:49:06] havenwood: norc: yeah, when perfectly good emoji are available: 0️⃣1️⃣2️⃣
[14:49:09] shevy: imperator lol
[14:49:39] shevy: imperator I almost fell for another suggestion
[14:49:54] symm-: has joined #ruby
[14:50:00] tildes: has joined #ruby
[14:50:22] helpa: has joined #ruby
[14:50:30] shevy: We need endddd
[14:50:48] Zai00: has joined #ruby
[14:51:33] imperator: ACTION is guilty of this sort of stuff, too, but hasn't done it for many years
[14:52:19] roelof: has joined #ruby
[14:52:20] Xeago: has joined #ruby
[14:52:24] Hanmac: i hate the april ... i feel so trolled by the weather :/ yesterday it was warn outside, today it was snowing oO
[14:52:27] norc: We had the funniest and weirdest announcement today, with the most unlikely change of department heads - sad thing is its not an april fools joke. :-(
[14:52:28] stunder: has joined #ruby
[14:53:06] roelof: how to make this case work : https://gist.github.com/rwobben/9c8fbff1672b9f481260e7737b08b11e
[14:53:36] adaedra: you may want to give more details.
[14:53:44] adaedra: how is it not working?
[14:53:56] norc: roelof, implement the === operator for the relevant, that is what case uses under the hood
[14:54:02] norc: *for the relevant class.
[14:54:51] roelof: norc: so I have to use the == for a case
[14:54:59] norc: roelof, no.
[14:55:20] RegulationD: has joined #ruby
[14:55:25] roelof: sorry, the === is what you talk about
[14:56:07] roelof: I was hoping I could use a case instead of a big nested if then
[14:56:29] shevy: hanmac really snowing??? it was hot here too yesterday, today it is cloudy and a bit rainy... but no snow
[14:56:47] roelof: norc: so I have to make my custom === function ?
[14:56:48] mistermocha: has joined #ruby
[14:57:03] norc: roelof, nevermind, I wasnt really looking at your code when I made that remark.
[14:57:15] hxegon: has joined #ruby
[14:57:17] roelof: here it is sunny and some 16 degrees ( The Netherlands
[14:57:19] Hanmac: shevy: it was at morning around 4-9am, now its warm again
[14:57:20] dipnlik: has joined #ruby
[14:57:59] roelof: norc: oke, np
[14:58:01] threh: has joined #ruby
[14:58:04] loc22: has joined #ruby
[14:58:08] roelof: someone else who can help me ?
[14:58:11] norc: roelof, case sends the === method to woord, passing the the result of each expression in "when exp" and stopping when it yields a truey result
[14:58:24] loc22: has joined #ruby
[14:58:34] norc: roelof, do not use case here, its not what you think it is. ;-)\
[14:58:44] tjohnson: has joined #ruby
[14:59:11] roelof: oke, what can I do then the best. I use a big if then and that looks not good
[14:59:28] norc: In your case it would constantly check whether word === true or word === false which is probably not what you meant.
[14:59:33] B1n4r10: has joined #ruby
[14:59:39] dipnlik: hi all. i have a few rails apps that are still running in ruby 2.0.0, any upgrade tips/tutorials are welcome. should I go straight to 2.3? anything special I should look for?
[14:59:43] albercuba: has joined #ruby
[14:59:52] andikr: has joined #ruby
[15:00:24] norc: ?rubyonrails dipnlik
[15:00:24] ruby[bot]: norc: I don't know anything about rubyonrails
[15:00:26] roelof: norc: so a lot of if then's would be better /
[15:00:27] norc: ?rails dipnlik
[15:00:27] ruby[bot]: dipnlik: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[15:00:40] albercuba: hello everyone, why if I run apt-get install ruby2.0 it installs ruby1.9.1 and sets it as default
[15:00:53] freerobby: has joined #ruby
[15:00:57] norc: roelof, probably not. Im trying to figure out what you are trying to do, i.e. what your "translation" is trying to do.
[15:01:44] norc: albercuba, the plain ubuntu way would be: sudo update-alternatives --config ruby
[15:02:00] albercuba: norc ok i am going to try that
[15:02:12] norc: albercuba, note that most people here do not use repo supplied ruby though, as ruby-install with chruby offers the most up-to-date versions while easily managing multiple verisons.
[15:02:15] dipnlik: norc: thought asking here was more appropriate but will try there too, thanks
[15:02:24] joonty: has joined #ruby
[15:02:45] havenwood: albercuba: Brightbox ships up-to-date Ruby packages for Ubuntu: https://www.brightbox.com/docs/ruby/ubuntu/
[15:02:56] norc: Or that. :)
[15:03:26] helpa: has joined #ruby
[15:03:31] havenwood: dipnlik: 2.2.4 or 2.3.0!
[15:03:37] roelof: norc: I try to make a pig latin function so it has to translate words or sentences to some rules explained here : http://lpaste.net/158081
[15:03:42] pardusf: has joined #ruby
[15:03:59] ChiefAlexander_: has joined #ruby
[15:04:06] norc: albercuba, https://bugs.launchpad.net/ubuntu/+source/ruby2.0/+bug/1310292
[15:04:18] norc: From a quick glance it seems to be bugged.
[15:04:33] albercuba: norc, http://paste.ee/p/tevsA
[15:05:01] jolts: has joined #ruby
[15:05:33] apeiros: norc: was commuting
[15:05:54] apeiros: norc: where possible: manually create subqueries. in many cases that can be done by simply having an ARRelation in the where clause
[15:05:55] bkxd: has joined #ruby
[15:06:03] apeiros: norc: where not possible, we do batches
[15:06:04] norc: albercuba, if you make changes to your bash the changes will not persist. You have to add those to your .bash_profile (or .bashrc)
[15:06:14] apeiros: and yes, it's annoying to no end
[15:06:15] darix: albercuba: you could try update-alternatives --config ruby
[15:06:20] jolts: has joined #ruby
[15:06:21] darix: and configure it to ruby 2
[15:06:35] albercuba: darix, i get update-alternatives: error: no alternatives for ruby
[15:06:35] apeiros: but I'm really looking forward to mssql which I've been informed is catastrophic with subqueries :D
[15:06:36] hxegon: has joined #ruby
[15:06:56] ncopa: has joined #ruby
[15:07:03] ChiefAle_: has joined #ruby
[15:07:13] ncopa: hi is the the channel for discussing bugs in ruby itself?
[15:07:15] norc: apeiros, well in all fairness, its not as much the databases, as it is the fact that only few people use oracle or mssql, so there are not many people actively contributing.
[15:07:23] havenwood: MySQL announced they're self-deprecating in favor of DBM, so might as well just use DBM.
[15:07:37] apeiros: havenwood: mssql, not mysql
[15:07:38] havenwood: ncopa: It's for Ruby! (Bugs and all.)
[15:07:47] norc: ncopa, sure, you have come to the right place.
[15:07:51] havenwood: apeiros: Oooh! :)
[15:08:03] apeiros: I'm not quite sure which of the two I find worse, though
[15:08:08] albercuba: It is amazing ahving this problem in an LTS
[15:08:17] ncopa: there is an interesting bug with ruby built with musl libc: in string::include? https://github.com/docker-library/ruby/issues/77
[15:08:25] ncopa: i wonder what source file i should look in
[15:08:45] dipnlik: havenwood: running my specs in 2.3.0, so far so good
[15:08:48] norc: ncopa, you have caught my undivided attention.
[15:08:53] havenwood: dipnlik: :D
[15:09:07] roelof: is this more the ruby way ? http://lpaste.net/158082
[15:09:28] roelof: so I can make later a lot of if then on every case ?
[15:10:18] norc: roelof, try it and see what happens.
[15:10:18] havenwood: roelof: "Words" is the plural. Though I like "woord" as the singular. :P
[15:10:29] norc: Its better than me telling you it wont do what you expect it to.
[15:11:05] norc: havenwood, guess he was scared about the block param not shadowing the outer lvar. :p
[15:11:07] ncopa: norc: where can i find where string::include? is implemented? I suppose its implemented in C
[15:11:16] norc: ncopa, yes it is, give me one second.
[15:11:19] havenwood: norc: Ah, I see! I'm slow today, headache...
[15:11:37] apeiros: norc: re "not as much the db" - sure, more users/contributors would yield better drivers. but that limit is just ridiculous.
[15:11:47] norc: ncopa, https://github.com/ruby/ruby/blob/trunk/string.c#L5212-L5221
[15:11:51] norc: ncopa, that is the entry point.
[15:11:51] Rubie: has joined #ruby
[15:11:58] roelof: havenwood: yes, words for me is the same as a sentence where woord is the Dutch word for word
[15:12:05] havenwood: roelof: nice
[15:12:18] ncopa: norc: thanks!
[15:12:18] roelof: Later it must be working on more then 1 word
[15:12:24] norc: ncopa, be prepared for a hell of the worst undocumented string manipulation library you have ever seen.
[15:12:26] norc: You have been warned.
[15:12:54] norc: We will see if you still thank me if you come back...
[15:13:03] roelof: havenwood: maybe I can better name words -> sentence and woord -> word ?
[15:13:14] ncopa: We will see if i come back at all...
[15:13:17] x77686d: has joined #ruby
[15:13:37] havenwood: roelof: Did you try it out in irb/pry yet?
[15:13:39] stunder: has joined #ruby
[15:13:39] roelof: but then it looks like the function only works on sentences where it also works on a single word
[15:13:50] roelof: yep, this case is working
[15:14:09] roelof: I use irb , pry I did not learned to use yet
[15:15:02] norc: roelof, be careful. Once you try out pry you will never use irb again.
[15:15:11] roelof: hmm, maybe I can better use *words so it's clear it can work on one or more words ?
[15:15:17] millerti: has joined #ruby
[15:15:23] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[15:15:32] Yiota: has joined #ruby
[15:15:54] whippythellama: has joined #ruby
[15:16:03] roelof: wierd, I see a 404 error on that page about pry
[15:17:09] havenwood: roelof: Check non-vowel words.
[15:17:27] Suntzu: has joined #ruby
[15:17:39] roelof: that is the next step
[15:18:43] apeiros: should we have ?irb -> irb, the better pry, …
[15:18:57] skweek: has joined #ruby
[15:19:17] ruby[bot]: irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
[15:19:53] grill: what exactly does this line do, assuming flags['file-list'] is an array, and build_differ.changed_files is a hash? flags['file-list'] ||= []).concat(build_differ.changed_files)
[15:20:40] baweaver: has joined #ruby
[15:20:54] norc: grill, ||= is a conditional assign, that assigns to the left side if its either nil or not declared
[15:20:57] apeiros: grill: it should raise
[15:21:12] apeiros: grill: but I'd bet changed_files isn't a hash
[15:21:22] rkazak: has joined #ruby
[15:21:27] ncopa: $ ruby -e 'puts "xxxAy".index "Azzz"'
[15:21:28] ncopa: thats a bug^^
[15:21:28] grill: it does raise
[15:21:37] norc: >> puts "xxxAy".index "Azzz"
[15:21:39] ruby[bot]: norc: # => ...check link for more (https://eval.in/546386)
[15:22:01] apeiros: grill: then… why your question? you already know what it does.
[15:22:02] pawnbox: has joined #ruby
[15:22:02] norc: ncopa, this is just alpine related, right?
[15:22:12] norc: ncopa, what specific version are you using?
[15:22:16] imperator: has left #ruby: ("Leaving")
[15:22:22] grill: apeiros i wanted to test your knowledge of ruby
[15:22:23] apeiros: norc: drop the puts ;-)
[15:22:39] ncopa: norc: ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux-musl]
[15:22:41] grill: or maybe i just needed to know what a conditional assign was
[15:22:46] ncopa: note the "musl" libc
[15:22:51] al2o3-cr: has joined #ruby
[15:23:21] Maletor: has joined #ruby
[15:23:30] roelof: havenwood: this http://lpaste.net/158083 breaks the vowel case :( . What went wrong ?
[15:23:41] apeiros: grill: but the conditional assignment is unrelated to the code raising
[15:23:42] d0nn1e: has joined #ruby
[15:23:54] ncopa: norc: you can reproduce with docker: $ docker run ruby:2.3-alpine ruby -e 'puts "xxxAy".index "Azzz"'
[15:23:55] apeiros: it's raising because you try to concat a hash to an array.
[15:24:03] grill: apeiros it is related to my understanding!
[15:24:27] ncopa: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
[15:24:55] havenwood: roelof: Whatever line 4 returns is what is joined, no matter what line 3 does.
[15:25:01] roelof: havenwood: something is wrong with the second if then but I cannot see why
[15:25:12] norc: grill, a ||= b is almost (!) the same as a = a || b
[15:25:29] karioleez: has joined #ruby
[15:25:37] havenwood: roelof: Line four returns your String or nil.
[15:25:50] FooMunki: has joined #ruby
[15:25:54] havenwood: >> [nil, nil, nil].join
[15:25:55] ruby[bot]: havenwood: # => "" (https://eval.in/546390)
[15:25:59] norc: grill, actually no, it is exactly the same.
[15:26:01] norc: That is interesting.
[15:26:14] norc: >> a = a || 1
[15:26:15] ruby[bot]: norc: # => 1 (https://eval.in/546391)
[15:26:18] norc: asm>> a = a || 1
[15:26:19] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/546392
[15:26:30] roelof: wierd, If I comment out line 4 , line 3 is given the right code for example apple
[15:26:44] apeiros: norc: it's not, though :)
[15:26:47] apeiros: but let's see
[15:26:48] havenwood: norc: ||= doesn't do the assignment if not a
[15:26:53] apeiros: >> A ||= 1
[15:26:54] ruby[bot]: apeiros: # => 1 (https://eval.in/546393)
[15:26:54] havenwood: norc: so it differs
[15:26:57] apeiros: ast>> A ||= 1
[15:26:58] ruby[bot]: apeiros: I have parsed your code, the result is at https://eval.in/546394
[15:27:21] phpwebdev: has joined #ruby
[15:27:25] roelof: havenwood : line 3 is supposed to work on a vowel and line4 on a non-vowel word
[15:27:37] havenwood: roelof: Yet line 4 is what is always returned.
[15:27:42] apeiros: asm>> A ||= 1
[15:27:42] norc: havenwood, a = a || 1 would not either.
[15:27:43] ruby[bot]: apeiros: I have disassembled your code, the result is at https://eval.in/546397
[15:27:53] havenwood: roelof: Line three is swallowed into the abyss.
[15:28:03] havenwood: roelof: yeah huh
[15:28:16] havenwood: norc: a is assigned to a there
[15:28:21] roelof: sorry , I do not understand what you mean
[15:28:28] roelof: havenwood: ^^
[15:28:32] Donkoko: Anyone has an idea why when we render our rails app within Facebook canvas the session gets destroyed and we get logged out, even tho we are still logged in, in another tab? Seems like the cookie is conflicting somehow with FB but cant figure out why and how.
[15:28:53] havenwood: >> [1, 2, 3].map { |n| 'not this'; 'nor this'; 'but this' }
[15:28:54] ruby[bot]: havenwood: # => ["but this", "but this", "but this"] (https://eval.in/546399)
[15:29:25] norc: havenwood, nope, 1 is assigned to a, which is confusing as heck, because this is the first time I see uninitialized lvars in Ruby.
[15:29:34] hxegon: has joined #ruby
[15:29:36] ncopa: how do i test run ruby built from git?
[15:29:38] ncopa: $ ./ruby -e 'puts "hello"'
[15:29:38] ncopa: <internal:gem_prelude>:4:in `require': cannot load such file -- rubygems.rb (LoadError)
[15:29:53] norc: ncopa, install it. Build it with some prefix.
[15:29:57] havenwood: norc: right, i should have actually looked at your example :P
[15:30:13] havenwood: norc: still different though :P
[15:30:14] shevy: he thought you were april joking!
[15:30:20] norc: ncopa, I usually install mine in .rubies/whatever_version_I_implease and then chruby them
[15:30:26] element_zer0: has joined #ruby
[15:30:29] norc: havenwood, nope
[15:30:32] norc: >> a = a || 1
[15:30:33] ruby[bot]: norc: # => 1 (https://eval.in/546400)
[15:30:37] norc: >> a ||= 1
[15:30:38] ruby[bot]: norc: # => 1 (https://eval.in/546401)
[15:30:39] havenwood: norc: http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html
[15:32:19] freerobby: has joined #ruby
[15:32:24] halfamind: has joined #ruby
[15:32:38] roelof: havenwood: thanks, I think I will use a if then elsif
[15:32:47] nando293921: has joined #ruby
[15:32:53] norc: havenwood, meh that is a really edgy case being mentioned. :P
[15:32:58] roelof: seperate if then's do not work as I expect
[15:33:05] norc: Though the curious part it this:
[15:33:09] norc: asm>> a ||= 1
[15:33:10] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/546402
[15:33:12] freerobby: has joined #ruby
[15:33:45] norc: That lvar is never initialized. :S
[15:34:08] norc: Im guessing that it gets automatically initialized with nil though.
[15:34:14] havenwood: `a ||= b` behaves like `a || a = b` is true!
[15:34:34] havenwood: still || then equal, just an a crammed in there
[15:34:39] norc: havenwood, if a is just a tIDENTIFIER yes.
[15:35:35] abyx: has joined #ruby
[15:35:39] havenwood: if `a` calls out to assembly that changes the runtime to be different then it isn't the same, and other cases :P
[15:36:12] norc: >> a = a
[15:36:13] ruby[bot]: norc: # => nil (https://eval.in/546403)
[15:36:23] norc: Hah. I even know why this works, this is hilarious.
[15:36:25] _stu_: has joined #ruby
[15:36:45] norc: Thank god for this brilliant magical lexer we have.
[15:37:35] parduse: has joined #ruby
[15:37:37] havenwood: >> [0,-42, 1].public_send (a = a).inspect.next.reverse
[15:37:39] ruby[bot]: havenwood: # => -42 (https://eval.in/546404)
[15:37:56] ncopa: i can reproduce with current git: $ ~/.rubies/git/bin/ruby -e 'puts "xxxAy".index "Azzz"'
[15:37:58] marxarelli: has joined #ruby
[15:38:05] ruby[bot]: norc: # => nil (https://eval.in/546405)
[15:38:09] norc: What a wonderful way of representing nil.
[15:38:47] norc: ncopa, but with musl libc right?
[15:38:57] ncopa: $ ~/.rubies/git/bin/ruby -e 'puts "HELLO".index "Ozz"'
[15:39:00] norc: Which version are you linking against?
[15:39:20] GnuYawk: has joined #ruby
[15:39:24] ncopa: $ apk version musl
[15:39:24] ncopa: Installed: Available:
[15:39:24] ncopa: musl-1.1.14-r6 = 1.1.14-r6
[15:39:31] GnuYawk: has joined #ruby
[15:39:41] ncopa: its 1.1.14 + some backported patches from git
[15:41:21] chagel: has joined #ruby
[15:41:42] dvinciguerra: has joined #ruby
[15:42:27] havenwood: norc: If you're using that for nil maybe this for true:
[15:42:30] havenwood: >> (a = a).public_send (a = a).inspect + ??
[15:42:31] ruby[bot]: havenwood: # => true (https://eval.in/546407)
[15:42:35] LaT0rtue: has joined #ruby
[15:43:51] mjc_: has joined #ruby
[15:44:02] dtzuzu: has joined #ruby
[15:45:21] havenwood: i guess this is nicer: (a = a).send(a.inspect<<??)
[15:45:28] norc: havenwood, I would have expected that to yield false actually...
[15:45:41] norc: Im wondering whether that might even be a bug.
[15:46:00] norc: Oh wait, nevermind wrong thinking all good.
[15:46:22] norc: havenwood, I just dislike the inspect there. Its giving away too much.
[15:46:53] ruby[bot]: norc: # => /tmp/execpad-b512a4d4c15a/source-b512a4d4c15a:2: warning: string literal in condition ...check link for more (https://eval.in/546412)
[15:46:55] norc: Is the nicer true.
[15:46:57] ruby[bot]: havenwood: # => true (https://eval.in/546413)
[15:46:59] roelof: what is the best alternative for this structure : if then elsif if then else elsif and so on ?
[15:47:02] havenwood: norc: how about that ^ :)
[15:47:30] norc: roelof, generally case.. it just didnt fit your original problem.
[15:47:42] norc: havenwood, think I prefer the !!??
[15:48:24] roelof: oke, how do I then make a case which checks for vowels, non-vowels and multiple non-vowels at the beginning norc ?
[15:48:27] havenwood: depends on the goal i suppose
[15:48:29] norc: >> _=_???:!!??
[15:48:30] ruby[bot]: norc: # => /tmp/execpad-4dcf1396f587/source-4dcf1396f587:2: syntax error, unexpected ':', expecting keyword_end ...check link for more (https://eval.in/546416)
[15:48:31] norc: something along those lines.
[15:48:53] norc: okay.. why isnt that parsing?
[15:50:39] bratchley: has left #ruby: ()
[15:50:45] norc: roelof, you could do the following. Build a comparator class which defines the method === and accept a symbol as a parameter which could be :vowel :non_vowel :multiple_non_vowel and does its logic there.
[15:50:56] diegoaguilar: has joined #ruby
[15:51:57] pawnbox: has joined #ruby
[15:52:01] norc: roelof, MyComparator = Struct.new(word) { def ===(sym) case(sym) when :vowel then (exp) else raise UnknownSymbol end; end }
[15:52:41] norc: where exp does the actual test and returns with false or true depending on whether it has say a single vowel
[15:53:53] bronson: has joined #ruby
[15:54:02] mostlybadfly: has joined #ruby
[15:54:33] ascarter_: has joined #ruby
[15:55:10] stunder: has joined #ruby
[15:55:44] roelof: norc: thanks, I will play with it
[15:55:47] ascarter: has joined #ruby
[15:56:32] norc: roelof, https://eval.in/546418
[15:56:36] norc: there is a working example to show what I mean.
[15:57:06] ascarter: has joined #ruby
[15:57:08] norc: Updated. I really should have gisted this: https://eval.in/546419
[15:57:18] Asher: has joined #ruby
[15:57:29] gregf: has joined #ruby
[15:59:47] marr: has joined #ruby
[16:00:24] roelof: thanks, now time for dinner
[16:01:12] amclain: has joined #ruby
[16:04:43] norc: roelof, you could also simply use "case true ..." or try to use regular expressions, so you have a couple options there.
[16:05:03] Donkoko: roelof: bon apetit
[16:05:27] stunder: has joined #ruby
[16:06:23] uglybandersnatch: has joined #ruby
[16:07:32] grill: how can i force rake to repackage a gem?
[16:07:44] gizmore: has joined #ruby
[16:08:03] apeiros: grill: rake -T
[16:08:11] apeiros: because that's not a rake feature. it depends on the gem's rakefile
[16:08:41] millerti: has joined #ruby
[16:08:57] apeiros: e.g. none of my gems even have a task to package a gem. `gem build *.gemspec` is easy enough.
[16:09:05] Donkoko: grill: gem build <gemspec>
[16:10:01] Donkoko: grill: if you want to push to Rubygems.ord `gem push <built gem>`
[16:10:13] benlieb: has joined #ruby
[16:10:32] duderonomy: has joined #ruby
[16:10:59] norc: apeiros, you were one one of the people here writing your own language, does my memory serve me right here?
[16:11:14] apeiros: yes. been a while since I worked at it, though.
[16:11:45] kobain: has joined #ruby
[16:11:50] norc: Was the project ever publicly hosted?
[16:12:11] apeiros: oh, you're not in #ruby-offtopic?
[16:14:57] eljimbo: has joined #ruby
[16:15:55] Rubie: has joined #ruby
[16:18:49] Frem: has joined #ruby
[16:19:00] aspiers: anyone know of a stdlib or gem method which can convert Arrays like [1, 2, 3, 5, 7, 8, 10] to a string "1-3,5,7-8,10" ?
[16:19:25] apeiros: aspiers: nothing in stdlib. but let me scour my snippets lib. I think I wrote that once.
[16:19:57] aspiers: I love that you obviously memorised most of stdlib in order to be able to answer that ;-)
[16:20:25] hxegon: has joined #ruby
[16:20:53] apeiros: aspiers: it pays off to know core/stdlib
[16:21:19] Donkoko: your names look so much a like at first I thought aspiers is talking to himself/herself
[16:21:30] aspiers: Donkoko: it's not the first time we've been confused
[16:21:37] apeiros: Donkoko: we could still be the same person!
[16:21:39] aspiers: I often get misdirected messages
[16:21:57] chouhoulis: has joined #ruby
[16:22:05] apeiros: I believe I found my snippet
[16:22:13] aspiers: one of us should swap an 'o' for an 's' so we can be anagrams
[16:22:15] pawnbox: has joined #ruby
[16:22:30] aspiers: my childhood nickname was actually spiro
[16:22:52] Donkoko: aspiers: I also had a friend we called Spiro :)
[16:22:59] apeiros: aspiers: https://gist.github.com/apeiros/5ac337c6702387d965924f2d21497765
[16:23:13] apeiros: gets you an array of ranges. only a tiny step from there.
[16:24:30] aspiers: apeiros: great! worth gemifying, maybe? :)
[16:24:39] apeiros: are we npm? o0
[16:24:52] apeiros: if you want, feel free to package it as a gem
[16:25:09] aspiers: I was just gonna say, then in a few years time, you could yank it and cause leftpad-gate II
[16:25:41] aspiers: I have a few other things which need gemifying - this might be good practice
[16:25:42] norc: apeiros, meh. at least put it inside a refinement? :p
[16:25:45] aspiers: what would be a good name?
[16:25:54] Suntzu: has joined #ruby
[16:26:03] aspiers: ACTION wonders what a refinement is
[16:26:14] stunder: has joined #ruby
[16:26:21] apeiros: norc: that code is from well before refinements
[16:26:23] norc: aspiers, one of the better recent features.
[16:26:36] aspiers: norc: in npm?
[16:26:38] norc: &ri Refinement
[16:26:38] `derpy: No results
[16:26:43] rodfersou: has joined #ruby
[16:26:44] apeiros: you forget that I wrote ruby when it was still young! (well, not really young, but…)
[16:26:53] norc: &ri refinements
[16:26:53] `derpy: No results
[16:27:04] apeiros: &ri Kernel#using
[16:27:04] `derpy: No results
[16:27:06] aspiers: I wrote my first Ruby in 2001, I think
[16:27:07] norc: aspiers, http://ruby-doc.org/core-2.3.0/doc/syntax/refinements_rdoc.html
[16:27:17] apeiros: eh, silly me
[16:27:20] drewo: has joined #ruby
[16:27:24] apeiros: &ri Module#using
[16:27:25] `derpy: http://ruby-doc.org/core-2.3.0/Module.html#method-i-using
[16:27:37] norc: aspiers, it is an elegant way of modifying classes you dont own with a greatly reduced chance of breaking things in the long run.
[16:27:52] aspiers: oh, that's awesome
[16:27:54] norc: (Though formally modifying classes you dont own is not elegant in the first place)
[16:27:55] Balzrael: has joined #ruby
[16:28:11] aspiers: I'm not sure I agree 100% with that last statement
[16:28:21] apeiros: norc: but that's the point of refinements - you don't modify the class
[16:28:35] norc: apeiros, duck typing, its effectively the same.
[16:28:54] apeiros: norc: even with duck typing, it's still global
[16:28:56] xue: has joined #ruby
[16:29:02] apeiros: refinements are lexically scoped
[16:29:15] apeiros: and that's what makes them more robust for their intended purpose than other solutions
[16:29:53] KensoDev: has joined #ruby
[16:29:54] norc: apeiros, had that discussion with someone else the other day. Usually when people modify foreign classes, subclassing is the better solution.
[16:30:07] apeiros: I disagree
[16:30:08] _blizzy_: has joined #ruby
[16:30:19] apeiros: subclassing classes you don't own is a bad idea
[16:30:28] apeiros: stuff you don't own -> composition over inheritance
[16:30:48] apeiros: but refinements are IMO playing in a different area
[16:32:41] cdg: has joined #ruby
[16:33:08] yxhuvud: apeiros: there are people that actually use refinements?
[16:33:54] apeiros: I'd assume so. I myself only started playing with it. and only recently. so I still haven't fully made up my mind.
[16:34:26] norc: yxhuvud, the main place where I use them to a great extend is my rails projects where I make all kinds of modifications to some of the core classes of ActiveRecord and ActiveSupport.
[16:34:39] apeiros: one short-coming I found with them was that it's hard to provide a way to do multiple separate refinements in a single go
[16:34:40] baweaver: has joined #ruby
[16:34:59] blackjid: has joined #ruby
[16:35:30] norc: asm>> a = "foo"; puts a
[16:35:31] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/546437
[16:35:47] apeiros: by that I mean: think of something of the scope of ActiveSupport - if you have to pull in each atomic refinement on its own then your code starts with 200 lines of "using …"
[16:36:06] ascarter: has joined #ruby
[16:36:09] norc: asm>> puts "#{""}"
[16:36:09] apeiros: it'd be nice to allow a way to enable "using ActiveSupport::All"
[16:36:10] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/546438
[16:36:22] apeiros: (in whichever way)
[16:36:32] B1n4r10: has joined #ruby
[16:36:58] hightower3: has joined #ruby
[16:37:02] dopie: has joined #ruby
[16:37:29] benlieb: has joined #ruby
[16:37:32] pawnbox: has joined #ruby
[16:38:03] loc22: has joined #ruby
[16:38:10] norc: apeiros, you could easily do that by providing a wrapper module and using the included hook no?
[16:38:15] xblade: has joined #ruby
[16:38:59] apeiros: norc: not sure that way would work. I do have a solution, though. but it'd be nice if there was a native solution.
[16:39:18] apeiros: my solution requires you to intercept the block evaluated in the refinement
[16:41:10] CausaMortis: has joined #ruby
[16:41:58] shinnya: has joined #ruby
[16:42:04] norc: apeiros, Module#using is not permitted in methods (RuntimeError)
[16:42:15] norc: There goes my brilliant plan.
[16:42:36] apeiros: even if it was permitted
[16:42:40] apeiros: it's lexically scoped
[16:42:57] apeiros: that's why my solution "comes from the other side", so to speak
[16:43:03] fedexo: has joined #ruby
[16:43:13] apeiros: I compose the refinement module on the fly
[16:43:49] apeiros: i.e., `using Jacob::Support(:String, :Array)`
[16:45:00] norc: Oh well, guess it would not make much sense what I was trying indeed.
[16:47:50] sandstrom: has joined #ruby
[16:49:25] mistermo_: has joined #ruby
[16:49:28] Guest58: has joined #ruby
[16:52:13] Aviio: has joined #ruby
[16:54:21] shevy: oh you monad you!
[16:56:26] _stu_: has joined #ruby
[16:57:17] freerobby: has joined #ruby
[16:58:14] pawnbox: has joined #ruby
[16:58:35] gizmore: Promise.new{"after all"}
[16:58:40] chagel: has joined #ruby
[17:00:04] kam270: has joined #ruby
[17:00:11] johnmilton: has joined #ruby
[17:00:32] Renich: has joined #ruby
[17:00:35] ivanskie_work: has joined #ruby
[17:00:45] ramfjord: has joined #ruby
[17:01:10] baweaver: has joined #ruby
[17:01:49] stantona: has joined #ruby
[17:03:39] platzhirsch: has left #ruby: ()
[17:03:55] mtkd: has joined #ruby
[17:04:19] blandflakes: has joined #ruby
[17:06:46] bkxd: has joined #ruby
[17:14:31] davedev24: has joined #ruby
[17:15:43] mikecmpbll: has joined #ruby
[17:15:48] pawnbox: has joined #ruby
[17:15:53] mrgrieves: has joined #ruby
[17:18:51] Devalo: has joined #ruby
[17:19:09] Renich: has joined #ruby
[17:19:39] bronson: has joined #ruby
[17:20:30] stannard: has joined #ruby
[17:20:45] choke: has joined #ruby
[17:22:42] bronson: has joined #ruby
[17:22:58] pawnbox: has joined #ruby
[17:24:56] smathy: has joined #ruby
[17:25:53] B1n4r10: has joined #ruby
[17:26:31] sudoubuntu: has joined #ruby
[17:26:49] al2o3-cr: has joined #ruby
[17:27:34] Cohedrin: has joined #ruby
[17:28:14] johnmilton: has joined #ruby
[17:28:15] stunder: has joined #ruby
[17:30:00] Cohedrin_: has joined #ruby
[17:31:46] scepticulous: has joined #ruby
[17:33:03] xue: has joined #ruby
[17:33:33] n0xff: has left #ruby: ()
[17:35:32] JohnBat26: has joined #ruby
[17:36:03] malconis: has joined #ruby
[17:37:08] pawnbox: has joined #ruby
[17:37:58] scepticulous: has joined #ruby
[17:38:57] jtoy: has joined #ruby
[17:39:07] davedev24: has joined #ruby
[17:39:35] ncopa: norc: it was a bug in musl
[17:39:43] ncopa: thanks for your help!
[17:42:05] JohnBat26: has joined #ruby
[17:42:57] darkxploit: has joined #ruby
[17:47:13] mtkd: has joined #ruby
[17:47:38] rbennacer: has joined #ruby
[17:52:05] dagda1: has joined #ruby
[17:53:20] SCHAAP137: has joined #ruby
[17:55:29] ascarter: has joined #ruby
[17:56:16] mistermo_: has joined #ruby
[17:57:17] ascarter: has joined #ruby
[17:57:44] mistermo_: has joined #ruby
[17:58:45] shmuli: has joined #ruby
[17:58:55] kirun: has joined #ruby
[18:00:52] halfamind: has joined #ruby
[18:01:01] djbkd: has joined #ruby
[18:01:29] halfamind1: has joined #ruby
[18:01:51] halfamind: has joined #ruby
[18:02:04] postmodern: has joined #ruby
[18:02:14] Xeago: has joined #ruby
[18:02:54] baweaver: has joined #ruby
[18:07:36] bkxd: has joined #ruby
[18:09:17] BLuEGoD: has joined #ruby
[18:09:35] baweaver: has joined #ruby
[18:10:09] cb: has joined #ruby
[18:10:24] scepticulous: has joined #ruby
[18:11:04] hxegon: has joined #ruby
[18:12:02] chouhoulis: has joined #ruby
[18:12:11] Cohedrin: has joined #ruby
[18:12:17] tubuliferous_: has joined #ruby
[18:13:34] dmr8: has joined #ruby
[18:14:20] babblebre: has joined #ruby
[18:15:35] mistermo_: has joined #ruby
[18:15:58] ramfjord: has joined #ruby
[18:17:38] Pintor: has joined #ruby
[18:17:40] ChanServ: +o baweaver
[18:18:17] Pintor: has left #ruby: ()
[18:18:47] codecop: has joined #ruby
[18:18:49] codecop_: has joined #ruby
[18:18:52] Armaggedon: has joined #ruby
[18:19:20] ChanServ: -o baweaver
[18:20:15] adaedra: -o adaedra
[18:25:21] _stu_: has joined #ruby
[18:25:31] B1n4r10: has joined #ruby
[18:28:21] tubuliferous: has joined #ruby
[18:28:47] jackjackdripper: has joined #ruby
[18:28:49] shadoi: has joined #ruby
[18:28:56] jackjackdripper: has joined #ruby
[18:29:07] jackjackdripper1: has joined #ruby
[18:29:21] mrgrieves: has joined #ruby
[18:30:29] The_Phoenix: has joined #ruby
[18:32:31] The_Phoenix: has joined #ruby
[18:32:49] hightower3: has joined #ruby
[18:32:57] crazydiamond: has joined #ruby
[18:33:44] PedramT: has joined #ruby
[18:34:24] The_Phoenix: has joined #ruby
[18:34:52] xaxisx: has joined #ruby
[18:34:52] madgen: has joined #ruby
[18:35:20] The_Phoenix: has joined #ruby
[18:35:46] lemur: has joined #ruby
[18:36:12] jackjackdripper: has joined #ruby
[18:36:38] dopamean_: has joined #ruby
[18:37:24] Polysics_: has joined #ruby
[18:37:27] The_Phoenix: has joined #ruby
[18:38:58] mdw: has joined #ruby
[18:40:59] Jackneill: has joined #ruby
[18:41:48] baweaver: 🎉Ruby 3.0! (See channel topic)
[18:43:36] mozzarella: I knew what it would be before clicking
[18:43:48] iamvery: has joined #ruby
[18:44:15] baweaver: Yep. Beautiful
[18:44:23] dravine_: has joined #ruby
[18:44:49] pawnbox: has joined #ruby
[18:46:20] Xeago: has joined #ruby
[18:47:44] Ishido: has joined #ruby
[18:48:13] mistermo_: has joined #ruby
[18:48:43] darkxploit: has joined #ruby
[18:49:23] symm-: has joined #ruby
[18:49:34] m8: has joined #ruby
[18:51:51] blackmesa: has joined #ruby
[18:52:17] mistermo_: has joined #ruby
[18:53:15] mistermo_: has joined #ruby
[18:54:58] snguyen: has joined #ruby
[18:55:57] tristanp_: has joined #ruby
[18:56:22] Xeago: has joined #ruby
[18:57:09] B1n4r10: has joined #ruby
[18:59:51] Regulati_: has joined #ruby
[18:59:57] Donkoko: has joined #ruby
[19:00:19] Donkoko: hahah, that april's fools
[19:00:53] ascarter: has joined #ruby
[19:01:58] tvon: 4/1 is the worst day for the internet
[19:02:48] Ox0dea: I guess that's one way to spell "best".
[19:04:37] al2o3-cr: has joined #ruby
[19:08:18] dionysus69: has joined #ruby
[19:08:36] Hanmac: Donkoko: the jokes of today, will become the new features of apple tomorrow ;P
[19:08:48] dagda1: has joined #ruby
[19:08:50] darkxploit: has joined #ruby
[19:10:24] shevy: the worst joke will be when some of these jokes become reality!
[19:10:43] cpup: has joined #ruby
[19:11:10] Donkoko: shevy: still not sure if bash on windows is a joke or fo real
[19:11:15] eam: gmail's launch was announced on april 1st
[19:11:27] shevy: Donkoko yeah, they prepared it really good
[19:11:30] shevy: several days before
[19:11:43] choke: has joined #ruby
[19:12:15] shevy: let's open up the "april fool WEEK" :)
[19:14:38] B1n4r10: has joined #ruby
[19:15:01] choke: sounds good chevy, i'm implementing april fools day within our api as we speak...
[19:15:42] momomomomo: has joined #ruby
[19:17:30] nibbo: has joined #ruby
[19:18:01] B1n4r10_: has joined #ruby
[19:18:15] drewo: has joined #ruby
[19:18:50] shevy: I try to do serious work!
[19:19:06] adaedra: They should move next US election results on 1/4 too.
[19:19:51] symm-: has joined #ruby
[19:19:59] yfeldblum: has joined #ruby
[19:20:35] shevy: hmm the elections are a year long april joke!
[19:21:22] Dimik: has joined #ruby
[19:21:24] n008f4g_: has joined #ruby
[19:21:25] ascarter: has joined #ruby
[19:25:02] Mon_Ouie: has joined #ruby
[19:26:42] tristanp: has joined #ruby
[19:27:31] eljimmy: damnit. got me.
[19:28:12] rmulligan: has joined #ruby
[19:29:11] ekinmur: has joined #ruby
[19:29:57] dopie: has joined #ruby
[19:30:01] scepticulous: has joined #ruby
[19:30:09] yqt: has joined #ruby
[19:30:11] dravine_: has joined #ruby
[19:30:32] DonOtreply: has joined #ruby
[19:31:18] BrunoSaboia: has joined #ruby
[19:32:21] al2o3-cr1: has joined #ruby
[19:33:00] scarab1: has joined #ruby
[19:33:17] scarab1: What is a good alternative to Sinatra?
[19:33:34] havenwood: scarab1: Roda
[19:34:21] havenwood: scarab1: It has a lovely plugin system so you can compose your app and there are a variety of other wins.
[19:34:22] mrgrieves: has joined #ruby
[19:34:31] smoose: has joined #ruby
[19:34:56] ramfjord_: has joined #ruby
[19:35:04] havenwood: scarab1: jeremyevans often hangs out in the #roda channel
[19:38:09] sneakerhax: has joined #ruby
[19:38:09] mdw: has joined #ruby
[19:38:46] scarab1: havenwood: thanks
[19:39:02] scarab1: I won't touch rails, but thanks
[19:41:50] n_blownapart: has joined #ruby
[19:41:56] jenrzzz: has joined #ruby
[19:41:57] jenrzzz: has joined #ruby
[19:42:48] PedramT: has joined #ruby
[19:45:15] Devalo: has joined #ruby
[19:46:44] cdg: has joined #ruby
[19:47:50] hxegon: has joined #ruby
[19:48:41] Don_John: has joined #ruby
[19:49:48] baweaver: has joined #ruby
[19:50:02] joneshf-laptop: has joined #ruby
[19:51:22] dravine_: has joined #ruby
[19:51:56] dunpeal: has joined #ruby
[19:52:45] andywojo: has joined #ruby
[19:53:24] shevy: oh we need this https://rubygems.org/gems/phuby
[19:53:26] cdg: has joined #ruby
[19:53:35] dunpeal: Hi. I am looking for a good solution for integration testing a web application. Besides Capybara, is there anything else I should check out?
[19:56:50] yorickpeterse: adaedra: I HATE YOU
[19:56:54] yorickpeterse: FK YOU FOR THAT /TOPIC
[19:57:02] yorickpeterse: This is the 2nd time I get rickrolled today
[19:57:32] yorickpeterse: (╯°□°)╯︵ ┻━┻
[20:00:28] ascarter: has joined #ruby
[20:00:51] ur5us: has joined #ruby
[20:01:31] chagel: has joined #ruby
[20:02:21] gizmore: has joined #ruby
[20:04:39] al2o3-cr: has joined #ruby
[20:05:04] djbkd: has joined #ruby
[20:05:53] freerobby: has joined #ruby
[20:06:17] ur5us: has joined #ruby
[20:06:45] mfb2: has joined #ruby
[20:06:51] pawnbox: has joined #ruby
[20:07:13] phaza: has joined #ruby
[20:08:13] uglybandersnatch: has joined #ruby
[20:08:26] bkxd: has joined #ruby
[20:08:37] choke: speaking of rickroll, april fools day in the api is complete ;)
[20:11:00] blackmesa: has joined #ruby
[20:11:21] ruby[bot]: -b *!*@172.58.24.86$#ruby-banned
[20:11:54] choke: has joined #ruby
[20:14:07] cpup: has joined #ruby
[20:15:21] parduse: has joined #ruby
[20:16:07] adaedra: yorickpeterse: if I may. http://irclog.whitequark.org/ruby/2016-04-01#16009275;
[20:16:31] blitheBoudica: has joined #ruby
[20:18:55] adaedra: seems like _whitelogger doesn't like emoji.
[20:19:18] rbennacer: has joined #ruby
[20:19:39] htmldrum: has joined #ruby
[20:20:39] cpup: has joined #ruby
[20:21:19] apeiros: no bot likes emoji
[20:21:29] spider-mario: has joined #ruby
[20:21:49] apeiros: characters to express feelings - that just goes to remind them that they don't have any!
[20:22:04] gheegh: has joined #ruby
[20:22:07] apeiros: which of course makes them feel bad
[20:22:56] Aviio: has joined #ruby
[20:23:06] gheegh: Hey guys.. question. Anyone doing Amazon Map Reduce Jobs in ruby code? I'm looking for some sort of best current practice... as all the stuff out there is like 4 years old on the internet.
[20:23:13] B1n4r10: has joined #ruby
[20:23:29] apeiros: 4 yo code can't work, amirite?
[20:24:27] systemsgotyou: when would you use a stored procedure and when would you use a function?
[20:24:28] petricore: has joined #ruby
[20:24:32] choke: of course it can work... but best practices changing so often, there's a big chance that 4yo code goes against todays development standards.
[20:24:33] gheegh: Wukong's last update was in 2014..
[20:24:45] iNs: has joined #ruby
[20:25:38] Xiti: has joined #ruby
[20:26:33] moss: how do I include a variable in a file that I need opened?
[20:26:50] moss: for instance: File.foreach('/etc/sysconfig/network-scripts/ifcfg-' + interface)
[20:27:27] djbkd: has joined #ruby
[20:27:28] adaedra: what's wrong with this method?
[20:27:54] apeiros: systemsgotyou: I think you want to ask that in #whicheverdbyouuse
[20:28:43] chouhoulis: has joined #ruby
[20:30:33] Maletor: has joined #ruby
[20:32:15] chouhoulis: has joined #ruby
[20:32:21] rbennacer: has joined #ruby
[20:32:55] skweek: has joined #ruby
[20:32:59] uglybandersnatch: has joined #ruby
[20:33:56] BTRE: has joined #ruby
[20:34:30] jtoy: has joined #ruby
[20:35:53] mistermocha: has joined #ruby
[20:38:19] baweaver: has joined #ruby
[20:38:57] GodFather: has joined #ruby
[20:39:11] uglybandersnatch: has joined #ruby
[20:42:59] mistermocha: has joined #ruby
[20:43:46] kobain: has joined #ruby
[20:45:47] skade: has joined #ruby
[20:47:14] jenrzzz: has joined #ruby
[20:47:14] jenrzzz: has joined #ruby
[20:47:37] dtzuzu: has joined #ruby
[20:48:10] tristanp_: has joined #ruby
[20:49:42] chouhoul_: has joined #ruby
[20:51:24] Ormm: has joined #ruby
[20:54:10] tvw: has joined #ruby
[20:55:18] bullets: has joined #ruby
[20:55:41] baweaver: has joined #ruby
[20:55:50] Spami: has joined #ruby
[20:56:35] brentw: has joined #ruby
[21:00:51] rehat: has joined #ruby
[21:01:06] rehat: has joined #ruby
[21:01:24] Aviio: has joined #ruby
[21:02:06] baweaver: 🎉 Ruby 3.0! (See channel topic)
[21:02:18] Gasher: has joined #ruby
[21:02:40] diegoaguilar: has joined #ruby
[21:02:41] shevy: see what you did there baweaver! <yorickpeterse> adaedra: I HATE YOU
[21:02:58] bullets: oh it's pril
[21:03:03] bullets: almost fell for that
[21:03:22] baweaver: shevy ruined our fun
[21:04:11] drewo: has joined #ruby
[21:04:12] devbug: has joined #ruby
[21:04:13] joneshf-laptop: has joined #ruby
[21:04:27] shevy: I must protect this world from Rick
[21:04:38] baweaver: .!kick shevy
[21:04:51] shevy: .!rick !!!
[21:05:18] dagda1: has joined #ruby
[21:05:52] dopie: has joined #ruby
[21:06:02] adaedra: Too bad for them if they can't fun a little ¯\_(ツ)_/¯
[21:06:04] mistermocha: has joined #ruby
[21:06:35] blackmesa: has joined #ruby
[21:07:20] brentw: looking for some help on creating a list of a Nodes children on creation
[21:07:33] brentw: on intialization of an an instance fo the object
[21:07:48] rehat: is there a way to change my ip in ruby lol? I'm such a noob. I wrote a screen scraper and the site banned my ip lol
[21:08:33] brentw: https://gist.github.com/brentgsw/c9a1830b2777fbb847ee98d5cb2d78aa is the class. trying to understand how to best have Node#method called on initialization
[21:08:46] brentw: sorry Node#children method
[21:08:56] LHdez: has joined #ruby
[21:09:04] Azure: has joined #ruby
[21:09:04] Lomex_: has joined #ruby
[21:09:23] go|dfish: has joined #ruby
[21:11:49] halfamind: has joined #ruby
[21:12:24] bullets: rehat: you can try resetting your router
[21:12:50] jottr: has joined #ruby
[21:13:05] rippa: has joined #ruby
[21:14:05] rehat: bullets: haha I was looking for something to prevent getting banned for future scrapes. I'll try adding a random sleep but I read online that I should use ip rotating or a proxy service but I'm now familiar with that stuff. I guess I read a wiki lol
[21:14:27] nibbo: has joined #ruby
[21:16:31] stannard: has joined #ruby
[21:17:55] Spami: has joined #ruby
[21:20:16] n008f4g_: has joined #ruby
[21:22:34] mg^: has joined #ruby
[21:26:46] mistermocha: has joined #ruby
[21:26:57] r0b3rt: has joined #ruby
[21:31:59] BSab: has joined #ruby
[21:32:14] vdamewood: has joined #ruby
[21:33:53] shmuli: has joined #ruby
[21:36:37] skade: has joined #ruby
[21:39:01] Suntzu: has joined #ruby
[21:40:59] yfeldblum: has joined #ruby
[21:43:06] polll: has joined #ruby
[21:45:16] mostlybadfly: has joined #ruby
[21:47:26] Technodrome: has joined #ruby
[21:47:41] duckpuppy: has joined #ruby
[21:48:36] GodFather: has joined #ruby
[21:50:34] sudoubuntu: has joined #ruby
[21:51:01] ur5us: has joined #ruby
[21:51:35] Aviio: has joined #ruby
[21:52:26] majuscule: can someone give me super simple explanation of the difference between foo[:bar] and foo['bar']? it's driving me crazy. or a link to some good documentation would be cool too :-)
[21:52:29] baweaver: has joined #ruby
[21:52:49] apeiros: majuscule: do you understand the difference between foo["1"] and foo[1]?
[21:53:12] majuscule: the first is a string, the second is an index
[21:53:37] apeiros: the second is an integer (or a number). an integer can be an index, but in this case, both are a key.
[21:53:56] apeiros: but you understand that both are keys? and that they look similar, but they are different keys?
[21:54:06] blitheBoudica: has left #ruby: ("Leaving...")
[21:54:11] majuscule: ahh sorry, that's essentially what i meant, the key in the first is a string, the second is an integer, and generally numerical keys are indexes
[21:54:23] havenwood: majuscule: Are you familiar with `:bar.class` and `'bar'.class`?
[21:54:25] apeiros: same thing with "foo" and :foo
[21:54:28] swills: has joined #ruby
[21:54:44] apeiros: one thing is a string, the other a symbol. they look similar, but they are not the same. they can both be used as a key.
[21:55:12] majuscule: ahh okay. that makes sense.
[21:55:22] FooMunki: has joined #ruby
[21:55:23] majuscule: and is there generally a reason to choose one over the other when defining a hash?
[21:55:46] apeiros: symbols are more light-weight and faster
[21:55:50] havenwood: majuscule: Hash keys are often Symbols. You'd not want to do that if say the key was determined by user input.
[21:56:06] darkf: has joined #ruby
[21:56:12] apeiros: but they're bad if the set of possible keys is not finite
[21:56:33] majuscule: interesting
[21:56:41] apeiros: which means that e.g. they're not good for user input (because you don't know all possible user inputs)
[21:57:04] apeiros: also ruby internally uses symbols to identify everything in code which has a name (methods, variables)
[21:57:21] ruby[bot]: -b *!*@gateway/web/cgi-irc/kiwiirc.com/ip.45.65.14.10$#ruby-banned
[21:57:47] bronson: has joined #ruby
[21:59:50] drewo: has joined #ruby
[22:00:08] eljimbo: has joined #ruby
[22:01:56] Ox0dea: apeiros: Almost.
[22:02:21] Ox0dea: >> RubyVM::INSTRUCTION_NAMES.grep Symbol
[22:02:23] ruby[bot]: Ox0dea: # => [] (https://eval.in/546543)
[22:04:21] mfb2_: has joined #ruby
[22:05:23] ChanServ: +o havenwood
[22:06:22] mfb2_: has joined #ruby
[22:06:47] apeiros: Ox0dea: eh?
[22:06:55] n_blownapart: has joined #ruby
[22:06:57] apeiros: $ ruby -e 'p Symbol.all_symbols.grep(/Symbol/)' -> [:Symbol]
[22:07:03] ChanServ: -o havenwood
[22:07:05] mfb2_: has joined #ruby
[22:07:18] noService: has joined #ruby
[22:09:13] bkxd: has joined #ruby
[22:09:41] p0wn3d: has joined #ruby
[22:10:32] p0wn3d: has joined #ruby
[22:10:44] quazimodo: has joined #ruby
[22:11:56] gizless: has joined #ruby
[22:14:05] hiyosi: has joined #ruby
[22:14:14] mdw: has joined #ruby
[22:14:38] ecksit: has joined #ruby
[22:16:12] baweaver: 🎉 Ruby 3.0! (See channel topic)
[22:17:20] halfamind: has joined #ruby
[22:17:23] havenwood: 3x faster... mmhmm!
[22:17:44] bullets: I hadn't seen the link of the ruby 3 release
[22:17:45] apeiros: I heard 30x
[22:17:47] bullets: I'm pleased
[22:18:13] smathy: Weird choice to go fully functional though.
[22:18:15] dunpeal: has joined #ruby
[22:18:17] havenwood: 🎉 Ruby 4.0! Now 4x faster. That was quick...
[22:18:41] bullets: Ruby 5.0 when?
[22:18:43] zeroDivisible: has joined #ruby
[22:18:52] baweaver: smathy: Yeah, I was surprised that they went with immutable values all around
[22:18:53] havenwood: smathy: True, and the macros will take some getting accustomed to.
[22:19:13] baweaver: Though the pattern matching in the video is amazing, Matz really hit it out of the park
[22:19:21] apeiros: but did they really have to switch to pythonesque meaningful whitespace instead of `end`?
[22:19:39] baweaver: I'm just happy they finally required parens
[22:19:53] baweaver: apeiros: it'll take some getting used to
[22:19:56] marsjaninzmarsa: has joined #ruby
[22:20:19] apeiros: thanks god for the --old-and-shitty-code compat switch
[22:20:36] Aviio: has joined #ruby
[22:21:08] baweaver: pretty sure that's their joke feature
[22:22:47] shevy: now you guys are talking about python3!
[22:23:17] baweaver: No, just that much has changed in Ruby 3
[22:23:30] baweaver: A lot of bold decisions
[22:24:35] smathy: It makes Angular 2 look like a backwardly compatible bugfix.
[22:24:57] baweaver: Heck, they even made Python 3 look tame
[22:25:37] p0wn3d: has joined #ruby
[22:25:46] smathy: Not Perl6 though, that still looks like a Dali painting.
[22:25:48] n_blownapart: has joined #ruby
[22:26:11] Ox0dea: apeiros: I'm confused by your confusion.
[22:26:28] apeiros: let me recurry that
[22:26:32] Ox0dea: Regarding "names are always Symbols", that's not the case for RubyVM::INSTRUCTION_NAMES; they're Strings.
[22:26:44] Ox0dea: I'm not sure why.
[22:26:55] apeiros: you misunderstood me
[22:27:11] Ox0dea: Your use of `grep(/Symbol/)` seems to belie that you did the misunderstanding. :/
[22:27:13] apeiros: ruby internally identifies things with symbols, as that's how it came to be
[22:28:11] workmad3: has joined #ruby
[22:28:54] rbennacer: has joined #ruby
[22:33:48] n_blownapart: has joined #ruby
[22:35:24] karioleez: has joined #ruby
[22:35:35] freerobby: has joined #ruby
[22:35:52] pawnbox: has joined #ruby
[22:36:08] mg^: has joined #ruby
[22:37:25] BTRE: has joined #ruby
[22:37:32] diegoviola: has joined #ruby
[22:38:05] bkxd: has joined #ruby
[22:39:25] zenlot6: has joined #ruby
[22:39:37] baweaver: has joined #ruby
[22:40:38] n_blownapart: has joined #ruby
[22:42:57] abyx: has joined #ruby
[22:44:36] karioleez: has joined #ruby
[22:44:41] baweaver: has joined #ruby
[22:45:58] triangles2: has joined #ruby
[22:47:26] last_staff: has joined #ruby
[22:47:48] pawnbox: has joined #ruby
[22:49:02] Coldblackice: has joined #ruby
[22:49:28] Inside: has joined #ruby
[22:49:28] Inside: has joined #ruby
[22:50:51] poguez_: has joined #ruby
[22:51:07] bry4n_: has joined #ruby
[22:51:12] ssiris: has joined #ruby
[22:52:33] bkxd: has joined #ruby
[22:52:55] Renich: has joined #ruby
[22:56:30] Lomex_: has joined #ruby
[22:56:34] brentw: Ox0dea, wondering if you would take a quick look at my mazesolver. Wasn't able to work on it for a few days
[22:56:52] brentw: trying to see if you think i'm on the right path
[22:57:58] bkxd: has joined #ruby
[22:59:37] snguyen: has joined #ruby
[23:01:05] ur5us: has joined #ruby
[23:02:12] halfamind: has joined #ruby
[23:03:02] davedev24: has joined #ruby
[23:03:04] karioleez: has joined #ruby
[23:03:16] bkxd: has joined #ruby
[23:04:26] smathy: Hey, within a case statement, is there some shorthand to refer to the subject of the case, like `case "Foo" when <something here>.downcase == "foo" ` or even more commonly: `case "blah" when...when...when...else <something here> end` ?
[23:05:12] magikid: has joined #ruby
[23:06:05] htmldrum: has joined #ruby
[23:06:49] kobain: has joined #ruby
[23:07:01] smathy: (I end up doing `case s = "foo"; when ....` a fair bit :)
[23:07:58] shmuli: has joined #ruby
[23:09:04] freerobby: has joined #ruby
[23:09:36] baweaver: lambdas would be the only way I could think of
[23:09:52] Madplatypus: has joined #ruby
[23:10:11] bronson: has joined #ruby
[23:10:18] baweaver: when -> v { v.downcase == foo }
[23:10:31] pizzaops: This really feels like it should be a "map" to me not an "each", but map obviously returns an array not a hash, so yeah...any thoughts? https://gist.github.com/pizzaops/1f44b4e37bc2c57272c227102d83f851
[23:10:36] baweaver: or you could make a builder to get syntax like this:
[23:10:47] baweaver: when case_subject.downcase.eq(foo)
[23:10:55] pizzaops: I mean it's basically fine as is, I'm just curious if there's a better way than yet another `.each`
[23:11:14] toretore: has joined #ruby
[23:11:25] Papierkorb: pizzaops: https://gist.github.com/Papierkorb/55ec5deea501f8979a46d19719b3381f
[23:11:45] Papierkorb: pizzaops: sorry forgot to change #each to #map, fixed
[23:12:14] baweaver: >> Person = Struct.new(:name, :age); [Person.new('bob', 25), Person.new('jane', 25)].map{|person| [person.name, person]}.to_h
[23:12:15] ruby[bot]: baweaver: # => {"bob"=>#<struct Person name="bob", age=25>, "jane"=>#<struct Person name="jane", age=25>} (https://eval.in/546548)
[23:12:24] baweaver: rails has #index_by
[23:12:37] pizzaops: Papierkorb: so calling .to_hash on an array of arrays where each item is an array of length 2 converts it to a hash?
[23:12:39] baweaver: could also use group_by, though that returns collections
[23:12:39] Papierkorb: pizzaops: Array#to_h expects the array to contain only arrays, with each of those arrays containing exactly two values. the first value will be the key, the second value will be the value
[23:12:51] pizzaops: that's perfect, thanks
[23:13:08] duckpuppy: has joined #ruby
[23:13:15] baweaver: >> [:a, 1, :b, 2].to_h
[23:13:16] ruby[bot]: baweaver: # => wrong element type Symbol at 0 (expected array) (TypeError) ...check link for more (https://eval.in/546549)
[23:13:33] baweaver: hm. Thought there was a variant like that
[23:13:39] baweaver: Ox0dea: what did I do stupid?
[23:13:43] Rubie: has joined #ruby
[23:13:52] karioleez: has joined #ruby
[23:13:53] Ox0dea: baweaver: They've gotta be pairs.
[23:13:54] Papierkorb: >> Hash[:foo, 123] # baweaver
[23:13:55] ruby[bot]: Papierkorb: # => {:foo=>123} (https://eval.in/546550)
[23:14:25] n_blownapart: has joined #ruby
[23:14:27] Papierkorb: but OOP > functional programming :P
[23:14:46] Ox0dea: ¿Por qué no los dos?
[23:15:08] baweaver: I'd disagree heavily with that statement
[23:15:19] Ox0dea: I'd swap > for +.
[23:15:22] pizzaops: Papierkorb: does this seem reasonable? https://gist.github.com/pizzaops/1f44b4e37bc2c57272c227102d83f851 — I need the ||= because calls on these objects can potentially trigger network traffic, so I don't want to create the hash again if I've already created it.
[23:15:26] baweaver: http://blog.higher-order.com/blog/2008/12/04/no-such-thing/
[23:15:40] jottr: has joined #ruby
[23:15:48] mistermocha: has joined #ruby
[23:16:15] polyidus: has joined #ruby
[23:16:16] Papierkorb: pizzaops: If you want to memoize it, use an @instance variable. Your method will always run the #map, as 'networks' is at that point always nil
[23:16:45] pizzaops: Papierkorb: right, I meant to, just forgot. Thanks!
[23:16:47] Papierkorb: pizzaops: So replace 'networks' with @networks. You can then remove the last line
[23:17:18] pizzaops: So @networks will always return either way? (with that last line @networks/networks removed
[23:17:33] kfpratt: has joined #ruby
[23:17:46] Papierkorb: pizzaops: Yes, assigning to a variable (same goes for ||=) returns the assigned value
[23:17:54] Ox0dea: *evaluates to
[23:18:04] pizzaops: MINANBYGANSTY
[23:18:14] pizzaops: (Matsz is not actually nice but you guys are nice so thank you)
[23:18:54] Renich: has joined #ruby
[23:19:34] Ox0dea: smathy? https://eval.in/546551
[23:20:04] Ox0dea: Oh, you don't necessarily want access to the subject in the `when` clause, just the body.
[23:20:43] htmldrum: has joined #ruby
[23:23:09] adaedra: “Matsz is not actually nice” — HERESY
[23:23:17] davedev24: has joined #ruby
[23:23:51] pwnd_nsfw: has joined #ruby
[23:24:33] davedev24: has joined #ruby
[23:25:11] nachoman: has joined #ruby
[23:25:38] djbkd: has joined #ruby
[23:25:59] smathy: Ox0dea, yeah, that's what I do now. I was asking if there was an implicit version of `s` in all `case` statements.
[23:26:49] Ox0dea: smathy: There isn't, but I'm fiddling. :)
[23:27:21] smathy: I mean obviously it's stored _somewhere_ internally, for the comparisons, I was just wondering if that was exposed to ruby itself.
[23:27:55] Ox0dea: Well, but, it gets compiled down, so a lot of the information that would make it easier to get to isn't available from Ruby land.
[23:28:18] smathy: Right, makes sense.
[23:28:34] htmldrum: has joined #ruby
[23:28:37] smathy: I suppose it's just compiled to if/elsifs.
[23:28:50] Ox0dea: Hm? It's an actual bytecode instruction.
[23:28:54] Ox0dea: Several of them in tandem, really.
[23:30:27] karioleez: has joined #ruby
[23:31:18] Mia: has joined #ruby
[23:31:18] Mia: has joined #ruby
[23:31:19] Ox0dea: This is quite monstrous: https://eval.in/546561
[23:31:24] Ox0dea: Don't look at it overlong.
[23:32:32] Papierkorb: require 'english'
[23:32:35] bronson: has joined #ruby
[23:32:44] smathy: $_ - you Perler you!
[23:33:03] havenwood: Papierkorb: require 'english'.capitalize
[23:33:18] Ox0dea: Papierkorb: But $LAST_READ_LINE would be quite inappropriate here.
[23:33:30] Ox0dea: I wanted it to just be `_`, but you can't introduce new locals into bindings.
[23:33:53] Papierkorb: I believe in you to hack that in using just ruby and Fiddle!
[23:34:07] Ox0dea: So much pointer chasing! :(
[23:34:28] Papierkorb: it's for the greater good though
[23:34:28] smathy: ACTION ships Ox0dea's code to production, despite the date ;)
[23:34:35] whathappens: has joined #ruby
[23:34:36] Ox0dea: Huehuehue.
[23:35:08] sandstrom: has joined #ruby
[23:35:56] jenrzzz: has joined #ruby
[23:37:23] LaT0rtue: has joined #ruby
[23:39:08] shevy: I wanna be a Fiddler
[23:43:24] n_blownapart: has joined #ruby
[23:43:32] ekinmur: has joined #ruby
[23:43:52] crank1988: has joined #ruby
[23:45:05] polyidus: has joined #ruby
[23:45:19] davedev24: has joined #ruby
[23:46:03] n_blownapart: has joined #ruby
[23:48:05] xtc: has joined #ruby
[23:48:11] rkazak: has joined #ruby
[23:48:38] croberts: has joined #ruby
[23:48:38] houhoulis: has joined #ruby
[23:48:46] karioleez: has joined #ruby
[23:51:06] gizmore: has joined #ruby
[23:54:06] DarthGandalf: has joined #ruby
[23:55:11] diegoaguilar: has joined #ruby
[23:56:09] FooMunki: has joined #ruby
[23:56:12] B4daBing73: has joined #ruby
[23:57:17] nachoman: has joined #ruby
[23:58:31] kies: has joined #ruby
[23:58:47] smathy: has joined #ruby