« Back to channel list

#ruby - 01 June 2017

« Back 1 day Forward 1 day »
[00:01:39] jud: has joined #ruby
[00:01:45] ecuanaso: has joined #ruby
[00:02:22] ur5us: has joined #ruby
[00:03:31] Munto: has joined #ruby
[00:03:52] GinoMan1423: has joined #ruby
[00:05:38] troys: has joined #ruby
[00:07:12] Guest69: has joined #ruby
[00:09:53] nowhere_man: has joined #ruby
[00:14:37] tsul: has joined #ruby
[00:14:38] dmtd: has joined #ruby
[00:15:09] Cohedrin: has joined #ruby
[00:15:58] ascarter: has joined #ruby
[00:16:24] chouhoulis: has joined #ruby
[00:20:45] ascarter: has joined #ruby
[00:22:34] LastWhisper____: has joined #ruby
[00:23:49] SeepingN_: has joined #ruby
[00:24:45] DeeJayh: has joined #ruby
[00:26:06] DeeJayh-L: has joined #ruby
[00:27:03] kies: has joined #ruby
[00:27:39] tsul: has joined #ruby
[00:31:06] dc2: has joined #ruby
[00:31:24] Nicmavr: has joined #ruby
[00:32:00] Guest24406: has joined #ruby
[00:32:09] bast: has joined #ruby
[00:32:10] bast: has joined #ruby
[00:33:14] Rodya_: has joined #ruby
[00:34:12] KnownSyntax: has joined #ruby
[00:34:12] KnownSyntax: has joined #ruby
[00:35:03] Polysics: has joined #ruby
[00:37:17] jenrzzz: has joined #ruby
[00:37:17] jenrzzz: has joined #ruby
[00:39:25] quazimodo: has joined #ruby
[00:39:57] bkxd: has joined #ruby
[00:40:27] brent__: has joined #ruby
[00:40:33] rohitpaulk: has joined #ruby
[00:42:34] bandu: has joined #ruby
[00:43:13] charliesome: has joined #ruby
[00:43:36] Brent___: has joined #ruby
[00:59:46] apparition: has joined #ruby
[01:00:42] Guest69: has joined #ruby
[01:03:01] herbmillerjr: has joined #ruby
[01:09:28] JoshS: has joined #ruby
[01:10:22] roamingdog: has joined #ruby
[01:10:27] jrafanie: has joined #ruby
[01:12:54] Cohedrin: has joined #ruby
[01:13:26] ascarter: has joined #ruby
[01:13:30] BSAlb: has joined #ruby
[01:13:46] quazimodo: has joined #ruby
[01:16:59] enterprisey: has joined #ruby
[01:20:26] ur5us: has joined #ruby
[01:21:09] rkazak: has joined #ruby
[01:21:54] ecuanaso: has joined #ruby
[01:23:06] jusa: has joined #ruby
[01:24:12] uZiel: has joined #ruby
[01:24:19] KnownSyntax: has joined #ruby
[01:24:19] KnownSyntax: has joined #ruby
[01:25:33] BSab: has joined #ruby
[01:29:54] bruce_lee: has joined #ruby
[01:29:54] bruce_lee: has joined #ruby
[01:31:26] roger_rabbit: has joined #ruby
[01:31:58] dc2: has joined #ruby
[01:32:06] Guest69: has joined #ruby
[01:33:19] mim1k: has joined #ruby
[01:34:12] ascarter: has joined #ruby
[01:37:45] ascarter: has joined #ruby
[01:39:58] d^sh: has joined #ruby
[01:41:19] ur5us: has joined #ruby
[01:41:49] Brent___: has joined #ruby
[01:42:51] uranellus: has joined #ruby
[01:42:52] uranellus: has joined #ruby
[01:42:52] charliesome: has joined #ruby
[01:45:04] gothicsouth: has joined #ruby
[01:45:19] uZiel: has joined #ruby
[01:52:44] hosttor: has joined #ruby
[01:56:10] gizmore|2: has joined #ruby
[02:00:32] patr0clus: has joined #ruby
[02:00:44] minimalism: has joined #ruby
[02:01:38] LastWhisper____: has joined #ruby
[02:02:00] bougyman_: has joined #ruby
[02:04:42] Jameser: has joined #ruby
[02:06:25] PorcoRex: has joined #ruby
[02:06:39] PorcoRex: Evening #Ruby-
[02:06:43] cdg: has joined #ruby
[02:07:45] |Blaze|: has joined #ruby
[02:09:04] |Blaze|: Is secureRandom a part of ruby? or do I need to download it and implement it into my project
[02:10:48] |Blaze|: Also I'm trying to use secure random to generate a token, which then will be masked over an id so then it cannot be traced with the id or opened
[02:11:15] ecuanaso: has joined #ruby
[02:11:34] lostapathy: ot just gen a uuid?
[02:16:09] PorcoRex: _blaze_ SecureRandom is part of Ruby's standard library, so you should be able to require it in most cases.
[02:16:41] PorcoRex: _blaze_ your second concern needs a bit more explanation.
[02:17:46] cdg: has joined #ruby
[02:20:25] genpaku: has joined #ruby
[02:30:12] ur5us: has joined #ruby
[02:30:29] Guest69: has joined #ruby
[02:30:50] armguy: has joined #ruby
[02:31:10] ascarter: has joined #ruby
[02:31:36] ur5us_: has joined #ruby
[02:32:37] blackwind_123: has joined #ruby
[02:32:38] dc2: has joined #ruby
[02:34:35] TinkerTyper: has joined #ruby
[02:36:50] Jameser: has joined #ruby
[02:36:55] gothicsouth: has joined #ruby
[02:37:06] haylon: has joined #ruby
[02:37:21] Brent___: has joined #ruby
[02:43:54] ledestin: has joined #ruby
[02:48:40] ur5us: has joined #ruby
[02:52:51] jjaii9: has joined #ruby
[03:11:57] ozcanesen: has joined #ruby
[03:15:06] AnoHito_: has joined #ruby
[03:17:31] Guest69: has joined #ruby
[03:17:34] uZiel: has joined #ruby
[03:18:03] cdg_: has joined #ruby
[03:18:59] xall: has joined #ruby
[03:19:27] jenrzzz: has joined #ruby
[03:19:27] jenrzzz: has joined #ruby
[03:31:16] chouhoulis: has joined #ruby
[03:33:26] dc2: has joined #ruby
[03:33:52] mim1k: has joined #ruby
[03:34:01] gix: has joined #ruby
[03:38:22] Polysics: has joined #ruby
[03:43:00] segmond: has joined #ruby
[03:43:49] Trynemjoel: has joined #ruby
[03:46:46] |Blaze|: has joined #ruby
[03:55:37] sarbs: has joined #ruby
[03:56:48] claw: has joined #ruby
[03:58:23] charliesome: has joined #ruby
[04:01:22] blackwind_123: has joined #ruby
[04:04:07] xall: has joined #ruby
[04:06:23] kies: has joined #ruby
[04:06:35] PatrikasZvaigzde: has joined #ruby
[04:12:54] xerx: has joined #ruby
[04:14:31] rohitpaulk: has joined #ruby
[04:15:30] Guest69: has joined #ruby
[04:17:15] jenrzzz: has joined #ruby
[04:17:16] jenrzzz: has joined #ruby
[04:19:32] xerx: has joined #ruby
[04:20:49] xall: has joined #ruby
[04:21:40] xall: has joined #ruby
[04:23:11] Tharbakim: has joined #ruby
[04:23:12] Tharbakim: has joined #ruby
[04:23:19] uZiel: has joined #ruby
[04:23:25] nowhereman: has joined #ruby
[04:25:23] xall: has joined #ruby
[04:26:06] Bhootrk_: has joined #ruby
[04:27:08] xall: has joined #ruby
[04:27:58] xall: has joined #ruby
[04:29:38] xall: has joined #ruby
[04:30:34] elomatreb: has left #ruby: ("leaving")
[04:30:42] elomatreb: has joined #ruby
[04:33:44] sneakerhax: has joined #ruby
[04:34:25] dc2: has joined #ruby
[04:34:47] renchan: has joined #ruby
[04:36:47] Cohedrin: has joined #ruby
[04:39:20] Polysics: has joined #ruby
[04:41:07] konsolebox: has joined #ruby
[04:43:00] staticfox: has joined #ruby
[04:53:02] mim1k: has joined #ruby
[04:53:22] Rich_Morin_: has joined #ruby
[04:54:55] scott4000: has joined #ruby
[04:55:29] xMopxShell: has joined #ruby
[04:58:01] JayGee: has joined #ruby
[05:03:17] staticfox: has joined #ruby
[05:03:40] jgt1: has joined #ruby
[05:06:18] Rich_Morin_: has joined #ruby
[05:07:41] Tharbakim: has joined #ruby
[05:07:41] Tharbakim: has joined #ruby
[05:09:59] bkxd: has joined #ruby
[05:11:31] Bock: has joined #ruby
[05:13:56] harfangk: has joined #ruby
[05:15:32] brent__: has joined #ruby
[05:21:00] Polysics: has joined #ruby
[05:25:26] Silthias1: has joined #ruby
[05:31:08] aupadhye: has joined #ruby
[05:33:12] kies: has joined #ruby
[05:35:12] anisha: has joined #ruby
[05:35:47] aupadhye: has joined #ruby
[05:36:37] Rodya_: has joined #ruby
[05:37:53] rgr_: has joined #ruby
[05:41:31] ledestin: would you say that saving a few cycles by moving a variable assignment out of a loop is premature optimisation?
[05:43:48] jenrzzz: has joined #ruby
[05:43:48] jenrzzz: has joined #ruby
[05:43:52] matthewd: ledestin: If it doesn't depend on the loop body, I'd say it's clarifying/simplifying
[05:44:14] ledestin: matthewd well, it's used only in the loop body
[05:44:37] ledestin: but doesn't depend on the items that are iterated over
[05:44:39] rohitpaulk: has joined #ruby
[05:44:57] ledestin: well, guess that's good thinking
[05:45:02] matthewd: Yeah, then I would consider just-before-the-loop to be the clearest place for it
[05:45:12] ledestin: yeah. cool, thanks matthewd
[05:49:10] anisha_: has joined #ruby
[06:00:13] cfec0b8d: has joined #ruby
[06:00:37] dc2: has joined #ruby
[06:00:43] cfec0b8d: has joined #ruby
[06:01:37] Polysics: has joined #ruby
[06:01:52] cfec0b8d: has joined #ruby
[06:06:08] cfec0b8d: has joined #ruby
[06:07:38] pwnd_nsfw`: has joined #ruby
[06:07:45] anisha_: has joined #ruby
[06:11:54] pwnd_nsfw: has joined #ruby
[06:22:20] kke_: could i somehow reset pretty much everything in rspec? (to test that everything is required at the right place)
[06:23:26] armando: has joined #ruby
[06:24:01] matthewd: kke_: Not really. Rails does it by running every test file in a separate Ruby instance, and hoping that's sufficiently fine-grained.
[06:27:02] bigkevmcd: has joined #ruby
[06:28:09] pwnd_nsfw`: has joined #ruby
[06:31:36] Cohedrin: has joined #ruby
[06:33:29] andikr: has joined #ruby
[06:39:02] uZiel: has joined #ruby
[06:39:07] dn`: has joined #ruby
[06:40:43] jamesaxl: has joined #ruby
[06:44:53] djbkd: has joined #ruby
[06:45:16] jgt2: has joined #ruby
[06:45:26] ecuanaso: has joined #ruby
[06:45:40] conta: has joined #ruby
[06:50:47] ur5us: has joined #ruby
[06:53:09] Robtop__: has joined #ruby
[06:57:47] cfec0b8d: has joined #ruby
[07:01:35] chat: has joined #ruby
[07:02:03] dc2: has joined #ruby
[07:03:00] rohitpaulk: has joined #ruby
[07:05:19] nowhereman: has joined #ruby
[07:07:45] vali: has joined #ruby
[07:07:52] zenspider: matthewd: not just every test file. IsolationTest runs each test in its own process as well.
[07:08:19] zenspider: I wasn't aware of the test file separation... does it actually help? last I checked, it still wasn't fully randomization safe
[07:08:55] zenspider: kke_: maybe you want a rake task that runs each file one at a time to make sure they require everything they need?
[07:09:17] zenspider: that's the type of thing I wouldn't want to run every time tho
[07:10:35] jgnagy: has joined #ruby
[07:13:00] johnny56: has joined #ruby
[07:13:15] horst: has joined #ruby
[07:15:53] jjaii9: has joined #ruby
[07:17:05] TomyWork: has joined #ruby
[07:19:40] horst: has joined #ruby
[07:19:46] Pumukel: has joined #ruby
[07:20:44] aurelien: has joined #ruby
[07:23:48] uZiel: has joined #ruby
[07:26:55] jjaii9: has joined #ruby
[07:27:37] anisha_: has joined #ruby
[07:28:45] aufi: has joined #ruby
[07:29:08] roshanavand: has joined #ruby
[07:30:55] pankaj_: has joined #ruby
[07:35:05] nicesignal: has joined #ruby
[07:35:34] erry: has joined #ruby
[07:35:49] t-recx: has joined #ruby
[07:39:53] SaschaVoid: has joined #ruby
[07:43:54] ta: has joined #ruby
[07:46:42] ecuanaso: has joined #ruby
[07:46:51] x27: has joined #ruby
[07:46:54] KeyJoo: has joined #ruby
[07:50:52] rgr_: has joined #ruby
[07:54:33] jjaii9_: has joined #ruby
[07:56:58] mikecmpbll: has joined #ruby
[07:58:06] ecuanaso: has joined #ruby
[08:00:46] ur5us: has joined #ruby
[08:02:45] dc2: has joined #ruby
[08:03:07] mtkd: has joined #ruby
[08:03:20] nofxxxx: has joined #ruby
[08:05:37] konsolebox: has joined #ruby
[08:05:56] anisha: has joined #ruby
[08:08:26] Bish_: has joined #ruby
[08:11:19] PaulCapestany: has joined #ruby
[08:11:53] jenrzzz: has joined #ruby
[08:14:41] Cohedrin: has joined #ruby
[08:15:28] mim1k: has joined #ruby
[08:21:55] bambanx: has joined #ruby
[08:23:20] nhhc: has joined #ruby
[08:24:11] quobo: has joined #ruby
[08:24:13] Pumukel: has joined #ruby
[08:26:25] pandaant: has joined #ruby
[08:36:51] mathys: has joined #ruby
[08:42:31] Beams: has joined #ruby
[08:43:20] im0nde: has joined #ruby
[08:43:37] Mortomes|Work: has joined #ruby
[08:45:36] im0nde_: has joined #ruby
[08:47:47] cyphase: has joined #ruby
[08:48:37] nowhereman: has joined #ruby
[08:50:04] mim1k: has joined #ruby
[08:51:37] mim1k_: has joined #ruby
[08:54:08] sinebif: has joined #ruby
[08:55:30] sinebif: how do i use ruby as a calc
[08:55:40] sinebif: I did type ruby in the terminal in linux
[08:55:48] sinebif: but I don't get an interpreter?
[08:55:58] sinebif: also where is the notebook?
[08:56:11] herwin: guess you're looking for irb
[08:56:18] herwin: as the interpreter
[08:56:25] herwin: no clue wat the notebook should be
[08:57:34] sinebif: herwin: then there is no notebook??
[08:57:40] sinebif: a good GUI
[08:58:00] sinebif: then why nothing comes when I press ruby ?? but need irb
[08:58:37] herwin: then type irb in the console instead of ruby
[08:58:50] herwin: and by GUI you mean IDE?
[08:59:58] xall: has joined #ruby
[09:00:45] sinebif: hey it doesn't even have auto complete
[09:01:05] sinebif: I need a notebook like ipython's, so that I can get rid of that ugly terminal
[09:01:08] lxsameer: has joined #ruby
[09:01:09] sinebif: and limited terminal
[09:01:44] sinebif: herwin: I need an excellent IDE, more like spyder
[09:01:50] sinebif: Scientific IDE
[09:02:40] anonymus: 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")
[09:03:31] dc2: has joined #ruby
[09:03:58] rohitpaulk: has joined #ruby
[09:04:21] sinebif: there is learn ruby in 20 minutes?
[09:04:24] sinebif: is this a joke?
[09:04:38] sinebif: Can it be learnt even quicker than python?
[09:04:42] sinebif: tell me someone
[09:13:12] torarne: has joined #ruby
[09:14:30] Pumukel: has joined #ruby
[09:14:51] torarne: Q: I have a class in a random module/namespace that I can get hold of an instance off, and call .class on. Is there any way to extend that class in a separate/module namespace, as if the original class was evaled in the other module? Just doing class Foo < bar.class doesn't work for some reason
[09:15:42] ljarvis: torarne: Foo = Class.new(bar.class). That's not "extending" it though, it's just creating a new subclass
[09:16:19] elomatreb: Can't you pass a block to Class.new and define methods like you normally would?
[09:16:36] tvw: has joined #ruby
[09:17:22] torarne: ljarvis: that would have the same effect as Foo < bar.class? What I'm seeing there is that attributes of the base Bar class, eg url "http:/..." do not seem to have any effect on the subclass, as if they were not set
[09:17:55] ljarvis: torarne: you'll have to provide some example code i'm afraid
[09:18:18] Fernando-Basso: has joined #ruby
[09:19:20] dminuoso: ACTION pokes ljarvis with a stick
[09:19:59] im0nde: has joined #ruby
[09:20:01] ljarvis: torarne: https://eval.in/809314
[09:20:21] ljarvis: ACTION pokes dminuoso with a cattle prod 
[09:20:31] torarne: ljarvis: https://gist.github.com/torarnv/36dc9b7324e3cfeb8fbb9d89513024fa
[09:20:51] dminuoso: What the fuck.
[09:20:54] torarne: ljarvis: i'm trying to extend an existing homebrew formula. but brew complains that "Error: formulae require at least a URL"
[09:21:16] dminuoso: torarne: What the fuck is this gist?
[09:21:22] dminuoso: 2.5k lines?
[09:21:49] torarne: dminuoso: the two small files are mine, formula.rb is from homebrew
[09:22:03] ljarvis: you can remove formula.rb
[09:22:06] ljarvis: it's unhelpful
[09:23:35] ljarvis: torarne: the "url" attribute is not inherited. It's stored on the Foo instance of Class
[09:24:19] torarne: Ah, i see. Is there any way to change that? Proxy all attrribute accesses to the base ?
[09:24:22] ljarvis: you want MyFormula to have the same url as Foo?
[09:25:03] ljarvis: well, it's possible.. but why exactly? are you doing something weird that other homebrew maintainers don't do?
[09:25:09] ljarvis: because this must be a solved issue
[09:25:32] torarne: So I can extend a formula's install() step, without having to make a copy of the whole formula i'm extended, meaning i'd have to rebase it every time the formula version is updated
[09:26:07] sinebif: which is the best IDE for ruby ?
[09:26:11] sinebif: I hate terminal
[09:26:16] torarne: unfortunately it's not really supported by homebrew out of the box
[09:26:38] ljarvis: sinebif: the best one is the one that works for you, so try one of them?
[09:26:46] ljarvis: (ps the terminal is best by far)
[09:27:06] sinebif: ljarvis: no for scientific computing
[09:27:10] sinebif: more like spyder
[09:27:15] sinebif: all don't work for me
[09:27:37] ljarvis: torarne: perhaps SimpleDelegator in stdlib would help
[09:28:05] ljarvis: sinebif: "don't work for me" isn't very specific. I'm not really sure what you want anyone here to help you with
[09:28:38] anonymus: has joined #ruby
[09:28:45] torarne: ljarvis: i assume most maintainers are maintaining the canoical brew formula for a software packge, so there they don't have that issue. brew supports pinning other taps, so i can provide an alternate formula for an existing packge, but i'd have to provide the full package, making mine stale quite fast, which is why i'd rather inherit the existing formula and just add my tweak, so i can pick up any changes to the software
[09:28:46] torarne: version in the default formula
[09:28:49] anonymus: guys? please help
[09:28:56] ruby[bot]: You can find an overview of my commands at http://ruby-community.com/ruboto/commands
[09:29:10] anonymus: I even do not know how to explain my pain
[09:29:29] anonymus: I have an array of Structs
[09:29:29] dminuoso: anonymus: Have you tried consulting a pain management doctor?
[09:29:32] ljarvis: anonymus: well, go off and try to figure that out before writing a coherant question here
[09:29:32] romank: has joined #ruby
[09:29:51] anonymus: with 2 variables in each
[09:29:58] dminuoso: ljarvis: before writing a coherent question?
[09:30:03] ljarvis: torarne: right, OK. I guess I'm just duplicate everything *shrug*
[09:30:05] dminuoso: ljarvis: you make it sound like anything of that was coherent.
[09:30:18] dminuoso: ACTION nitpicks on ljarvis
[09:30:20] ljarvis: anonymus: stop, write your entire question in one sentence
[09:30:32] ljarvis: dminuoso: :(
[09:31:26] dminuoso: torarne: What you could do is .dup the original class and modify it.
[09:31:42] dminuoso: That sounds like a cool thing to do.
[09:31:45] anonymus: I want to do something like structs.each {|s| s.first_var = s.second_var}; p first_var
[09:31:49] ljarvis: ^ and then pick up a shotgun to blow your leg off
[09:31:58] dminuoso: Though Im not sure what that "url attribute" is supposed to mean.
[09:32:01] ljarvis: ?code anonymus
[09:32:01] ruby[bot]: anonymus: We can't help you without your code, please post it to https://gist.github.com
[09:32:03] dminuoso: That code has no url attribute. It's a method.
[09:32:14] ljarvis: nitpick master today, dminuoso
[09:32:24] dminuoso: Im trying to get a medal.
[09:32:30] ruby[bot]: ljarvis: I don't know anything about medal
[09:32:33] torarne: dminuoso: hmm, interesting, would that allow me to call super though?
[09:32:44] dminuoso: torarne: You can use super all day long
[09:32:47] anonymus: omg bot battle
[09:32:47] dminuoso: the question is just what it does.
[09:33:02] ruby[bot]: dminuoso: # => super called outside of method (NoMethodError) ...check link for more (https://eval.in/809316)
[09:33:08] ljarvis: anonymus: go and post your code if you want help
[09:33:09] dminuoso: Perhaps not all day long.
[09:33:21] ljarvis: >> def foo() super; end; foo
[09:33:23] ruby[bot]: ljarvis: # => super: no superclass method `foo' for main:Object (NoMethodError) ...check link for more (https://eval.in/809317)
[09:33:33] ljarvis: we're getting there team
[09:33:49] rohitpaulk: has joined #ruby
[09:33:50] torarne: to put it another way, i want to extend install() and caveats(), but still call the base implementation, either though super or some other magic trick that achieves the same :)
[09:34:04] Polysics: ok, I failed.
[09:34:07] ljarvis: polysics: what are you doing?
[09:34:08] anonymus: ljarvis: im trying man
[09:34:08] matthewd: torarne: Module#prepend may interest you
[09:34:10] ahrs: has joined #ruby
[09:34:19] Polysics: ljarvis: there's a command to see all current kernel versions :)
[09:34:32] ljarvis: kernel versions for what?
[09:34:44] Polysics: wrooooong channel
[09:34:51] ljarvis: wow, impressive
[09:35:06] anonymus: https://gist.github.com/anonymous/9a07fa4cd1c75d93424211f1354f0133
[09:35:07] ljarvis: you can have the medal i was going to give to dminuoso
[09:35:54] anonymus: https://gist.github.com/anonymous/206ae93ed41fc0f957d386e335a08166 this i mean
[09:36:29] anonymus: I need something like that
[09:36:44] anonymus: imap = "_imap._tcp.yaa1.ololo.com. 7200 IN SRV 0 5 143 imap.yaa1.ololo.com.",
[09:37:01] anonymus: in my script
[09:37:35] torarne: matthewd:hmm, both extend and include assumes the module has naked functions as far as i understood it? so if I have module X; class Foo; end; end, can i then include/prepend the methods and attributes etc of Foo into a new class Bar?
[09:37:37] tvw: has joined #ruby
[09:37:42] ljarvis: anonymus: so what's wrong with your code?
[09:38:17] matthewd: torarne: module Foo
[09:38:53] anonymus: I do not know how to create a variable imap thats equal to whole string _imap...
[09:38:57] torarne: matthewd: i don't control the code of moduleX; class Foo;
[09:39:13] anonymus: and so with the rest of elements
[09:39:16] matthewd: >> module Doubler; def +(other); super * 2; end; end; Integer.prepend(Doubler); 3 + 4
[09:39:17] ruby[bot]: matthewd: # => 7 (https://eval.in/809321)
[09:39:31] matthewd: >> module Doubler; def +(other); super * 2; end; end; Fixnum.prepend(Doubler); 3 + 4
[09:39:32] ruby[bot]: matthewd: # => 14 (https://eval.in/809322)
[09:39:51] marr: has joined #ruby
[09:40:09] matthewd: torarne: You control the module which contains the things you want to add
[09:40:15] torarne: aaah, the other way around, got it
[09:41:24] dionysus69: has joined #ruby
[09:42:05] sinebif: i need a good ide
[09:42:18] ljarvis: sinebif: stop trolling or you'll be banned
[09:42:22] sinebif: i also need autocomplete
[09:42:32] sinebif: irb doesn't autocomplete, ruby is trolling me
[09:42:49] sinebif: so annoying it can't even autocomplete which is the right of every coder
[09:43:11] torarne: matthewd: private method `prepend' called for #<Class:0x007fcce4a562a8>, use send()?
[09:43:12] x27: has joined #ruby
[09:44:18] matthewd: torarne: Oh, you may have a ruby version issue there.. especially if you have to work on arbitrary machines
[09:44:28] anonymus: https://gist.github.com/anonymous/52abce377548837cfa8b2263f0d4d1a1 ljarvis
[09:44:55] ljarvis: matthewd: torarne prepend is private, you need to call it from inside the class/module. So using send seems right here?
[09:44:55] torarne: matthewd: i have 2.0.0, but i guess homebrew could run on prior versions
[09:45:14] ljarvis: oh, im lying
[09:45:19] ljarvis: ACTION shuts up
[09:45:30] matthewd: torarne: In that case, maybe go back to the dup plan. You can't use super, but before you overwrite an existing method, you can alias its existing definition to another name.
[09:46:03] sinebif: how do I autocomplete guys? or is it not possible at all?
[09:46:16] torarne: matthewd: that's a good idea!'
[09:46:18] ljarvis: !kick sinebif last warning
[09:46:19] ruby[bot]: +bbb $a:realthings$#ruby-banned sinebif!*@*$#ruby-banned *!*@gateway/tor-sasl/realthings$#ruby-banned
[09:46:19] ruby[bot]: ruby[bot] kicked sinebif: warning
[09:47:44] ruby[bot]: -bbb $a:realthings$#ruby-banned sinebif!*@*$#ruby-banned *!*@gateway/tor-sasl/realthings$#ruby-banned
[09:50:17] torarne: matthewd: ljarvis: fwd, the Module.prepend trick worked, but you're right about the version being an issue, so i'll try the dup road
[09:52:30] ur5us: has joined #ruby
[09:56:23] torarne: actually, seems bw has been vendoring ruby 2.0 for a while
[09:56:24] torarne: https://github.com/Homebrew/brew/pull/404/commits/534bf08ec33c89115d8061a9d1845e67f9a6cbb6
[09:56:30] torarne: so the prpend approach is fine
[10:00:48] mim1k: has joined #ruby
[10:02:35] patarr: has joined #ruby
[10:04:33] dc2: has joined #ruby
[10:07:44] anonymus: thanks for helping
[10:08:03] cschneid_: has joined #ruby
[10:09:13] anonymus: 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:09:37] psychicist__: has joined #ruby
[10:12:51] nofxxx: has joined #ruby
[10:18:30] leitz: has joined #ruby
[10:19:29] Emmanuel_Chanel: has joined #ruby
[10:19:31] GodFather: has joined #ruby
[10:23:46] torarne: matthewd: ljarvis: thanks a bunch: https://github.com/torarnv/homebrew-xcode-toolchains/blob/master/Formula/ccache.rb
[10:27:37] xall: has joined #ruby
[10:40:08] ljarvis: torarne: nice one
[10:40:31] CrazyEddy: has joined #ruby
[10:42:29] Mia: has joined #ruby
[10:42:29] Mia: has joined #ruby
[10:45:07] alibby1: has joined #ruby
[10:48:10] ddffg: has joined #ruby
[10:52:02] dionysus69: how to add members of 2d array to another array and get 2d array as a result, because atm I get 3d array
[10:52:37] dionysus69: atm i solved it by converting 2 d array to array[hash] and then add it to main array, then do flatten
[10:52:39] scottschecter: has joined #ruby
[10:52:57] dionysus69: but doesn't feel neat
[10:55:30] jamesaxl: has joined #ruby
[10:57:10] bkxd: has joined #ruby
[10:58:53] alibby: has joined #ruby
[10:59:43] HoierM: has joined #ruby
[11:00:58] HoierM: has joined #ruby
[11:02:05] ferr1: has joined #ruby
[11:02:50] xall: has joined #ruby
[11:03:35] ddffg: [a,b].transpose.map {|x| x.reduce(:+)}
[11:04:58] pankaj_: has joined #ruby
[11:05:22] dc2: has joined #ruby
[11:08:18] mim1k: has joined #ruby
[11:10:24] jrafanie: has joined #ruby
[11:11:05] alibby1: has joined #ruby
[11:12:18] jgnagy: has joined #ruby
[11:18:33] luong: has joined #ruby
[11:20:02] Jameser: has joined #ruby
[11:21:42] alibby: has joined #ruby
[11:28:02] flying: has joined #ruby
[11:33:20] konsolebox: has joined #ruby
[11:34:23] pankaj_: has joined #ruby
[11:36:10] jrafanie: has joined #ruby
[11:38:15] mim1k: has joined #ruby
[11:38:15] apparition: has joined #ruby
[11:42:15] bkxd_: has joined #ruby
[11:43:01] rgr: has joined #ruby
[11:43:02] ldnunes: has joined #ruby
[11:44:20] jrafanie: has joined #ruby
[11:46:52] nowhereman: has joined #ruby
[11:52:16] arquebus: has joined #ruby
[12:02:59] GinoMan: has joined #ruby
[12:04:21] synthroid: has joined #ruby
[12:04:39] aupadhye: has joined #ruby
[12:05:56] GinoMan2440: has joined #ruby
[12:06:07] dc2: has joined #ruby
[12:07:03] Pumukel: has joined #ruby
[12:08:28] Pumukel: has joined #ruby
[12:16:02] Puffball: has joined #ruby
[12:17:15] opencw: has joined #ruby
[12:17:30] x27: has joined #ruby
[12:23:35] bkxd: has joined #ruby
[12:24:55] konsolebox: has joined #ruby
[12:29:28] ur5us: has joined #ruby
[12:39:00] jrafanie: has joined #ruby
[12:40:22] im0nde_: has joined #ruby
[12:46:36] manveru: >> [[1,2,3],[4,5,6]].transpose.map(&:sum)
[12:46:42] ruby[bot]: manveru: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[12:52:38] gnufied: has joined #ruby
[12:52:41] hutch34: has joined #ruby
[12:54:50] Jameser: has joined #ruby
[12:56:28] cdg: has joined #ruby
[12:56:34] chouhoulis: has joined #ruby
[12:57:43] anisha_: has joined #ruby
[12:58:11] mim1k: has joined #ruby
[12:58:28] alibby: has joined #ruby
[13:00:24] x27: has left #ruby: ("Leaving")
[13:04:01] anisha_: has joined #ruby
[13:06:20] anisha_: has joined #ruby
[13:06:51] dc2: has joined #ruby
[13:09:01] bkxd: has joined #ruby
[13:10:24] jamesaxl: has joined #ruby
[13:19:39] jamesaxl: has joined #ruby
[13:20:44] charliesome: has joined #ruby
[13:24:05] shinnya: has joined #ruby
[13:30:46] burgestrand: has joined #ruby
[13:36:24] haylon: has joined #ruby
[13:45:44] HoierM: has joined #ruby
[13:47:41] GodFather: has joined #ruby
[13:48:20] gizmore: has joined #ruby
[13:48:22] Jameser: has joined #ruby
[13:49:29] bkxd: has joined #ruby
[13:55:53] nazty: has joined #ruby
[13:58:23] ikopico: manveru: it's only implemented in 2.4 (Array#sum)
[13:59:58] ben_alman: has joined #ruby
[14:00:29] manveru: isn't everyone on 2.4 now? /hide
[14:03:07] ikopico: >> RUBY_VERSION
[14:03:08] ruby[bot]: ikopico: # => "2.3.0" (https://eval.in/809584)
[14:05:58] Jameser: has joined #ruby
[14:07:38] dc2: has joined #ruby
[14:07:38] grymmjack: has joined #ruby
[14:08:53] oleo: has joined #ruby
[14:09:34] jamesaxl: has joined #ruby
[14:09:41] __Yiota: has joined #ruby
[14:10:08] im0nde: has joined #ruby
[14:13:28] konsolebox: has joined #ruby
[14:13:55] andywww: has joined #ruby
[14:14:12] Jameser`: has joined #ruby
[14:14:28] andywww: Repost from RoR channel, Can anyone give me any steer as to why this might be happening?
[14:14:30] andywww: https://gist.github.com/wanabewired/116756d06bc73116bf67ad56ab4cd5da
[14:15:23] burgestrand: andywww file encoding information is not written to the file, it's guessed by its contents
[14:16:18] anisha: has joined #ruby
[14:16:22] burgestrand: andywww UTF-8 is ASCII 7-bit compatible, meaning that "this is UTF8 text" is encoded the same in UTF-8 as it would be in 7-bit ASCII
[14:16:27] jusa: has joined #ruby
[14:17:35] andywww: what i’m struggling with is when i create a file in textmate, the file command identifies it as utf-8 with the same text
[14:17:36] burgestrand: andywww also, your force_encoding call is most likely wrong
[14:17:48] andywww: when i create it with ruby it is ascii-8bit every time
[14:18:05] burgestrand: andywww could it be that you're saving it with BOM from textmate?
[14:18:23] daemonwrangler: has joined #ruby
[14:18:31] burgestrand: andywww (there's likely a BOM checkbox somewhere, or a setting for it)
[14:18:49] andywww: i’m not familiar with BOM
[14:19:03] GodFather_: has joined #ruby
[14:19:18] andywww: but even if it is would it likely be worth trying to emulate that in ruby?
[14:19:28] burgestrand: andywww essentially it's some garbage that sometimes end up in the start of UTF-encoded files, usually it's used in other encodings but sometimes end up in UTF-8 encoded files too
[14:19:44] burgestrand: andywww depends entirely on why you want `file` to recognize your file as UTF-8
[14:20:34] andywww: I’m using ruby to generate a file for upload to googles webmaster tools console and they specifically state it must be a UTF-8 encoded text file
[14:20:52] burgestrand: andywww if that's the only text you have in it then you're OK
[14:21:36] andywww: I’d like to be reasonably sure that even if `file` might be guessing wrong, that I’ve done as much as I can to ensure that it is actually writing out as UTF-8
[14:21:47] burgestrand: andywww encoding is very similar to languages, if I give you the word "okay" without telling you what language it is in, you cannot know which language I intended
[14:21:53] andywww: which I assume I can only do by writing out a specific UF-8 character?
[14:24:25] burgestrand: andywww the `:UTF-8` part when you write to the file is sufficient for that
[14:24:46] LastWhisper____: has joined #ruby
[14:25:07] Jameser: has joined #ruby
[14:25:30] rohitpaulk: has joined #ruby
[14:26:11] sepp2k: has joined #ruby
[14:27:02] Jameser`: has joined #ruby
[14:27:09] Pumukel: has joined #ruby
[14:30:32] andywww: it seems inserting a bom at the start of the file might help it be identified as UTF-8 and ensure anything reading it in the future doesn’t make any mistakes when parsing. would it not make sense to include this BOM?
[14:30:41] andywww: or are there negative sideeffects?
[14:30:44] workmad3: has joined #ruby
[14:34:15] mikecmpb_: has joined #ruby
[14:37:02] bkxd: has joined #ruby
[14:40:24] marr: has joined #ruby
[14:42:05] Jameser: has joined #ruby
[14:48:36] cschneid_: has joined #ruby
[14:50:00] mikecmpbll: has joined #ruby
[14:53:16] patarr: has joined #ruby
[14:54:51] t-recx: has joined #ruby
[15:00:30] rippa: has joined #ruby
[15:01:35] amclain: has joined #ruby
[15:06:00] ta: has joined #ruby
[15:06:05] GodFather_: has joined #ruby
[15:06:35] anisha: has joined #ruby
[15:08:26] futilegames: has joined #ruby
[15:08:31] Jameser: has joined #ruby
[15:08:35] dc2: has joined #ruby
[15:09:09] andikr: has joined #ruby
[15:11:51] chalkmonster: has joined #ruby
[15:13:46] jgnagy: has joined #ruby
[15:14:19] LightStalker: has joined #ruby
[15:15:38] Jameser: has joined #ruby
[15:18:08] chaugiang: has joined #ruby
[15:18:35] chaugiang: hi everybody
[15:19:21] chaugiang: Hello everyone, If I have 2 methods : https://pastebin.com/zLdBQqdi How can I creat a scope for them? Thank you so much!
[15:19:23] ruby[bot]: chaugiang: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/8bd5d4183be12969ed25e473e2198a39
[15:19:23] ruby[bot]: chaugiang: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[15:19:51] rkazak: has joined #ruby
[15:20:06] centrx: has joined #ruby
[15:20:07] centrx: has joined #ruby
[15:20:44] chaugiang: Hello everyone, If I have 2 methods : https://gist.github.com/anonymous/6343edbfd9dd98e23dcd07ee8f6745da How can I creat a scope for them?
[15:20:47] luckyruby: has joined #ruby
[15:21:06] jrafanie: has joined #ruby
[15:24:30] im0nde: has joined #ruby
[15:28:19] Jameser: has joined #ruby
[15:29:03] pupsicle: has joined #ruby
[15:30:35] synthroid: has joined #ruby
[15:30:58] hutch34: has joined #ruby
[15:32:33] brent__: has joined #ruby
[15:39:26] jgnagy: has joined #ruby
[15:39:35] mim1k: has joined #ruby
[15:40:19] ta: has joined #ruby
[15:42:29] konsolebox: has joined #ruby
[15:43:10] ascarter: has joined #ruby
[15:43:59] troys: has joined #ruby
[15:45:46] zacts: has joined #ruby
[15:54:01] burgestrand: andywww yes, there are negative side effects to the BOM
[15:54:22] andywww: yes, i’ve been reading since
[15:54:37] andywww: i’m going to have faith that :UTF-8 is sufficient!
[15:55:01] burgestrand: andywww when google say that your file must be in UTF-8, they're mainly saying "we're going to assume it's UTF-8 and if it's broken somehow then it's your fault"
[15:55:31] bmurt: has joined #ruby
[15:57:39] gusrub: has joined #ruby
[15:59:10] frem_: has joined #ruby
[15:59:16] catphish: has joined #ruby
[15:59:56] gnarf: has joined #ruby
[16:00:48] pb122: has joined #ruby
[16:04:53] Ryzokuken: has joined #ruby
[16:05:16] haylon: has joined #ruby
[16:05:43] dionysus69: has joined #ruby
[16:07:58] synthroid: has joined #ruby
[16:09:39] dc2: has joined #ruby
[16:10:21] Sajeesh: has joined #ruby
[16:10:51] Sajeesh: hi @all need a help in resolving a ruby gem issue that I am currently facing
[16:15:14] Sajeesh: error i have pasted in the Gist
[16:15:14] Sajeesh: https://gist.github.com/sajeeshgit/de9a40f53da4385edafc58d8e630eab8
[16:15:26] taurgal: has joined #ruby
[16:17:23] taurgal: Can someone help me with this MWE: https://gist.github.com/taurgal/c752410d5c1d3d150f0c0c83975d7756
[16:17:49] taurgal: I do not understand why the instance variable @test is not printed...
[16:17:54] balazs_: has joined #ruby
[16:18:14] nitric: has joined #ruby
[16:18:42] taurgal: I am pretty new to ruby but have already written quite some code theses past few days but this is bogging me
[16:20:03] elomatreb: taurgal: Try using `p` instead of puts for debugging, it will generate more useful output
[16:20:25] bkulbida: has joined #ruby
[16:20:31] yeticry: has joined #ruby
[16:20:36] yottanami1: has joined #ruby
[16:21:11] yottanami1: Is any assertion in Minitest for checking an item exists in an Array? like `include?`
[16:21:15] taurgal: elomatreb: Thanks. p prints nil (I knew test was nil but still do not understand why)
[16:21:31] taurgal: yottanami_: myarray.include?
[16:21:36] elomatreb: And I assume the problem with the instance variable being nil is related to subclassing Date. Subclassing core classes is generally a bad idea
[16:21:52] taurgal: yottanami_: sorry, tried to be smart and quick bit failed
[16:23:22] elomatreb: I'd recommend you instead create a Date object in your initalize and store it in an instance variable
[16:23:43] taurgal: elomatreb: elomatreb thanks, that's it!
[16:23:59] taurgal: I must say I am quite disappointed by ruby...
[16:24:03] hxegon: elomatreb, taurgal you could also accept a date object in the initialize parameters
[16:24:20] hxegon: taurgal: why?
[16:24:20] taurgal: hxegon: yes, but this is not transparent then
[16:24:33] elomatreb: Or that, which might even be a better idea since you could e.g. use the activesupport helpers if you're in rails to create an instance
[16:25:07] elomatreb: You could create a factory method like SchoolDay.from_date or something
[16:25:15] knight33: has joined #ruby
[16:26:17] taurgal: elomatreb: but then I has to define <=> and all...
[16:26:19] hxegon: Also, this way you could have different date formats like Schoolday.from_ymd or .from_iso8601
[16:26:34] marxarelli: has joined #ruby
[16:26:34] yottanami1: taurgal, tnx, I just find `assert_includes`
[16:26:36] elomatreb: You just have to define <=> and include Comparable
[16:26:44] baweaver: Why do you even need a SchoolDate?
[16:26:51] hxegon: couldn't you forward that to date taurgal
[16:28:20] baweaver: What functionality are you hoping to add to the core class there that necessitates that inheritance?
[16:28:25] baweaver: What problem are you trying to solve?
[16:28:47] mim1k: has joined #ruby
[16:30:00] taurgal: baweaver: I wont to add special markup for school exams...
[16:30:45] bkulbida: has joined #ruby
[16:31:13] hxegon: taurgal: what kind of markup?
[16:31:31] matthewd: taurgal: Can you show an example of how you'd do this in another language?
[16:31:36] Sajeesh: can someone help me with https://gist.github.com/sajeeshgit/de9a40f53da4385edafc58d8e630eab8
[16:32:38] elomatreb: Sajeesh: Your mysql gem is broken and your Ruby version is old. You should probably upgrade and maybe a fresh mysql gem works again
[16:32:43] matthewd: Sajeesh: Try `gem pristine mysql`
[16:33:08] Sajeesh: trying that, thanks
[16:33:13] taurgal: matthewd: Well I would subclass Date... Now I am working around it
[16:33:25] elomatreb: Uh? 2.1 is still supported?
[16:33:34] taurgal: hxegon: It's to create a calendar
[16:33:35] hxegon: it's 2.1.7 now
[16:33:42] matthewd: taurgal: In which language?
[16:33:49] taurgal: hxegon: the code already works, I am just tidying the while thing
[16:33:54] taurgal: matthewd: python
[16:34:10] elomatreb: Oh, ruby-doc just doesn't show the red outdated banner for 2.1.4 (but it does for 2.1.7?)
[16:34:58] jane_booty_doe: has joined #ruby
[16:35:47] hxegon: taurgal: could you give us a more robust sample of the code? It's kind of hard to give a good solution when we don't understand exactly what you are trying to do yet
[16:35:51] matthewd: https://stackoverflow.com/questions/399022/why-cant-i-subclass-datetime-date :/
[16:37:02] taurgal: matthewd: thanks. I though date was OK in python...
[16:37:16] taurgal: hxegon: coding it right now.
[16:37:18] dionysus69: what is the URI class for? I dont understand idea behind first two examples, and difference between them https://ruby-doc.org/stdlib-2.4.1/libdoc/net/http/rdoc/Net/HTTP.html#top
[16:38:01] zacts: has joined #ruby
[16:38:30] rkazak: has joined #ruby
[16:39:24] haylon: For Hashes, the #include?(key) just checks to see if that key exists in the hash correct? The docs say #has_key?(key). I just wanted to verify
[16:40:01] matthewd: dionysus69: The URI class is for representing a URI as an object
[16:40:07] taurgal: hxegon: coding it right now.
[16:40:10] matthewd: haylon: Yes
[16:40:16] dionysus69: and whats the point? why isnt string enough?
[16:40:17] elomatreb: dionysus69: HTTP.get expects the hostname and the path (the file) as different parameters (and e.g. without a protocol), the URI class can parse an entire URI
[16:40:23] baweaver: >> {a: 1}.include?(:a)
[16:40:24] ruby[bot]: baweaver: # => true (https://eval.in/809752)
[16:40:32] dionysus69: oh I see, its about parsing then
[16:40:36] elomatreb: Look at how a HTTP request works, the path is independent of the Host
[16:40:45] dionysus69: thanks elomatreb
[16:40:56] baweaver: ACTION has never been a particular fan of Net::HTTP
[16:41:01] haylon: Thank you mathewd
[16:41:06] baweaver: ACTION thinks it's clunky and awkward
[16:41:08] dionysus69: baweaver: are there alternatives ? :D
[16:41:16] elomatreb: open-uri for simple get requests
[16:41:17] dionysus69: I just need to send post requests
[16:41:37] baweaver: several, but sometimes it's easier just to outright use the builtins
[16:41:50] baweaver: normally I go for Typhoeus if I need to do much
[16:43:00] dionysus69: baweaver: atm I dont have enough manual request experience to understand the difference so i ll stick with vanilla ruby lib :D
[16:43:01] elomatreb: If you're doing like a utility script you need to consider if installing a gem (and even maybe setting up bundler) is worth the trouble you save
[16:43:21] dionysus69: I am going to build a lil script that will send sms messages from rails app
[16:43:32] elomatreb: Look at a raw http request in your browser, it's a very easy to understand protocol (at least the core basics)
[16:43:37] dionysus69: to verify phone numbers upon registration asyncronously
[16:44:10] dionysus69: I actually have php sample provided, translating it to ruby now :D if you can help you are welcome xD
[16:44:33] baweaver: If it's Twilio they have Ruby options
[16:45:51] dionysus69: no it's some local company provided script in my country
[16:46:15] dionysus69: twilio is 2.5 times more expensive per sms, if it were cheaper I would definitely go with it
[16:46:36] tmm88: has joined #ruby
[16:47:36] ta: has joined #ruby
[16:47:43] tmm88: hey guys. i have a doubt i created this gitst https://gist.github.com/tiagmoraismorgado/2760487cc34e812c9884f12846b0310b
[16:47:50] tmm88: for making a contribution to sonic pi
[16:48:06] tmm88: but i cannot print the binary digit to my terminal console
[16:48:20] tmm88: can you please help me to fix this tiny little issue
[16:48:40] roshanavand: has joined #ruby
[16:48:51] elomatreb: Some output would help, i.e. what do you expect and what are you getting instead
[16:49:08] tmm88: i expect a binary digit
[16:49:12] tmm88: i am getting nothing
[16:49:24] baweaver: >> '1'.to_s(2)
[16:49:25] ruby[bot]: baweaver: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/809753)
[16:49:38] baweaver: >> 1.to_s(2)
[16:49:39] ruby[bot]: baweaver: # => "1" (https://eval.in/809754)
[16:49:54] elomatreb: Yeah, arguments in ARGV are strings, not numbers
[16:49:55] baweaver: ARGV[0] is going to be a string coming in
[16:49:59] tmm88: by using something like this on the console ruby -r cenar.rb "333"
[16:50:08] tmm88: so how do i get a number
[16:50:15] tmm88: i think this is the issue
[16:50:19] elomatreb: >> Integer("12")
[16:50:19] baweaver: where did you find to_s?
[16:50:20] ruby[bot]: elomatreb: # => 12 (https://eval.in/809755)
[16:50:31] tmm88: stackoverflow
[16:50:35] baweaver: elomatreb: not to_i?
[16:50:52] tmm88: perharps to i
[16:50:57] tmm88: this might be what i want
[16:51:05] hxegon: tmm88: http://www.virtuouscode.com/2012/05/07/a-ruby-conversion-idiom/
[16:51:06] elomatreb: Isn't there some difference between how they handle invalid strings? I just always use integer because idk
[16:51:26] baweaver: &ri Kernel#Integer
[16:51:26] `derpy: http://ruby-doc.org/core-2.4.1/Kernel.html#method-i-Integer
[16:51:27] aglorei: has joined #ruby
[16:51:28] tmm88: PrototypeTest.permScales(ARGV[0]) then how do i fix this line?
[16:51:35] baweaver: &ri String#to_i
[16:51:35] `derpy: http://ruby-doc.org/core-2.4.1/String.html#method-i-to_i
[16:51:42] hxegon: >> "".to_i elomatreb
[16:51:46] baweaver: (mainly because I don't want to google)
[16:51:47] ruby[bot]: hxegon: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[16:51:50] elomatreb: >> nil.to_i
[16:51:56] ruby[bot]: elomatreb: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
[16:51:56] hxegon: hmm, in my pry that is 0
[16:52:02] elomatreb: Yeah, nil too IIRC
[16:52:09] baweaver: bot is crashing a bit
[16:52:14] hxegon: but integer is stricter
[16:52:30] hxegon: excuse me, Integer()
[16:53:00] baweaver: tmm88: Use the information that was just posted and see if you can piece it together
[16:53:42] nhhc: has joined #ruby
[17:00:07] gusrub: has joined #ruby
[17:03:19] ascarter: has joined #ruby
[17:07:01] dionysus69: I have two roadblocks on my translation trip
[17:07:17] dionysus69: one is Json_encode([“123”]) in php, what this would be in ruby?
[17:08:08] elomatreb: See http://ruby-doc.org/stdlib-2.4.1/libdoc/json/rdoc/JSON.html
[17:09:14] dionysus69: so is that equivalent to JSON.generate?
[17:09:47] duderonomy: has joined #ruby
[17:10:21] troulouliou_dev: has joined #ruby
[17:10:44] dc2: has joined #ruby
[17:10:48] troulouliou_dev: hi why is rubocop detecting MYCONST = '' as : Freeze mutable objects assigned to constants issue ?
[17:11:04] troulouliou_dev: i mean what else can i do instead of MYCONST = 'BLAH'
[17:11:06] TomyLobo: has joined #ruby
[17:11:19] havenwood: troulouliou_dev: You can freeze the String via magic comment or #freese.
[17:11:38] dionysus69: so you dont accidentally change constant later I guess?
[17:11:45] havenwood: troulouliou_dev: MYCONST = ''.freeze
[17:11:52] elomatreb: dionysus69: If you just want to wrap something in an Array and stringify it you may want to use #to_json, but generate works too
[17:12:30] dionysus69: ye just remembered about to_json, I guess that's it. but the output doesnt make sense, I gues I dont have enough experience with this syntax. {\"hello\":\"goodbye\"}
[17:12:53] elomatreb: What would you expect? That's regular valid JSON
[17:13:07] havenwood: dionysus69: Print it and look at it. It's JSON.
[17:13:47] dionysus69: oh puts changed the syntax again
[17:13:53] havenwood: troulouliou_dev: Here's a writeup on frozen string literals, which would freeze that String automagically .
[17:14:00] havenwood: troulouliou_dev: https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3
[17:14:01] dionysus69: thx for the hint :D
[17:14:38] troulouliou_dev: havenwood, thanks
[17:14:52] __Yiota: has joined #ruby
[17:17:00] jgt2: has joined #ruby
[17:18:00] DLSteve: has joined #ruby
[17:18:37] bmurt: has joined #ruby
[17:20:50] ta: has joined #ruby
[17:21:18] LastWhisper____: has joined #ruby
[17:21:19] rkazak: has joined #ruby
[17:22:13] xall: has joined #ruby
[17:23:25] brent__: has joined #ruby
[17:24:45] dionysus69: can anyone help me understand what is this doing?
[17:24:56] dionysus69: https://gist.github.com/anonymous/adc6c380c08d9eeb937e3279fca303fb
[17:25:14] havenwood: dionysus69: That's not Ruby.
[17:25:30] dionysus69: I know its php :D trying to translate it
[17:25:43] dionysus69: but i have no idea what it does in first place
[17:25:46] havenwood: dionysus69: Figure out what it does in ##php and then we can help.
[17:25:46] troulouliou_dev: havenwood, mixing 'bla' and 'bla'.freeze won't lead to any wonky issue ?
[17:25:59] elomatreb: PHP lacks an actual HTTP client in it's standard library, so they use curl (a separate request library) to build one. That whole mess sets up common options
[17:26:25] elomatreb: And turns off SSL verification??
[17:26:58] havenwood: troulouliou_dev: It's fine to freeze some Strings. The only issue you would have is if you try to mutate it. But in that case you want the explosion not silent bugs.
[17:27:08] havenwood: troulouliou_dev: Freeze away!
[17:27:32] roshanavand: has joined #ruby
[17:27:46] dionysus69: elomatreb: ye dunno, this is weird script from a weird company :D
[17:28:39] ascarter: has joined #ruby
[17:29:09] roshanavand: has joined #ruby
[17:31:32] chouhoulis: has joined #ruby
[17:32:46] jusa: has joined #ruby
[17:36:40] bast: has joined #ruby
[17:36:49] troulouliou_dev: havenwood, ok thanks
[17:38:10] bast: has joined #ruby
[17:38:47] yottanami: has joined #ruby
[17:39:20] bast: has joined #ruby
[17:39:21] bast: has joined #ruby
[17:41:24] BTRE: has joined #ruby
[17:41:49] latemus: has joined #ruby
[17:45:06] ^mtkd: has joined #ruby
[17:45:10] rohitpaulk: has joined #ruby
[17:45:12] troulouliou_dev2: has joined #ruby
[17:46:43] konsolebox: has joined #ruby
[17:55:02] segy: has joined #ruby
[17:55:48] dionysus69: The API asks me to send it SHA1 of some 4 pieces of specific info... I don't understand how can they later decode it?
[17:56:17] havenwood: dionysus69: It's a one-way hashing function. They can compare it to another SHA1.
[17:56:28] dionysus69: I am not encoding it with any specific public key right?
[17:56:58] dionysus69: yes but I am sending them info like phone number, text, and secret api key which then will be used to send sms with some random text to phone
[17:57:00] havenwood: dionysus69: I'd suggest reading up on checksums.
[17:57:03] CacoS: has joined #ruby
[17:57:13] dionysus69: how can they compare it to other SHA1, two pieces of information from here are random
[17:57:25] konsolebox: has joined #ruby
[17:57:37] dionysus69: I could be sending anything right? any phone number with any text
[17:58:21] dionysus69: ok one second
[17:58:29] dionysus69: let me post full snippet
[17:58:36] havenwood: dionysus69: This doesn't seem Ruby-related. Maybe #ruby-offtopic.
[17:58:40] havenwood: dionysus69: Is it a Ruby snippet?
[17:59:02] dionysus69: https://gist.github.com/anonymous/d91ed3edffb4a7be43d0b9fd6c68cd5a
[17:59:10] dionysus69: yep it is ruby :D
[18:00:06] havenwood: dionysus69: Well, you sent them all parts of that text that is checksummed except for the API sekret, which they presumably know.
[18:00:19] havenwood: dionysus69: So they then compare the SHA1s.
[18:00:19] dionysus69: ok now I get it actually
[18:00:42] dionysus69: I was like how do they decode api secret if I encode it with other stuff
[18:00:52] mikecmpbll: has joined #ruby
[18:02:32] dionysus69: one more offtopic question for today, even if I send this info through http, information is supposed to be secure right? it is pretty impossible to guess api key from the hash I am sending isn't it?
[18:03:05] havenwood: typical http 1.1 is plaintext
[18:03:15] havenwood: text over the wire, you can read it all
[18:03:30] havenwood: dionysus69: do you mean https?
[18:03:37] dionysus69: yes so? i am still sending the hash? without knowing api key in advance, how would I know if it is right or wrong
[18:03:44] dionysus69: nope I meant http
[18:04:04] havenwood: dionysus69: it's not secure at all
[18:04:05] dionysus69: https would be required if I were sending api key as a regular post param as well, without digest
[18:04:31] SeepingN: has joined #ruby
[18:04:35] dionysus69: so how would anyone be able to get api key, from the digest and all other params as plaintext?
[18:04:55] konsolebox: has joined #ruby
[18:05:23] havenwood: dionysus69: your api sekret would even be vulnerable if someone built a rainbow table off your other data sans sekret
[18:05:30] havenwood: dionysus69: the rest is in plaintext
[18:06:18] havenwood: dionysus69: If I wanted your sekret, I'd try every possible string following your plaintext public data and record all the checksums (rainbow table). Then the one that matches is your sekret.
[18:06:57] dionysus69: i dont understand how that rainbow table would help make brute force faster
[18:06:58] havenwood: dionysus69: Maybe a script kiddie wouldn't figure it out but I'd consider it completely insecure based on what you've shown us.
[18:07:00] sonOfRa: If you send this over HTTP, it's vulnerable to replay attacks
[18:07:07] havenwood: dionysus69: Look up rainbow tables.
[18:07:10] dionysus69: it will still be brute force decoding sha1 thats how I see it
[18:07:13] sonOfRa: You don't even need a rainbow table to recover the secret, you don't NEED to recover the secret
[18:07:23] havenwood: dionysus69: Try making your own. Discover your own sekret. It's a good excercise.
[18:07:46] jjunior: has joined #ruby
[18:07:53] dionysus69: i dont know where to start though :D
[18:08:17] sonOfRa: So, you can't really recover the key from intercepting a message, but you can forge the same message again
[18:08:24] xall: has joined #ruby
[18:08:37] sonOfRa: Which is definitely bad. The answer is use https. Always. Never not. Every time.
[18:08:40] havenwood: sonOfRa: Well, you can recover the key or forge the message. There are multiple vectors of attack.
[18:08:44] AlexRussia: has joined #ruby
[18:08:50] jjunior: So. If I start a gem programmatically, is there a way to update LOAD_PATH to require gem in the next line?
[18:09:07] havenwood: dionysus69: +1 HTTPS
[18:09:24] dionysus69: sonOfRa, the only thing I would be able to do is to send same data over and over again, because I would still need to decode secret to send data I want right?
[18:09:26] nitric: has joined #ruby
[18:09:29] sonOfRa: havenwood: yeah, you can recover the secret by building a rainbow table, but you don't need to if you just want to show that you can send unauthorized messages (which is usually enough as a proof of concept)
[18:09:38] havenwood: sonOfRa: true
[18:09:57] sonOfRa: dionysus69: "the only thing". Sending unauthorized messages is always a breach of security. If you think it's not, your threat model is dumb.
[18:10:20] jjunior: *install a gem programmaticaly
[18:10:25] dionysus69: haha I agree it's not a good practice, I am just theorizing :D
[18:10:32] havenwood: jjunior: There's probably a way. Say more about what you're doing? Have any code to show?
[18:10:38] dionysus69: trying to understand how internet security works in general
[18:11:30] dc2: has joined #ruby
[18:11:32] jane_booty_doe2: has joined #ruby
[18:12:46] lxsameer: has joined #ruby
[18:12:54] taurgal: has joined #ruby
[18:13:00] jjunior: havewood: There is Puppet in the middle of the problem. While puppet applies a manifest (that ensures a gem is installed), if I require that gem after it, it's not available. Only in the next run.
[18:13:20] havenwood: dionysus69: Here's a tiny little rainbow table in Ruby: require 'digest/sha1'; 'a'.upto('zz').map { |s| [Digest::SHA1.hexdigest(s), s] }.to_h
[18:13:45] chouhoulis: has joined #ruby
[18:13:52] tomphp: has joined #ruby
[18:13:56] havenwood: dionysus69: If you give me the hash "7acdfe9c6bbea6dfaadf40d521f346a1de647983" I can see that key points to the value: "zp"
[18:14:10] havenwood: >> require 'digest/sha1'; Digest::SHA1.hexdigest "zp"
[18:14:11] ruby[bot]: havenwood: # => "7acdfe9c6bbea6dfaadf40d521f346a1de647983" (https://eval.in/809765)
[18:14:20] havenwood: dionysus69: And look, I've discovered the plaintext.
[18:14:57] havenwood: dionysus69: Now just put everything but your sekret key in front of the random strings and you've got a rainbow table to attack your payload.
[18:15:17] ta: has joined #ruby
[18:16:44] PaulCapestany: has joined #ruby
[18:17:05] dionysus69: I couldnt relate this case to the one we were talking about
[18:17:32] havenwood: dionysus69: https://gist.github.com/anonymous/d91ed3edffb4a7be43d0b9fd6c68cd5a#file-post_data-rb-L8
[18:17:49] dionysus69: we were able to get plain text so easily because we only had 25^2 cases and we had full raindbow table with all possible cases
[18:18:09] roshanavand: has joined #ruby
[18:18:36] havenwood: dionysus69: I can make a massive rainbow table for your payload in minutes.
[18:18:57] havenwood: dionysus69: It is trivial to break.
[18:18:58] havenwood: The api_secret is mine.
[18:19:22] havenwood: dionysus69: It'd not trust that api_secret is secret if anyone grabs it over the wire and wants at the payload.
[18:19:54] havenwood: dionysus69: Then again, maybe nobody will happen to crack it. It's certainly insecure.
[18:20:07] dionysus69: hard for me to think about it :S + you have to be a middle man right? given all targeted traffic needs to pass through my node in order to be able to collect such data
[18:20:20] havenwood: dionysus69: Just use HTTPS. ;-P
[18:20:42] dionysus69: i know i would of course for a production app
[18:20:54] dionysus69: their api actually is a https address
[18:20:57] havenwood: dionysus69: I gotta run, but when I have a few minutes later I'd be happy to craft an exploit for your payload and show you
[18:21:17] dionysus69: hehe cool, i ll ping you later sometime then, thanks already too!
[18:23:16] mtkd: has joined #ruby
[18:28:55] jenrzzz: has joined #ruby
[18:28:55] jenrzzz: has joined #ruby
[18:29:26] marr: has joined #ruby
[18:29:53] normie1: has joined #ruby
[18:30:05] chouhoulis: has joined #ruby
[18:31:58] jamesaxl: has joined #ruby
[18:32:26] lxsameer: has joined #ruby
[18:33:16] KeyJoo: has joined #ruby
[18:33:49] normie1: has joined #ruby
[18:35:15] Cohedrin: has joined #ruby
[18:37:59] taurgal: I defined a "[]=" method for my class. How can I use it from another method?
[18:40:48] ta: has joined #ruby
[18:41:13] ascarter: has joined #ruby
[18:41:37] alibby: self[:joe]= maybe?
[18:42:00] taurgal: alibby: thanks!
[18:42:17] alibby: taurgal: That's a guess, I don't recall ever doing it.
[18:43:05] taurgal: alibby: just checked ;)
[18:44:09] ule: hey guys
[18:44:16] knight33: has joined #ruby
[18:44:53] ule: trick question: What do you guys think about the ruby code style from bbatsov? -> https://github.com/bbatsov/ruby-style-guide
[18:45:20] ule: I would love to hear about the idea of single responsability and methods with <= 10 lines of code
[18:45:34] ule: is it good or bad idea in your opinion?
[18:46:39] havenwood: ule: Learn to make small methods before you learn the exceptions.
[18:47:20] ule: havenwood: that means that you agree with it that right?
[18:47:22] mikecmpbll: i find those arbitrary rules utterly pointless
[18:47:43] alibby: ule: I'm scanning the guide now, it looks decent enough. Small things I don't really care for, but honestly consistency in a codebase trumps any of my personal preferences. Short methods rock.
[18:47:44] ule: mikecmpbll: why?
[18:48:07] ule: alibby: thanks for sharing your thoughts
[18:48:11] mikecmpbll: ule : because what logic is there, from a comprehension point of view, to impose an arbitrary numerical constraint on number of lines?
[18:48:43] mikecmpbll: can i understand a 11 line method less well than a 10 line one? no.
[18:48:50] ule: mikecmpbll: I mean.. you is that guy that prefeers write a method with 100 lines instead of splitting the logic to 6 private methods?
[18:48:57] havenwood: ule: You could likewise say to limit sentences to 20 words. Do you agree with that?
[18:49:00] alibby: Well yeah, 10 vs 11 is nitpicking.
[18:49:23] mikecmpbll: if it takes 100 lines of code to do something well defined. yes that's fine.
[18:49:24] alibby: But 11 turns to 25 turns to 100 over time. Kinda gotta draw the line somewhere, but better to go with a gut feel about complexity.
[18:49:36] mikecmpbll: no, you don't have to draw the line anywhere
[18:49:37] havenwood: ule: It might help folk who are creating obscenely run-on sentences that go forever and ever to have some sane limit so they do use periods and don't just keep typing and typing but really a writer who knows what they're doing isn't going to follow this sentence limit, right?
[18:49:38] alibby: Though tools are not all that great at analyzing complexity.
[18:49:38] ule: mikecmpbll: ohh OK
[18:50:01] AlexRussia: has joined #ruby
[18:50:49] ule: havenwood: I see right agree
[18:50:59] ule: cool, thanks for answering guys
[18:52:00] elomatreb: Remember that you can always turn off the linter for a scope, there may be good reasons for a long method but they're rare
[18:52:36] ule: elomatreb: what is a long method for you?
[18:52:46] alibby: elomatreb: I dig it.
[18:52:53] PatrikasZvaigzde: has joined #ruby
[18:53:24] segy: has joined #ruby
[18:53:34] elomatreb: By "long" I mean longer than some arbitrary number you deem acceptable, I usually leave it at the 10 lines from the defaults and it's fine
[18:54:46] AlexRussia: has joined #ruby
[18:54:47] ta: has joined #ruby
[18:55:31] arthurl: has joined #ruby
[18:56:16] AlexRussia: has joined #ruby
[18:57:21] mikecmpbll: another reason why number of lines is completely stupid is just by formatting the same code slightly different could double the number of lines it's over.
[18:57:26] mikecmpbll: but it obviously doesn't change how hard that unit of code is to comprehend
[18:57:42] mikecmpbll: so that demonstrates how bad a unit of measurement LOC is for complexity.
[18:58:28] ule: apeiros: online?
[18:58:54] ule: look at me.. Im asking questions using ruby style "online?"
[19:03:43] jgt2: has joined #ruby
[19:04:02] shinnya: has joined #ruby
[19:08:40] enterprisey: has joined #ruby
[19:11:19] PaulCapestany: has joined #ruby
[19:12:15] dc2: has joined #ruby
[19:13:12] ddffg: has joined #ruby
[19:14:59] ur5us: has joined #ruby
[19:17:30] patr0clus: has joined #ruby
[19:17:30] ta: has joined #ruby
[19:20:10] Silthias: has joined #ruby
[19:23:06] Cohedrin: has joined #ruby
[19:24:02] sneakers: has joined #ruby
[19:26:22] pankaj: has joined #ruby
[19:26:37] jenrzzz: has joined #ruby
[19:26:37] jenrzzz: has joined #ruby
[19:29:01] jamesaxl: has joined #ruby
[19:38:39] pupsicle: has joined #ruby
[19:42:38] d5sx43: has joined #ruby
[19:43:19] jenrzzz: has joined #ruby
[19:43:19] jenrzzz: has joined #ruby
[19:43:58] AgentVenom: has joined #ruby
[19:45:14] MarkBilk_: has joined #ruby
[19:52:08] ecuanaso: has joined #ruby
[19:54:39] brent__: has joined #ruby
[19:56:00] glmglmglm: has joined #ruby
[19:56:56] quobo: has joined #ruby
[19:57:05] zenspider: ugh. you *can't* judge a method by its line count... that's just horseshit
[19:57:32] baweaver: zenspider: you and I both know we'd give side-eye to a 100+ long line method though
[19:58:19] zenspider: ACTION glances at RubyLexer.next_token, weighing in at a feeble 252 lines
[19:58:27] baweaver: A method does precisely what it needs to, nothing more, nothing less
[19:58:31] segmond: has joined #ruby
[19:58:52] zenspider: yes, that is definitely the hope and the goal... and it completely independent of line count
[19:59:13] zenspider: Much better to look at its complexity than its line count tho... and even still, you can't judge it by the score.
[19:59:49] baweaver: I'd just look at a super sized method with some skepticism out the gate
[20:00:16] jenrzzz_: has joined #ruby
[20:00:17] zenspider: alibby: no, better to *measure*
[20:01:17] baweaver: not finding the source for next_token. Probably looking in the wrong place
[20:02:50] zenspider: baweaver: https://gist.github.com/8fdad7f7532ccf792d293ede17791d5f
[20:02:53] baweaver: zenspider: https://github.com/coatl/rubylexer/blob/master/lib/rubylexer.rb - this?
[20:03:21] zenspider: no, it's actually generated from https://github.com/seattlerb/ruby_parser/blob/master/lib/ruby_lexer.rex ... basically that whole file becomes one big method
[20:03:45] zenspider: and honestly... that method is great. no problems with it... but I can't tell you how my heredoc code works at all. :P
[20:04:54] cdg: has joined #ruby
[20:05:02] ascarter: has joined #ruby
[20:05:30] zenspider: my nightmare: https://github.com/seattlerb/ruby_parser/blob/master/lib/ruby_lexer.rb#L146-L245
[20:06:21] zenspider: just horrible
[20:07:09] luckyrub_: has joined #ruby
[20:08:17] zenspider: and I'm currently adding about 2900 lines of diff to sexp_processor. :P
[20:09:17] nertzy: has joined #ruby
[20:10:38] zenspider: I'm highly tempted to remove an entire section of it tho... this is adding pattern matching to sexps and currently you can do a named "capture" like so: match = s{ s(:node, _ % :name) } =~ sexp; match[:name] => whatever
[20:10:56] zenspider: just not sure how much that's worth versus the complexity it adds
[20:11:00] baweaver: ACTION really needs to get coffee
[20:11:16] zenspider: esp given that you can't use it inside the same expression
[20:11:26] zenspider: get it! I wholeheartedly support that decision.
[20:11:33] zenspider: ACTION looks around in his cafe
[20:11:44] baweaver: I'll have to read through all that code some time and try and grok it
[20:11:53] zenspider: I just had a quad and I'm tempted to go back for more
[20:12:08] Rich_Morin_: has joined #ruby
[20:12:17] baweaver: latest screwing around is making a JSON query language roughly analogous to JQ
[20:13:00] dc2: has joined #ruby
[20:13:08] baweaver: because config files suck to parse, and are even worse to match/update with 10 layers deep of `if` checks and `each` blocks
[20:13:40] baweaver: in this case, Grafana configuration mass-updates whenever someone has the idea to switch DB clusters or tag names again
[20:14:49] myk267: has joined #ruby
[20:15:04] dionysus69: has joined #ruby
[20:15:35] jgt2: has joined #ruby
[20:16:04] ecuanaso: has joined #ruby
[20:18:19] luckyruby: has joined #ruby
[20:18:37] ascarter: has joined #ruby
[20:19:48] sarbs: has joined #ruby
[20:26:20] tolvstaa: has joined #ruby
[20:27:32] tolvstaa: Hello, I'm trying to use YARD to document a script and it's exhibiting some very strange behavior.
[20:28:13] tolvstaa: It's removing the first letter from my method parameters and putting two commas after them. I can't find anything pertaining to this online.
[20:28:14] mtkd: has joined #ruby
[20:29:16] luckyrub_: has joined #ruby
[20:30:41] tolvstaa: I'm using Ruby 2.3.1 and YARD 0.9.9
[20:31:48] gusrub: has joined #ruby
[20:32:21] zenspider: tolvstaa: I can't help. I find YARD to be a mess. I use straight rdoc.
[20:32:45] zenspider: YARD seems to mostly appeal to those coming over from java and still stuck on typing
[20:33:55] tolvstaa: ah well, thanks anyway :)
[20:45:57] mitt3ns: has joined #ruby
[20:51:55] zenspider: huh... if a.b? c then ... end is fine. but case when a.b? c then ... end is not
[20:52:21] zenspider: ruby syntax is such a tar pit
[20:53:48] romeoh: has joined #ruby
[20:54:35] leah2: case then is never allowed?
[20:54:42] leah2: never has been
[20:57:29] luckyruby: has joined #ruby
[21:01:01] MrBismuth: has joined #ruby
[21:02:40] leitz: has joined #ruby
[21:03:25] Fernando-Basso: has joined #ruby
[21:03:58] ljarvis: yes it has
[21:05:26] jenrzzz: has joined #ruby
[21:05:26] jenrzzz: has joined #ruby
[21:05:43] luckyruby: has joined #ruby
[21:06:21] ljarvis: >> case "foo" when /foo/ then "omg" end
[21:06:22] ruby[bot]: ljarvis: # => "omg" (https://eval.in/809832)
[21:06:46] nowhereman: has joined #ruby
[21:07:18] ljarvis: tbh i thought it was removed at some point, but maybe it was just discussed
[21:11:24] normie1: has joined #ruby
[21:13:35] zenspider: leah2: not true... it's called an expressionless case.
[21:13:46] dc2: has joined #ruby
[21:14:03] zenspider: basically a better aligned multi-clause if
[21:14:14] ljarvis: oh that's what they're refering to?
[21:14:28] zenspider: that's how I read it
[21:14:33] zenspider: oh. you were probably thinking of colons
[21:14:44] ljarvis: yeah, case ... == case true; and i love it
[21:15:14] ljarvis: ah right, yes probably
[21:15:18] ljarvis: forgot those existed
[21:15:23] ljarvis: u so silly
[21:15:24] zenspider: I guess I never thought of it that way. I always thought of it as a transformer to if
[21:15:58] neruda: has joined #ruby
[21:16:10] zenspider: hmmm... I don't think it actually acts like true === expr
[21:16:13] ljarvis: I think I read it as `case true` somewhere and it just made sense to me. Not sure how accurate it is. I love it sometimes though, really makes some code easy to read
[21:16:16] luckyruby: has joined #ruby
[21:16:17] leah2: i thought only : was allowed in case, and deleted for 1.9?
[21:16:19] ljarvis: right, perhaps not
[21:16:19] zenspider: >> true === :truthy
[21:16:21] ruby[bot]: zenspider: # => false (https://eval.in/809834)
[21:16:34] neruda: its real quiet on the rails chan, so I'll try here
[21:16:43] neruda: are there additional anti-csrf measures a rails app can employ other than the :prevent_forgery and session nonce? Like storing and checking IP address on each request etc?
[21:17:08] ljarvis: neruda: not built in
[21:17:12] zenspider: neruda: not a good reason to ask here
[21:17:13] GinoMan1423: has joined #ruby
[21:17:23] ljarvis: also true ^
[21:17:34] zenspider: maybe there is a ##webdev or something
[21:17:35] neruda: zenspider: thx
[21:18:17] leah2: hm. 1.8 had optional then or : for when and rescue
[21:18:23] zenspider: it'd be kinda neat if TrueClass#=== o was just !!o
[21:18:41] leah2: same in 1.9.3
[21:19:05] leah2: ah, 1.9 drops :, right
[21:19:07] zenspider: leah2: were you referring to that or to `case when ...` ?
[21:19:57] leah2: i dont even know how case when is parsed :D
[21:20:23] leah2: isnt it just case true when ... ?
[21:20:39] dcluna: has joined #ruby
[21:20:44] ljarvis: short story: no, not exactly
[21:20:59] ljarvis: but i have liked to think of it like that
[21:21:07] ljarvis: for better or worse
[21:21:17] zenspider: case ; (when expr [then] expr)* (else expr)? end
[21:21:32] leah2: i dont see a special node for it?
[21:21:53] zenspider: if expr [then] expr (elsif expr [then] expr)* end
[21:21:59] zenspider: oops. else.
[21:22:08] zenspider: special node?
[21:22:17] leah2: for case x when vs case when
[21:22:33] ljarvis: what do you mean node?
[21:22:38] leah2: in the AST
[21:22:56] zenspider: what AST are you looking at?
[21:22:57] ljarvis: ah, yeah i haven't dug (and wont, im not feeling up to that tonight)
[21:23:22] zenspider: looking directly at parse.y?
[21:23:36] zenspider: there is no special node for it.
[21:23:40] zenspider: look for NEW_CASE
[21:23:57] leah2: it uses 0 as first arg
[21:24:45] leah2: duh, was confusing NODE_CASE and NODE_WHEN
[21:24:53] jamesaxl: has joined #ruby
[21:25:05] leah2: if (node->nd_head == 0) {
[21:25:07] leah2: COMPILE_(ret, "when", node->nd_body, poped);
[21:26:03] zenspider: again, basically just an if stmt
[21:26:45] DeeJayh: has joined #ruby
[21:26:50] ljarvis: good to know
[21:32:58] postmodern: has joined #ruby
[21:33:00] duderonomy: has joined #ruby
[21:38:32] _sfiguser: has joined #ruby
[21:44:11] bkxd: has joined #ruby
[21:47:41] chouhoul_: has joined #ruby
[21:48:40] SilentNinja1: has joined #ruby
[21:49:01] SilentNinja1: Hi is there a one liner to convert local time to UTC? Thanks
[21:49:17] jusa: has joined #ruby
[21:51:02] luckyruby: has joined #ruby
[21:51:28] SilentNinja1: DateTime.now.utc ?
[21:54:57] GinoMan: has joined #ruby
[21:56:15] haylon: has joined #ruby
[21:56:34] brent__: has joined #ruby
[21:58:24] blackwind_123: has joined #ruby
[21:59:31] glmglmglm: has left #ruby: ("Leaving...")
[22:01:22] workmad3_: has joined #ruby
[22:01:38] luckyruby: has joined #ruby
[22:02:32] __Yiota: has joined #ruby
[22:06:34] tristanp: has joined #ruby
[22:06:42] brent__: has joined #ruby
[22:07:26] luckyrub_: has joined #ruby
[22:07:52] brent__: has joined #ruby
[22:10:41] havenwood: >> require 'date'; Time.now.utc.to_datetime.zone
[22:10:42] ruby[bot]: havenwood: # => "+00:00" (https://eval.in/809841)
[22:13:26] luckyruby: has joined #ruby
[22:14:29] zenspider: you can see it just in the regular output
[22:14:32] zenspider: >> Time.now.utc
[22:14:38] ruby[bot]: zenspider: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:14:47] dc2: has joined #ruby
[22:14:50] zenspider: what is that crap?
[22:14:58] havenwood: #=> 2017-06-01 22:14:44 UTC
[22:15:12] zenspider: yeah. that.
[22:15:34] zenspider: >> Time.now
[22:15:40] ruby[bot]: zenspider: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
[22:15:43] havenwood: #=> 2017-06-01 15:15:38 -0700
[22:15:53] zenspider: huh. I wonder what's going on
[22:16:17] mikecmpbll: has joined #ruby
[22:22:32] SeepingN: puts Time.now
[22:22:39] SeepingN: >> puts Time.now
[22:22:40] ruby[bot]: SeepingN: # => 2017-06-01 22:22:35 +0000 ...check link for more (https://eval.in/809843)
[22:22:53] SeepingN: puts Time.now.utc
[22:23:15] SeepingN: >> puts Time.now.utc
[22:23:21] ruby[bot]: SeepingN: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:23:47] ruby[bot]: Papierkorb: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:23:56] Papierkorb: at least it's not running 2.3.0
[22:23:57] SeepingN: >> puts TIme.utc
[22:23:58] ruby[bot]: SeepingN: # => uninitialized constant TIme ...check link for more (https://eval.in/809844)
[22:24:04] SeepingN: >> puts Time.utc
[22:24:05] ruby[bot]: SeepingN: # => wrong number of arguments (given 0, expected 1..8) (ArgumentError) ...check link for more (https://eval.in/809845)
[22:24:09] SeepingN: ya know what ruby, just figure it out
[22:25:09] zenspider: Papierkorb: that code goes WAY back. and works fine in irb. it's the service
[22:25:10] SeepingN: >> puts Time.utc(Time.now)
[22:25:11] ruby[bot]: SeepingN: # => no implicit conversion of Time into Integer (TypeError) ...check link for more (https://eval.in/809846)
[22:25:30] zenspider: SeepingN: please use IRB locally
[22:29:59] luckyruby: has joined #ruby
[22:31:09] jenrzzz: has joined #ruby
[22:31:10] jenrzzz: has joined #ruby
[22:35:16] ecuanaso: has joined #ruby
[22:35:19] luckyrub_: has joined #ruby
[22:38:42] gusrub: has joined #ruby
[22:41:09] gusrub: has joined #ruby
[22:41:34] jenrzzz: has joined #ruby
[22:41:35] jenrzzz: has joined #ruby
[22:45:45] im0nde: has joined #ruby
[22:47:15] ecuanaso: has joined #ruby
[22:56:05] GodFather_: has joined #ruby
[22:56:56] tristanp: has joined #ruby
[22:57:05] Cohedrin: has joined #ruby
[22:57:56] gusrub_: has joined #ruby
[23:02:21] PatrikasZvaigzde: has joined #ruby
[23:04:05] jamesaxl: has joined #ruby
[23:07:06] ledestin: has joined #ruby
[23:10:55] nowhere_man: has joined #ruby
[23:15:00] jamesaxl: has joined #ruby
[23:15:35] dc2: has joined #ruby
[23:16:21] cschneid_: has joined #ruby
[23:19:22] ur5us: has joined #ruby
[23:22:57] gusrub: has joined #ruby
[23:28:56] Silthias: has joined #ruby
[23:29:06] Cohedrin: has joined #ruby
[23:29:19] GinoMan: has joined #ruby
[23:32:25] jamesaxl: has joined #ruby
[23:37:40] snockerton: has joined #ruby
[23:41:24] username: has joined #ruby
[23:42:14] BSAlb: has joined #ruby
[23:42:46] Kero: has joined #ruby
[23:46:00] jamesaxl: has joined #ruby
[23:47:03] enterprisey: has joined #ruby
[23:48:50] jusa: has joined #ruby
[23:51:54] jamesaxl: has joined #ruby
[23:52:20] stormbytes: has joined #ruby
[23:58:02] cschneid_: has joined #ruby
[23:59:27] Kero: has left #ruby: ()