« Back to channel list

#ruby - 04 July 2018

« Back 1 day Forward 1 day »
[00:01:25] zxq2: is there a way to access the underlying file descriptor that belongs to a socket obj?
[00:01:30] cagomez: has joined #ruby
[00:04:23] duderonomy: has joined #ruby
[00:04:27] cschneid: has joined #ruby
[00:09:51] cagomez: has joined #ruby
[00:11:11] konsolebox: zxq2: #fileno or #to_i. See IO, which is a grandparent of Socket.
[00:14:18] caleBOT: has joined #ruby
[00:15:44] wilbert: has joined #ruby
[00:16:35] xuyuheng: has joined #ruby
[00:17:54] darkhanb: spaces or tabs?
[00:18:02] planigan: has joined #ruby
[00:18:33] cschneid: has joined #ruby
[00:18:46] blackmesa1: has joined #ruby
[00:19:46] havenwood: ?tabs darkhanb
[00:19:46] ruby[bot]: darkhanb: Ruby community standards recommend using 2 spaces as indentation (see https://github.com/bbatsov/ruby-style-guide#spaces-indentation and https://ukupat.github.io/tabs-or-spaces/).
[00:20:38] havenwood: darkhanb: 489 repos, 100% 2-space, soft tabs.
[00:21:16] havenwood: darkhanb: There is more than one way to do it, but we've all agreed on the right way. ;-)
[00:26:40] konsolebox: I code 2-spaces in Ruby as well, even though I generally prefer tabs. But "Ruby community standards" is quite misleading. It's "A community-driven Ruby coding style guide".
[00:27:16] amar_: has joined #ruby
[00:29:48] rshetty: has joined #ruby
[00:35:06] planigan: has joined #ruby
[00:36:04] zenspider: there's nothing misleading about it where tabs are concerned. Spaces or we knife you!
[00:36:43] xuyuheng: has joined #ruby
[00:38:45] mynameisdebian: has joined #ruby
[00:39:48] graphene: has joined #ruby
[00:41:54] addyluxe: has joined #ruby
[00:45:34] mynameis_: has joined #ruby
[00:47:13] orbyt_: has joined #ruby
[00:47:58] d^sh: has joined #ruby
[01:00:15] caleBOT: has joined #ruby
[01:02:06] cschneid: has joined #ruby
[01:05:10] wilbert: has joined #ruby
[01:10:03] cschneid: has joined #ruby
[01:10:26] roamingdog: has joined #ruby
[01:11:14] jrafanie: has joined #ruby
[01:11:24] cadillac_: has joined #ruby
[01:20:06] cschneid: has joined #ruby
[01:21:24] caleBOT: has joined #ruby
[01:30:03] noobineer: has joined #ruby
[01:34:19] xuyuheng: has joined #ruby
[01:35:18] mynameisdebian: has joined #ruby
[01:42:42] cschneid: has joined #ruby
[01:46:21] ciscam: has joined #ruby
[01:54:41] caleBOT_: has joined #ruby
[01:57:29] graphene: has joined #ruby
[01:58:28] n0m4d1c: has joined #ruby
[01:59:19] karapetyan: has joined #ruby
[02:04:36] bradleyprice: has joined #ruby
[02:07:52] graphene: has joined #ruby
[02:08:54] mynameisdebian: has joined #ruby
[02:11:30] bjpenn: has joined #ruby
[02:17:50] c0ncealed2: has joined #ruby
[02:27:44] amar_: has joined #ruby
[02:28:16] cschneid: has joined #ruby
[02:28:56] r29v: has joined #ruby
[03:00:17] cadillac_: has joined #ruby
[03:01:58] karapetyan: has joined #ruby
[03:04:03] mynameisdebian: has joined #ruby
[03:05:17] jinie: has joined #ruby
[03:06:49] n0m4d1c: has joined #ruby
[03:07:29] n0m4d1c: has left #ruby: ()
[03:07:53] cschneid: has joined #ruby
[03:09:57] braincrash: has joined #ruby
[03:14:55] coderphive: has joined #ruby
[03:25:55] apeiros__: has joined #ruby
[03:26:50] apeiros: has joined #ruby
[03:31:57] ciscam: has joined #ruby
[03:35:45] taylorzr: has joined #ruby
[03:35:52] apeiros__: has joined #ruby
[03:38:32] NingaLeaf: has joined #ruby
[03:43:11] kapil___: has joined #ruby
[03:43:45] gix: has joined #ruby
[03:46:47] graphene: has joined #ruby
[03:56:53] apeiros: has joined #ruby
[03:57:49] graphene: has joined #ruby
[03:57:50] fluxAeon: has joined #ruby
[03:59:50] darkhanb: has joined #ruby
[04:04:17] mr_rich101: has joined #ruby
[04:10:52] alex``: has joined #ruby
[04:10:53] bradleyprice: has joined #ruby
[04:12:33] caleBOT: has joined #ruby
[04:13:23] Crack: has joined #ruby
[04:13:46] mynameisdebian: has joined #ruby
[04:15:11] orbyt_: has joined #ruby
[04:29:21] rshetty: has joined #ruby
[04:31:53] erratic: has joined #ruby
[04:39:48] rshetty: has joined #ruby
[04:39:55] rshetty: has joined #ruby
[04:41:09] _rshetty_: has joined #ruby
[04:44:24] tolerablyjake: has joined #ruby
[04:48:05] Hobbyboy: has joined #ruby
[04:51:54] Axy: has joined #ruby
[04:51:55] Axy: has joined #ruby
[04:58:10] anisha: has joined #ruby
[05:03:25] tdy: has joined #ruby
[05:06:02] orbyt_: has joined #ruby
[05:13:06] reber: has joined #ruby
[05:14:47] graphene: has joined #ruby
[05:16:47] StarSeed0000: has joined #ruby
[05:25:13] zapata: has joined #ruby
[05:29:06] sauvin: has joined #ruby
[05:51:46] aupadhye: has joined #ruby
[05:53:31] bjpenn: has joined #ruby
[05:55:32] tolerablyjake: has joined #ruby
[05:55:32] roamingdog: has joined #ruby
[05:56:17] roamingdog: has joined #ruby
[05:56:30] aufi: has joined #ruby
[05:57:07] roamingdog: has joined #ruby
[05:57:54] roamingdog: has joined #ruby
[05:58:44] roamingdog: has joined #ruby
[06:01:39] rshetty: has joined #ruby
[06:03:31] wget: has joined #ruby
[06:03:31] wget: has joined #ruby
[06:04:01] mynameisdebian: has joined #ruby
[06:17:10] apeiros: has joined #ruby
[06:27:03] halbbalda: has joined #ruby
[06:28:10] amar: has joined #ruby
[06:34:34] andikr: has joined #ruby
[06:35:42] halbbalda: has left #ruby: ("Leaving")
[06:40:10] dionysus69: has joined #ruby
[06:41:02] marius: has joined #ruby
[06:41:51] konsolebox: has joined #ruby
[06:42:21] rshetty: has joined #ruby
[06:55:26] Megamos: has joined #ruby
[06:58:13] amar: has joined #ruby
[06:58:56] schleppel: has joined #ruby
[07:00:33] mtkd: has joined #ruby
[07:01:52] yohji: has joined #ruby
[07:04:56] vonfry: has joined #ruby
[07:07:17] dionysus69: Greetings to the Jedis of the red gem
[07:07:26] dionysus69: I have a strange problem
[07:08:17] dionysus69: I am using Jimson to send RPC commands to the server
[07:08:28] dionysus69: I create it like this Jimson::Client.new("http://localhost:123")
[07:08:36] BloopMonster: has joined #ruby
[07:08:48] TomyWork: has joined #ruby
[07:09:07] dionysus69: Jimson::Client.new("http://localhost:8545").SomeMethod works fine and returns successfully but I cannot do the same with method_missing
[07:10:26] amar: has joined #ruby
[07:10:36] pauliesaint: has joined #ruby
[07:11:41] dionysus69: so, this gives an error, invalid or empty response from server https://gist.github.com/webzorg/d7a6801270d30e999bad650e1a391a22
[07:12:06] dionysus69: but those two ways are the same right? in one I call method directly on the jimson orbject, while here I use method.send
[07:12:12] dionysus69: one works the other doesn't
[07:14:47] sysvalve: has joined #ruby
[07:16:10] claudiuinberlin: has joined #ruby
[07:20:00] blackmesa1: has joined #ruby
[07:22:08] conta: has joined #ruby
[07:22:21] amar: has joined #ruby
[07:22:33] Bish: havenwood: so ruby tries to call unary ** of {} ?
[07:23:27] havenwood: Bish: MRI is alone it seems in interpreting the {} as a block - hence no return value.
[07:24:03] anisha: has joined #ruby
[07:25:03] havenwood: Bish: I bisected it to this commit, where it goes from thinking it's a block to the segfault: https://github.com/ruby/ruby/commit/4b279cfdd2e3e4a05e852632f3305c893f6c46a4
[07:25:23] havenwood: I haven't had a chance to look into it further than that yet.
[07:25:31] Bish: thanks for your work :) although this bug unlikely would ever affect anyone
[07:27:53] Venomen: has joined #ruby
[07:27:54] Venomen: has joined #ruby
[07:28:44] havenwood: Bish: yeah, no wonder it went undetected
[07:29:25] Bish: i am wondering none ever played with ** in pry
[07:29:32] Bish: i guess people write clean code :D
[07:31:01] clemens3: has joined #ruby
[07:31:34] caleBOT_: has joined #ruby
[07:36:08] amar: has joined #ruby
[07:37:36] conta: has joined #ruby
[07:47:14] suukim: has joined #ruby
[07:48:20] burgestrand: has joined #ruby
[07:52:21] alem0lars: has joined #ruby
[07:53:58] mikecmpbll: has joined #ruby
[08:01:21] hurricanehrndz: has joined #ruby
[08:03:39] Tharbakim: has joined #ruby
[08:03:40] Tharbakim: has joined #ruby
[08:13:35] desperek: has joined #ruby
[08:18:59] rshetty: has joined #ruby
[08:19:09] rshetty: has joined #ruby
[08:20:51] jnollette: has joined #ruby
[08:21:19] amar: has joined #ruby
[08:24:56] Crack: has joined #ruby
[08:26:06] nowhereman_: has joined #ruby
[08:26:13] apeiros: has joined #ruby
[08:28:24] amar: has joined #ruby
[08:29:03] burgestrand: has joined #ruby
[08:35:28] conta: has joined #ruby
[08:35:37] Mike11: has joined #ruby
[08:36:19] za1b1tsu: has joined #ruby
[08:42:04] Sylario: has joined #ruby
[08:46:48] TinkerT: has joined #ruby
[08:53:40] Crack: has left #ruby: ()
[08:55:09] amar: has joined #ruby
[08:59:26] rippa: has joined #ruby
[09:03:33] Beams: has joined #ruby
[09:03:36] andikr: has joined #ruby
[09:05:01] amar_: has joined #ruby
[09:05:36] apeiros: anybody aware of any yaml emitters which provide lower level control on the formatting? such as aligning values, using specific forms of string representations etc.?
[09:12:13] d^sh: has joined #ruby
[09:12:20] beefjoe: has joined #ruby
[09:16:05] alex``: has joined #ruby
[09:17:10] tvw: has joined #ruby
[09:17:41] bjpenn: has joined #ruby
[09:19:37] roamingdog: has joined #ruby
[09:29:23] ellcs: has joined #ruby
[09:35:02] Tharbakim: has joined #ruby
[09:35:02] Tharbakim: has joined #ruby
[09:37:34] ellcs: has joined #ruby
[09:38:16] ferr: has joined #ruby
[09:41:38] schneider: has joined #ruby
[09:43:57] anisha: has joined #ruby
[09:55:47] Puffball: has joined #ruby
[09:56:45] kryptoz: has joined #ruby
[10:00:29] vondruch: has joined #ruby
[10:02:33] _rshetty_: has joined #ruby
[10:04:35] rikkipitt: has joined #ruby
[10:04:52] konsolebox: has joined #ruby
[10:04:53] _rshetty_: has joined #ruby
[10:05:59] rshetty: has joined #ruby
[10:10:05] alem0lars: has joined #ruby
[10:10:50] pauliesaint: has joined #ruby
[10:12:02] rshetty: has joined #ruby
[10:12:17] biberu: has joined #ruby
[10:14:36] naftilos76: has joined #ruby
[10:15:31] dreamthese: has joined #ruby
[10:17:09] graphene: has joined #ruby
[10:18:14] rshetty: has joined #ruby
[10:18:41] cschneid: has joined #ruby
[10:20:38] Alina-malina: has joined #ruby
[10:25:05] Dbugger: has joined #ruby
[10:25:12] bjpenn: has joined #ruby
[10:27:16] kryptoz: has joined #ruby
[10:27:45] _sfiguser: has joined #ruby
[10:27:50] _sfiguser: hello all i tried this https://github.com/argos83/ritm
[10:28:00] _sfiguser: but after having installed the certificate on firefox
[10:28:10] _sfiguser: it still does not work on https websites...
[10:28:41] canton7: what does "does not work" mean?
[10:30:40] _sfiguser: canton7, are you confident with https and certificates stuff ? i generated the certificate... so i have both .crt and key file
[10:30:44] _sfiguser: i imported in firefox...
[10:30:59] _sfiguser: under "view certificates" and in the tab "Authorities" i imported the crt
[10:31:26] _sfiguser: and if i activate the proxy and browse with firefox , for http i have no problems, for https i have the "add exception page"
[10:31:29] canton7: what's the actual problem you're having?
[10:31:40] _sfiguser: but for google or fcebook... i have an additional warning about hsts
[10:31:58] canton7: what does the additional warning say?
[10:32:08] _sfiguser: wait i'm pasting it to you
[10:32:55] _sfiguser: The owner of duckduckgo.com has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website.
[10:32:55] _sfiguser: This site uses HTTP Strict Transport Security (HSTS) to specify that Firefox may only connect to it securely. As a result, it is not possible to add an exception for this certificate.
[10:33:06] _sfiguser: duckduckgo.com uses an invalid security certificate. The certificate is not trusted because the issuer certificate is unknown. The server might not be sending the appropriate intermediate certificates. An additional root certificate may need to be imported. Error code: SEC_ERROR_UNKNOWN_ISSUER
[10:34:01] _sfiguser: https://bpaste.net/show/bd720906af5e
[10:34:08] _sfiguser: sorry if i pasted on channel my bad
[10:34:15] drale2k_: has joined #ruby
[10:34:15] _sfiguser: anyay you can read it in the bpaste
[10:34:31] canton7: and you've definitely imported the right root cert into firefox?
[10:34:32] rshetty: has joined #ruby
[10:36:30] canton7: the right VA, rather
[10:36:56] _sfiguser: canton7, i just have the crt i generated with: openssl pkcs12 -export -out certificate.pfx -inkey insecure_ca.key -in insecure_ca.crt
[10:37:13] _sfiguser: anyway when it was asking info, i just inserted random infos
[10:37:23] _sfiguser: and country code and so on
[10:37:35] _sfiguser: in firefox, i imported the .crt
[10:37:43] canton7: what about `openssl req -new -nodes -x509 -days 365 -extensions v3_ca -keyout insecure_ca.key -out insecure_ca.crt`?
[10:37:57] _sfiguser: canton7, this is to generate the certificate
[10:38:17] _sfiguser: canton7, sorry i misitook to paste
[10:38:20] _sfiguser: the right common
[10:38:24] _sfiguser: the right command
[10:38:36] _sfiguser: i did this penssl req -new -nodes -x509 -days 365 -extensions v3_ca -keyout insecure_ca.key -out insecure_ca.crt
[10:40:25] RougeT430: has joined #ruby
[10:41:50] andikr: has joined #ruby
[10:43:23] conta: has joined #ruby
[10:45:54] SebastianThorn: has joined #ruby
[10:47:20] rshetty: has joined #ruby
[10:55:21] schneider: has joined #ruby
[10:56:08] hfp_work: has joined #ruby
[10:56:30] burgestrand: has joined #ruby
[10:59:21] rshetty: has joined #ruby
[11:00:09] psychicist__: has joined #ruby
[11:01:50] rshetty: has joined #ruby
[11:06:02] anisha: has joined #ruby
[11:07:21] apeiros: has joined #ruby
[11:09:26] rshetty: has joined #ruby
[11:12:26] Fernando-Basso_: has joined #ruby
[11:14:44] jrafanie: has joined #ruby
[11:17:03] SebastianThorn2: has joined #ruby
[11:20:46] apparition: has joined #ruby
[11:21:46] vonfry: has joined #ruby
[11:23:53] _rshetty_: has joined #ruby
[11:25:35] Fernando-Basso_: https://repl.it/@FernandoBasso/ruby-blocks I need help understanding the @boxes.select(&:buyable?) part.
[11:25:52] Fernando-Basso_: How does select know buyable? comes from Box?
[11:28:00] burgestrand: fernando_basso_ It doesn't, it just assumes it does
[11:28:19] burgestrand: fernando_basso_ it's equivalent to @boxes.select { |box| box.buyable? }
[11:29:00] Fernando-Basso_: I have read that the & syntax turns something into a block.
[11:29:14] Fernando-Basso_: So, &:buyable? turns the method buyable? into a block?
[11:30:15] ldnunes: has joined #ruby
[11:32:17] apeiros: in `foo(&bar)`, the & invokes to_proc on bar, and then passes that Proc as a block
[11:32:34] burgestrand: fernando_basso_ ^
[11:32:37] caleBOT: has joined #ruby
[11:32:45] burgestrand: fernando_basso_ so to continue that, it does :buyable?.to_proc
[11:32:58] apeiros: and :some_symbol.to_proc creates a slightly more sophisticated proc than proc { |receiver| receiver.__send__(:some_symbol) }
[11:33:32] burgestrand: i.e. :buyable? is not a method, it's a symbol
[11:33:33] apeiros: hence `.select(&:buyable?)` becomes `select { |receiver| receiver.buyable? }`
[11:33:54] burgestrand: ACTION apeiros collaboration high five
[11:34:01] apeiros: yeah, not a method, "only" the name of the method
[11:34:02] apeiros: ^5 Burgestrand
[11:34:19] apeiros: ACTION forgot to /me, /me sad
[11:35:26] Bish: ACTION hates the fact there is no shortcut for .select {|x| x[:a]}
[11:36:16] apeiros: ACTION has a snippet for that
[11:36:22] Bish: snippet as in?
[11:36:30] Bish: overwriting to_proc of Array?
[11:36:31] apeiros: and else, baweaver has a lib
[11:36:49] Bish: apeiros: how does that look
[11:36:51] Bish: when used
[11:38:45] Fernando-Basso_: Burgestrand, apeiros, I think I got it, and notes taken. Thank you both. Much appreciated.
[11:39:01] burgestrand: fernando_basso_ https://repl.it/repls/JaggedAgedCamel
[11:39:28] Bish: overwriting to_proc of array actually works fine
[11:39:35] burgestrand: Yeah, I like it
[11:39:36] Bish: how much would the ruby community hate me for that?
[11:39:41] Bish: Burgestrand: you do that?
[11:40:02] apeiros: Bish: hm, can't find the snippet
[11:40:03] burgestrand: Bish no, I don't think I've needed that syntax often enough
[11:40:22] burgestrand: Bish for an app project I wouldn't blame you, but if you put it in a library that I use I will find you
[11:40:45] apeiros: Bish: but yes, iirc it was `.select(&[:a])`
[11:41:01] Bish: class Array;def to_proc;return proc {|x| x[first] };end;end;
[11:41:10] apeiros: and it used Array#to_proc being something along: `__send__(:[], *self)`
[11:41:38] Bish: but this should be a ruby feature
[11:41:49] apeiros: I had a couple more, like Integer#to_proc doing .send(:[], self)
[11:41:59] apeiros: so .select(&1) works
[11:42:02] Bish: i mean without polluting some namespace
[11:42:17] apeiros: "without polluting" - contradictory, sorry.
[11:42:28] Bish: ? apeiros how so?
[11:42:29] apeiros: every added feature will pollute in one way or another
[11:42:40] Bish: how does ** pollute anything
[11:43:01] Bish: i mean it should be syntax(without breaking old code)
[11:43:06] Fernando-Basso_: Burgestrand: I'm scratching my head :D
[11:43:07] apeiros: either you bloat syntax to mean different things in different contexts (worse), or you exploit methods to mean things suiting specific tasks (still bad, but IMO less bad than syntax abuse)
[11:43:16] Bish: like the lonely operator, that thing certainly didnt kill code
[11:43:39] apeiros: ** increases syntax space. there's now two meanings for **, method or kwarg-splat-operator
[11:43:41] Fernando-Basso_: Burgestrand: Ah, got it. Nice!
[11:43:46] burgestrand: fernando_basso_ :)
[11:43:48] Bish: i would even be fine with
[11:43:50] apeiros: it does not come for free.
[11:44:03] Bish: .map(&&:x) to get hash[:x]
[11:45:06] Bish: i will just define method ⇒ globally, that will make me popular among colleagues
[11:47:15] blackmesa1: has joined #ruby
[11:49:13] Bish: .map(>>x<<)
[11:51:16] Bish: apeiros: don't you like the lonely operator?
[11:51:23] Bish: it's a blessing to me
[11:51:34] conta: has joined #ruby
[11:52:08] Bish: apeiros: hm? the loney operator &.?
[11:52:25] apeiros: oh, safe-navigator
[11:52:27] Bish: added in 2.3, i think
[11:52:52] Bish: "matz called it lonely operator in a talk, because it looks like a kneeing man looking at a dot"
[11:53:10] Bish: these japenese
[11:53:30] Bish: rather a sitting man
[11:56:56] MagePsycho: has joined #ruby
[11:58:01] Cork: has joined #ruby
[12:01:25] banisterfiend: has joined #ruby
[12:02:58] burgestrand: Yeah, that has to be a butt
[12:03:31] burgestrand: Bish hadn't thought of that before, now I can't unsee it
[12:10:11] bak1an: has joined #ruby
[12:11:29] Bish: Burgestrand: i laughed so hard when realizing
[12:23:04] Zaab1t: has joined #ruby
[12:25:49] bjpenn: has joined #ruby
[12:34:23] blackmesa1: has joined #ruby
[12:35:16] AJA4350: has joined #ruby
[12:39:45] simmaniac: has joined #ruby
[12:46:11] graphene: has joined #ruby
[12:48:49] roamingdog: has joined #ruby
[12:53:14] BloopMonster: has joined #ruby
[12:54:02] Megamos: has joined #ruby
[12:54:26] vondruch: has joined #ruby
[12:57:22] Megamosaren: has joined #ruby
[12:59:23] jrafanie: has joined #ruby
[12:59:27] ellcs: has joined #ruby
[12:59:37] mupt: has joined #ruby
[13:07:56] bjpenn: has joined #ruby
[13:11:44] cadillac_: has joined #ruby
[13:13:17] herbmillerjr: has joined #ruby
[13:13:35] yokel: has joined #ruby
[13:14:02] MagePsycho: how to store value in key value pair in ruby and loop it later?
[13:14:15] za1b1tsu: has joined #ruby
[13:14:26] ellcs: hash = {}; hash[:a] =1
[13:14:37] ellcs: on the hash you can call any highorder method
[13:15:15] ellcs: :each, :reduce, :map
[13:15:33] ellcs: first argument of the highorder method is the key, the second the value
[13:17:42] elomatreb: Not exactly true, iterator blocks get yielded an array of two elements, it just gets destructured when you put two parameters on the block
[13:21:37] _rshetty_: has joined #ruby
[13:24:26] ellcs: aight, so in `{:a => 1}.each { |k, v| puts "#{k} #{v}"}` the two variables are actually elements of an array?
[13:24:36] saTchymoto: has joined #ruby
[13:24:38] ellcs: with two variables i do mean k and v
[13:24:55] NingaLeaf: has joined #ruby
[13:25:35] rshetty: has joined #ruby
[13:25:45] ellcs: so when using one variable i get the keyvalue pair as an array? `{:a => 1}.each { |kv| puts "#{kv}"}`
[13:26:48] rshetty: has joined #ruby
[13:27:06] ellcs: ran it in irb and it is a fact :)
[13:29:24] Mike11: has joined #ruby
[13:35:02] elomatreb: You can use this anywhere btw, e.g. `a, b = [1, 2]` assigns 1 to a and 2 to b
[13:43:19] bjpenn: has joined #ruby
[13:49:26] kryptoz: has joined #ruby
[13:50:32] caleBOT_: has joined #ruby
[13:52:42] kryptoz: has joined #ruby
[13:53:16] Megamos: has joined #ruby
[14:01:40] MagePsycho: how to check if path is a directory or file in ruby?
[14:02:34] tbuehlmann: there are Pathname.new('/path/to/file').file? and Pathname.new('/path/to/file').directory?
[14:03:08] canton7: also File.file? and File.directory?
[14:03:20] canton7: (e.g. File.file?('/some/file'))
[14:09:05] Zarthus: has joined #ruby
[14:09:40] taylorzr: has joined #ruby
[14:10:46] MagePsycho: test("[ -f #{shared_path}/pub/sitemap.xml ]") ?
[14:11:53] elomatreb: Alternatively there is File.ftype
[14:12:05] lupine: definitely use something that doesn't depend on interpolation
[14:13:17] Inline: has joined #ruby
[14:14:41] claudiuinberlin: has joined #ruby
[14:14:43] naftilos76_: has joined #ruby
[14:15:51] claudiuinberlin: has joined #ruby
[14:17:42] MagePsycho: I have a file.rake and how to test it quickly?
[14:18:37] Azure: has joined #ruby
[14:18:43] p0s1x: has joined #ruby
[14:18:54] bathtub_shark: has joined #ruby
[14:19:37] canton7: MagePsycho, using one of the suggestions which tbuehlmann and I gave you?
[14:19:50] canton7: oh, you mean run the rakefile using rake?
[14:20:44] bathtub_shark: has joined #ruby
[14:21:00] kryptoz: has joined #ruby
[14:21:54] Megamos: has joined #ruby
[14:22:16] claudiuinberlin: has joined #ruby
[14:22:51] MagePsycho: canton7, Yes I have file.rake where I have defined some task, how to run it just to test
[14:23:11] canton7: MagePsycho, there's a parameter you can pass to rake to get it to load a particular file
[14:23:24] claudiuinberlin: has joined #ruby
[14:25:07] mtkd: has joined #ruby
[14:26:13] za1b1tsu: has joined #ruby
[14:27:58] houhoulis: has joined #ruby
[14:28:03] MagePsycho: set :app_symlinks, ["/media", "/var", "/sitemaps"] -> how to set as key value pair
[14:28:40] MagePsycho: et :app_symlinks, ["/media": "/images", "/var": "/tmp", "/sitemaps": "/seo"]
[14:28:58] MagePsycho: I want that array [] to have key value pair
[14:29:30] canton7: MagePsycho, use a hash
[14:29:34] RougeT430: has joined #ruby
[14:29:59] MagePsycho: I have to use that approach as per capistrano
[14:33:52] kryptoz: has joined #ruby
[14:35:30] drale2k_: has joined #ruby
[14:35:44] conta: has joined #ruby
[14:37:11] orbyt_: has joined #ruby
[14:38:55] canton7: MagePsycho, so you want to use a hash but you're not allowed to use a hash?
[14:39:14] bjpenn: has joined #ruby
[14:41:57] subroot: has joined #ruby
[14:47:08] MagePsycho: set :mage2_custom_symlinks, {'pub/Tools' => '/var/www/Tools', 'pub/feed' => '/var/www/magento/feed', 'pub/maintenance' => '/var/www/magento/maintenance'}
[14:47:23] MagePsycho: not sure if this will work or not
[14:47:38] JJonah: The "or" method `:|` exists on TrueClass and FalseClass, but the short circuit `||` operator does not? Why this asymmetry? And is the `||` operator an exception to ruby's "everything is an object" metaphor? Is it instead just a baked in bit of global syntax? If not, what is it?
[14:47:49] eam: MagePsycho: { :key => [:array, :of, :values] ] perhaps?
[14:48:04] eam: if you're looking for your key to point to a list
[14:50:49] MagePsycho: {:key1 => :value1, :key2 => :value2}
[14:50:59] MagePsycho: do you have to add : in front?
[14:51:21] blackmesa1: has joined #ruby
[14:54:21] ciscam: has joined #ruby
[14:54:49] Es0teric: has joined #ruby
[14:55:41] kapil___: has joined #ruby
[14:57:46] eam: no, I just did that as an example
[14:57:59] eam: you can use any literal or variable
[15:00:32] ellcs: has joined #ruby
[15:02:18] suukim: has joined #ruby
[15:06:06] feelx: has joined #ruby
[15:06:58] amar: has joined #ruby
[15:08:45] blackmesa: has joined #ruby
[15:09:20] nowhereman_: has joined #ruby
[15:10:41] NingaLeaf: has joined #ruby
[15:10:59] karapetyan: has joined #ruby
[15:12:49] kujira: has joined #ruby
[15:17:51] cschneid: has joined #ruby
[15:23:56] edwardly: has joined #ruby
[15:23:57] edwardly: has joined #ruby
[15:32:09] troys: has joined #ruby
[15:32:27] alem0lars: has joined #ruby
[15:32:52] apeiros: has joined #ruby
[15:33:56] yohji: has joined #ruby
[15:37:42] bradleyprice: has joined #ruby
[15:41:23] mtkd: has joined #ruby
[15:42:11] rshetty: has joined #ruby
[15:42:57] Azure: has joined #ruby
[15:43:01] BloopMonster: has joined #ruby
[15:47:29] tff^: has joined #ruby
[15:51:50] jrich523_: has joined #ruby
[15:52:50] tolerablyjake: has joined #ruby
[15:53:00] poranek: has joined #ruby
[15:53:13] andikr: has joined #ruby
[15:55:59] ren0v0: has joined #ruby
[15:57:15] MagePsycho: https://paste.ubuntu.com/p/8Qc8wXdhMC/ -> undefined local variable or method `m2_custom_linked_dirs'
[15:59:24] mupt: has joined #ruby
[16:00:22] jcarl43: has joined #ruby
[16:01:15] canton7: MagePsycho, I'm not sure what the 'set' method does, but it doesn't define a new variable...
[16:11:25] jrich523_: has joined #ruby
[16:11:26] karapetyan: has joined #ruby
[16:11:54] noobineer: has joined #ruby
[16:14:46] mtkd: has joined #ruby
[16:19:09] graphene: has joined #ruby
[16:22:56] bsamorim: has joined #ruby
[16:24:51] taylorzr: has joined #ruby
[16:26:39] apeiros: has joined #ruby
[16:26:51] bsamorim: Hello! I'm using a lib that has a "foo(bar, &block)" method in one of its classes. If I subclass that class, and write as method to that subclass "def ext_foo(bar, &block);foo(bar, &block);end", it behaves perfectly
[16:27:34] bsamorim: But, if I do "def ext_foo(bar, &block);foo(bar) do block.call end;end", the scope in which "block" gets executed is completely messed up
[16:28:44] bsamorim: What's happening? How can I extend block and forward it too "foo" so that it behaves the same as if it was passed untouched?
[16:35:18] cthulchu: Actually, rubocop does good. adds some strictness to the language
[16:35:33] cthulchu: the language that prematurely lacks discipline
[16:35:48] cthulchu: Clean you room, Ruby!
[16:37:07] lxsameer: has joined #ruby
[16:37:16] elomatreb: bsamorim: The scope in which a block is executed is lexical to where the block is located, from where you do block.call does not change it
[16:38:02] elomatreb: You can change the receiver object (self) through things like instance_eval, but it's kind of a bad idea because it's not apparent at the call site
[16:41:44] herbmillerjr: has joined #ruby
[16:41:57] caleBOT: has joined #ruby
[16:42:49] bsamorim: elomatreb: if the place where I put in "block.call" is irrelevant, how is the behaviour from both definitions of "ext_foo" different?
[16:43:36] Kuukunen: has joined #ruby
[16:43:46] Megamos: has joined #ruby
[16:44:09] elomatreb: You're probably making some assumption about scope somewhere. If you could show actual code instead of a reduced example it's usually much easier to help
[16:44:10] amar: has joined #ruby
[16:45:30] bsamorim: that's pretty much it, as far as my extensions go
[16:45:38] bsamorim: Would the code for "foo" help?
[16:47:15] nowhereman_: has joined #ruby
[16:48:34] elomatreb: My gut feeling would be the code inside the actual block
[16:49:30] Kuukunen: has joined #ruby
[16:49:58] InfinityFye: has joined #ruby
[16:53:41] lxsameer: has joined #ruby
[16:53:56] apeiros: bsamorim: `foo(bar) do block.call end;end` does not pass on arguments yielded to the block as `foo(bar, &block)` does
[16:54:17] apeiros: but why do you change it from &block anyway?
[16:54:42] bsamorim: apeiros: I wanted to run some operations before the block is executed
[16:54:52] mupt: has joined #ruby
[16:55:16] bsamorim: I mean, the block isn't executed when "foo" is called - it is registered as a class method for one of the lib's classes
[16:55:45] bsamorim: I wanted that dynamically created method to include these operations that I want to perform
[16:56:08] apeiros: ok. so it's either the arguments thing, or we need a better description than "it is completely messed up".
[16:56:48] bsamorim: I'll look into it and get back to you.
[16:57:00] tolerablyjake: has joined #ruby
[16:57:09] bsamorim: It can't be the arguments thing, though, because that's not the issue with the block call
[16:58:00] bsamorim: Basically, the class has a method that's found normally when I do "foo(bar, &block)", but now when the block is passed the other way
[16:58:05] bsamorim: I get a "MethodNotFound" exception
[16:58:36] caleBOT: has joined #ruby
[16:58:43] apeiros: you'll have to provide an actual reproducible example.
[16:58:55] apeiros: with the parts you've given, it doesn't add up.
[16:59:35] elomatreb: Try inserting `p self` to see where your methods are going, if there's confusion about that
[17:00:23] bsamorim: apeiros: sure, no problem..do you guys have a pastebin for the channel?
[17:00:34] ruby[bot]: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[17:00:52] apeiros: I wish they dropped the login requirement again, though.
[17:01:10] drale2k_: has joined #ruby
[17:02:05] elomatreb: Oh you can't create anonymous gists anymore?
[17:02:53] apeiros: makes me want to remove the pastebin grumbler from ruboto.
[17:03:07] elomatreb: Might be worth considering to recommend another service in that case, requiring people to have a github account does seem inappropriate
[17:03:29] apeiros: I see that similarly. feel free to make a good suggestion.
[17:03:58] elomatreb: I would if I could :/
[17:04:07] quobo: has joined #ruby
[17:04:07] bsamorim: https://gist.github.com/bernardo-amorim/3cbcff63f1ca6fd97113873a29749117
[17:04:13] bsamorim: there it is
[17:04:22] bsamorim: It's a sinatra app, so I included the "config.ru" also
[17:04:36] bsamorim: but I think it's irrelevant for the discussion, though
[17:05:26] alem0lars: has joined #ruby
[17:05:30] bsamorim: The project, I think, is in a instance scope/class scope conflict
[17:05:51] apeiros: yeah, that block probably gets instance evaled
[17:05:55] elomatreb: And the request in print_request is what's being messed up?
[17:06:17] apeiros: so instead of block.call, you probably need instance_eval(&block) instead.
[17:06:21] bsamorim: elomatreb: I get a "undefined local variable or method `print_request' for FooController:Class" exception
[17:06:41] apeiros: that's the one thing I dislike about blocks. you can't tell from the outside in what context they'll be eval'ed
[17:06:48] Mike111: has joined #ruby
[17:07:02] elomatreb: In that case it gets class_evald apparently
[17:07:22] mtkd: has joined #ruby
[17:07:28] elomatreb: What happens if you change `def print_request` to `def self.print_request`?
[17:07:37] apeiros: ah, right. might be class_eval instead of instance_eval too.
[17:08:03] bsamorim: elomatreb: it'd work in that particular example, but I actually want to use instance variables in those helper functions :(
[17:08:27] elomatreb: This feels more like a strange behavior from Sinatra, I can't really help with that, sorry
[17:08:44] bsamorim: so, should I do "get(route) do instance_eval(&block) end" ?
[17:09:03] lxsameer: has joined #ruby
[17:12:31] bsamorim: yep, worked like a charm! thanks, man! I've never used instance_eval, though. How hacky is it?
[17:13:24] elomatreb: It changes the self in the block
[17:13:48] elomatreb: So all the methods you call end up being called on the object you want, instead of the the lexical default from the blocks location
[17:15:12] elomatreb: Which makes building things like DSLs convenient, but you also can't see that it's happening just from looking at the block itself, so it can be very confusing if you e.g. get NoMethodErrors for methods that you defined just above (similar to the confusion you got)
[17:15:39] claudiuinberlin: has joined #ruby
[17:15:51] bsamorim: elomatreb: ok, thanks a lot for the explanation!
[17:17:56] mynameisdebian: has joined #ruby
[17:20:16] rshetty: has joined #ruby
[17:26:32] ellcs: has joined #ruby
[17:30:15] tolerablyjake: has joined #ruby
[17:31:03] bsamorim: Man, Ruby certainly has its share of magic
[17:31:26] bsamorim: It's just one surprise after the other
[17:32:07] mupt: has joined #ruby
[17:34:51] blackmesa: has joined #ruby
[17:38:32] mynameisdebian: has joined #ruby
[17:40:35] MagePsycho_: has joined #ruby
[17:44:30] lxsameer: has joined #ruby
[17:55:20] mynameis_: has joined #ruby
[17:59:30] StarSeed0000: has joined #ruby
[18:01:07] Dimik: has joined #ruby
[18:07:46] herbmillerjr: has joined #ruby
[18:11:04] Hanmac: has joined #ruby
[18:11:19] BTRE: has joined #ruby
[18:12:49] karapetyan: has joined #ruby
[18:15:53] claudiuinberlin: has joined #ruby
[18:22:09] caleBOT: has joined #ruby
[18:24:20] bairyn: has joined #ruby
[18:24:52] taylorzr: has joined #ruby
[18:29:12] regedit: has joined #ruby
[18:40:16] jamesaxl: has joined #ruby
[18:43:28] mmattice: has joined #ruby
[18:51:16] Fr4n: has joined #ruby
[18:57:34] lxsameer: has joined #ruby
[18:58:17] paul91: has joined #ruby
[19:02:13] Puffball: has joined #ruby
[19:02:17] mupt: has joined #ruby
[19:03:33] \void: has joined #ruby
[19:05:27] ellcs: has joined #ruby
[19:07:17] caleBOT_: has joined #ruby
[19:07:33] lxsameer: has joined #ruby
[19:07:38] amar: has joined #ruby
[19:09:44] mtkd: has joined #ruby
[19:17:29] alex``: has joined #ruby
[19:17:44] taylorzr: has joined #ruby
[19:19:33] claudiuinberlin: has joined #ruby
[19:21:01] noobineer: has joined #ruby
[19:28:46] caleBOT: has joined #ruby
[19:29:28] zachk: has joined #ruby
[19:29:29] zachk: has joined #ruby
[19:32:09] Megamos: has joined #ruby
[19:37:39] dkmueller: has joined #ruby
[19:48:21] blackmesa: has joined #ruby
[20:02:10] willthechill: has joined #ruby
[20:03:35] paul91: has left #ruby: ()
[20:05:16] willthechill: hello all, I am trying to debug somebody else's Ruby code, we have a subroutine named `execmd()` which is called by `safesystemin()` and friends in order to execute some system commands, unfortunately one of the system commands is hanging and I can not figure out how to un-hide the STDOUT & STDERR in execmd() so as to see what is actually happening and where the hang occurs
[20:06:15] caleBOT_: has joined #ruby
[20:06:49] ellcs: has joined #ruby
[20:06:55] willthechill: the main software in question is the `fpm` tool used to create RPM and DEB files, I have made my own fork, here is the execmd() subroutine: https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L103
[20:07:34] willthechill: here is where execmd() is called from safesystemin(): https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L246
[20:08:10] willthechill: and here is the line where it is actually hanging, and I never see any of the STDOUT or STDERR: https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L252
[20:08:22] MagePsycho_: how to strip last directory from path in ruby?
[20:09:20] willthechill: I tried to use a pipe with tee as well as I/O redirection, they both executed but neither one actually created an output file! :-( https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L244-L245
[20:09:50] willthechill: I just need to see what is actually happening with the running system commands, thanks so much for any help!!!
[20:11:53] MagePsycho_: ‘/var/www/app/abc’ -> how to strip /abc and return ‘/var/www/app’ ??
[20:14:20] karapetyan: has joined #ruby
[20:14:48] zenspider: MagePsycho: look at the File class
[20:19:48] willthechill: okay partial success via random hacking... if I replace this line "if block_given?" with "if false" then it shows me output! https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L165
[20:21:13] willthechill: watching output fly by now, waiting to see if it hangs, OR maybe the hanging was somehow a result of the way it was handling I/O
[20:22:35] willthechill: and it does NOT hang now!
[20:23:13] willthechill: so somehow the execmd() I/O handling is responsible for the system commands hanging, bizarre!
[20:24:03] zenspider: "hanging" might just be buffering
[20:24:12] cagomez: has joined #ruby
[20:24:37] willthechill: zenspider: I thought the same thing, but it shouldn't buffer on one system command for 12+ minutes when that system command should take only a few seconds to run
[20:24:49] willthechill: thus, I must classify it as hanging or frozen
[20:25:02] Zaab1t: has joined #ruby
[20:25:15] willthechill: although YES, I suspect attempted buffering or some other I/O magic is the culprit
[20:25:44] zenspider: does the cmd normally run and exit in under a few seconds? Even if it isn't attached to a TTY? some programs act differently depending on whether they detect they're interactive or not
[20:25:49] zenspider: act -> behave
[20:26:06] willthechill: yes it is actually a call to gcc which is hanging
[20:26:30] zenspider: gcc will totally hang out and do "nothing" if it thinks it is being piped its IO.
[20:26:37] willthechill: more details here: https://github.com/jordansissel/fpm/issues/1519
[20:26:50] graphene: has joined #ruby
[20:27:11] willthechill: well this is an automated build tool which calls gcc all day long as part of numerous build & configuration processes, so it should definitely NOT be hanging like this
[20:27:18] daemonwrangler: has joined #ruby
[20:27:23] zenspider: that "interactive" part in the title seems like a hint?
[20:27:37] daemonwrangler: has joined #ruby
[20:27:42] willthechill: I'm the one who wrote that title, and the "interactive" part has already been solved
[20:28:01] willthechill: scroll to the bottom of the github issue to see the gcc/as command which is hanging
[20:28:15] willthechill: gcc & ac are definitely NOT interactive
[20:28:29] hph^: has joined #ruby
[20:28:44] willthechill: as proven by the fact that they run just fine when I disable the I/O handling in execmd()
[20:28:45] MagePsycho_: Pathname worked like a charm
[20:28:59] MagePsycho_: anyone using capistrano for deployment here?
[20:29:32] zenspider: MagePsycho: Pathname is overkill for what you were asking. Like I said above... look at File
[20:30:28] zenspider: willthechill: yeah. that cmd looks kosher to me. Once I reformatted it to multiline...
[20:31:06] willthechill: well the strange thing is it all works fine as soon as I disable the I/O handling
[20:31:34] zenspider: willthechill: yeah. that would be my suggestion is to exec w/ < /dev/null
[20:31:34] Mike11: has joined #ruby
[20:31:56] Megamos: has joined #ruby
[20:32:32] willthechill: zenspider: you mean I should append "< /dev/null" to the end of each system command (gcc, as, etc) to be executed by execmd()?
[20:33:06] zenspider: oh. I wonder if ... how crazy has cpp/m4 gotten? maybe it is doing something w/ subprocesses... I'm blindly guessing tho.
[20:33:43] zenspider: I don't know execmd, so I don't know what is appropriate for you. But it sounds like you already did it with "disable the I/O handling"
[20:35:32] willthechill: well I was just blindly hacking, I replaced "if block_given?" with "if false" and it disabled I/O stuff, now it shows me all output and does NOT hang on gcc/as https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L165
[20:36:03] willthechill: AFAICT, execmd() was written from scratch as part of the fpm tool
[20:37:05] zenspider: it's probably just a stupid wrapper for exec or spawn... *shrug*
[20:37:29] daemonwrangler: has joined #ruby
[20:37:34] zenspider: spawn is crazy powerful (too much, imo)... you should be able to do all the redirection stuff you want
[20:40:00] willthechill: well there appears to be a class (?) called ChildProcess, an object of which is created named "process" and then "process.start" is called
[20:40:12] willthechill: https://github.com/wbraswell/fpm/blob/master/lib/fpm/util.rb#L151-L161
[20:41:56] sameerynho: has joined #ruby
[20:45:47] StarSeed0000: has joined #ruby
[20:47:38] nowhereman_: has joined #ruby
[20:47:57] shinnya: has joined #ruby
[20:48:44] zenspider: willthechill: https://github.com/wbraswell/fpm/blob/master/fpm.gemspec#L45
[20:48:56] zenspider: seems like overkill to me... but whatevs
[20:50:15] willthechill: ah okay I see, so there is an external library named "childprocess", well I am not the maintainer of fpm so I will not try to change things like that on my own :-P
[20:51:16] amar: has joined #ruby
[20:54:21] zautomata: has joined #ruby
[20:54:31] bsamorim: has joined #ruby
[20:55:48] mattp__: has joined #ruby
[21:05:39] mupt: has joined #ruby
[21:06:39] Megamos: has joined #ruby
[21:11:29] willthechill: new, second bug report: https://github.com/jordansissel/fpm/issues/1522
[21:14:08] zleap: has joined #ruby
[21:18:09] stairmast0r: has joined #ruby
[21:19:39] daemonwrangler: has joined #ruby
[21:24:47] mynameisdebian: has joined #ruby
[21:29:21] Megamos: has joined #ruby
[21:32:34] jottr: has joined #ruby
[21:33:05] agent_white: has joined #ruby
[21:35:53] zlogan2003: has joined #ruby
[21:43:47] graphene: has joined #ruby
[21:48:30] DTZUZO: has joined #ruby
[21:56:13] dgaff: has joined #ruby
[21:57:50] nowhere_man: has joined #ruby
[21:58:09] jrafanie: has joined #ruby
[22:06:50] FernandoBasso: has joined #ruby
[22:09:09] mupt: has joined #ruby
[22:12:49] cyberg: has joined #ruby
[22:15:49] karapetyan: has joined #ruby
[22:16:52] graphene: has joined #ruby
[22:19:11] blackmesa: has joined #ruby
[22:21:41] InfinityFye: has left #ruby: ("Leaving")
[22:22:23] houhoulis: has joined #ruby
[22:22:37] zapata: has joined #ruby
[22:30:40] r29v: has joined #ruby
[22:32:29] RealUnix28200: has joined #ruby
[22:34:38] FernandoBasso: has joined #ruby
[22:34:39] pauliesaint: has joined #ruby
[22:37:32] ellcs: has joined #ruby
[22:49:30] tty: has joined #ruby
[22:50:36] akaiiro: has joined #ruby
[23:07:28] taylorzr: has joined #ruby
[23:08:40] blackmesa: has joined #ruby
[23:11:14] bak1an: has joined #ruby
[23:11:40] ellcs: has joined #ruby
[23:13:02] bsamorim: has joined #ruby
[23:14:48] taylorzr: has joined #ruby
[23:19:05] Sembei: has joined #ruby
[23:22:37] caleBOT: has joined #ruby
[23:22:49] d^sh: has joined #ruby
[23:23:59] francisco: has joined #ruby
[23:24:45] Jushy: has joined #ruby
[23:26:58] jottr: has joined #ruby
[23:30:16] lunarkitty7: has joined #ruby
[23:31:45] jinie: has joined #ruby
[23:34:52] bonhoeffer: has joined #ruby
[23:35:16] bonhoeffer: how do i convert "ab".bytesize to something like "\xD5\x88" which i see as the ruby byte notation
[23:35:19] nightw0lf: has joined #ruby
[23:45:28] kobain: has joined #ruby
[23:47:12] hfp_work: has joined #ruby
[23:49:57] bairyn: has joined #ruby