« Back to channel list

#ruby - 15 May 2016

« Back 1 day Forward 1 day »
[00:01:24] grs: has joined #ruby
[00:02:21] tgeeky: has joined #ruby
[00:02:38] tgeeky: can someone with a bit of experience help me understand where "LoadError" is defined
[00:02:53] tgeeky: I am getting "LoadError: 193: %1 is not a valid Win32 application" (from tiny_tds)
[00:03:01] tgeeky: but the problem is, it is a valid Win32 application.
[00:03:14] tgeeky: The .so file is where it should be, and it's fine, and it runs fine normally but it's screwing up when I start with rake
[00:03:57] tgeeky: I know this is a 64-bit versus 32-bit problem
[00:04:36] leitz: has joined #ruby
[00:05:54] mbreedlove: has joined #ruby
[00:06:17] shevy: sounds like a custom error
[00:06:49] shevy: normal LoadErrors tend to look like this: "LoadError: cannot load such file -- foo"
[00:07:30] mosh: has joined #ruby
[00:07:30] mosh: has joined #ruby
[00:07:38] tgeeky: it's like something is a 32-bit application calling a 64-bit one
[00:07:42] tgeeky: but i can't see any of that
[00:07:45] tgeeky: shevy: yes, I agree
[00:07:55] tgeeky: is there any more output I can get other than trace?
[00:08:16] cdg: has joined #ruby
[00:09:27] ellisTAA: has joined #ruby
[00:10:44] kareeoleez: has joined #ruby
[00:13:09] Kus: has joined #ruby
[00:15:09] mbreedlove: has joined #ruby
[00:15:27] nando294021: has joined #ruby
[00:16:19] kareeole_: has joined #ruby
[00:17:20] nankyokusei: has joined #ruby
[00:18:59] kareeole_: has joined #ruby
[00:20:31] claw: http://paste.debian.net/683952/ how would i do this so can use a block on it ?
[00:20:42] claw: i am currently confused about the &block and yield things
[00:21:25] claw: i wnant to be able to do: Foo.open("/tmp/bar", "w") { |f| f.write "HELLO" }
[00:21:25] kareeoleez: has joined #ruby
[00:22:29] mherold: You want `f` to be the Foo or the File in that block?
[00:22:55] claw: i want it to be the File
[00:25:46] mherold: Try this: http://paste.debian.net/683953/
[00:26:18] diego1: has joined #ruby
[00:26:32] ur5us: has joined #ruby
[00:26:32] mherold: You don't need the temporary variable if you don't want to have one
[00:26:43] diego1: has joined #ruby
[00:27:02] pawnbox: has joined #ruby
[00:27:20] bruno-: has joined #ruby
[00:28:43] moeabdol: has joined #ruby
[00:28:53] diego1: has joined #ruby
[00:29:05] diego1: has joined #ruby
[00:29:42] claw: mherold: that works thank you
[00:30:16] mherold: You're welcome
[00:30:21] claw: actually i already got it right but my testing was wrong -.-
[00:32:34] Avinty-L: has joined #ruby
[00:34:54] Avinty-L_: has joined #ruby
[00:41:33] Devalo: has joined #ruby
[00:42:52] dstarh: has joined #ruby
[00:56:45] jancel: has joined #ruby
[00:58:05] halfamind: has joined #ruby
[00:58:20] halfamind: has joined #ruby
[00:58:34] ur5us: has joined #ruby
[00:59:52] Nanuq: has joined #ruby
[00:59:57] yfeldblum: has joined #ruby
[01:03:56] stardiviner: has joined #ruby
[01:06:10] ellisTAA: has joined #ruby
[01:06:29] CloCkWeRX1: has joined #ruby
[01:13:20] ur5us: has joined #ruby
[01:13:56] startupality: has joined #ruby
[01:14:40] Yzguy: has joined #ruby
[01:15:39] Nawn: has joined #ruby
[01:20:49] banister: has joined #ruby
[01:21:29] Nawn: has joined #ruby
[01:22:54] zacts: yo rubyists
[01:24:05] pawnbox: has joined #ruby
[01:24:34] karmatr0n: has joined #ruby
[01:25:33] bronson: has joined #ruby
[01:25:52] liulantao: has joined #ruby
[01:30:20] noobsu: has joined #ruby
[01:31:33] Nawn: has joined #ruby
[01:32:16] AnoHito_: has joined #ruby
[01:32:17] neanderslob: has joined #ruby
[01:32:45] sdothum: has joined #ruby
[01:33:11] Feyn: has joined #ruby
[01:35:53] djbkd: has joined #ruby
[01:36:02] statelesscode_: has joined #ruby
[01:36:41] surrounder: has joined #ruby
[01:36:51] Miron: has joined #ruby
[01:36:52] ellisTAA: has joined #ruby
[01:37:17] am55: has joined #ruby
[01:37:25] jaguarmagenta: has joined #ruby
[01:37:59] cybrside: has joined #ruby
[01:38:06] nullFxn: has joined #ruby
[01:38:20] eljimmy: has joined #ruby
[01:38:48] devyn: has joined #ruby
[01:38:53] devyn: has joined #ruby
[01:39:19] jtdowney: has joined #ruby
[01:39:19] jtdowney: has joined #ruby
[01:40:03] ellisTAA: what is the best way to make an HTTP get request? is there a gem everyone uses or something in standard library?
[01:40:25] Radar: ellistaa: I like HTTParty
[01:40:46] ellisTAA: Radar: i remember using that & i liked it. do you think its secure enough for me to use @ work?
[01:40:51] ellisTAA: like would most corporations OK it
[01:41:13] oetjenj: has joined #ruby
[01:41:15] Radar: I don't understand the question.
[01:41:54] ellisTAA: Radar: some companies dont let devs use any gem they want, do you think HTTParty is secure / credible enough that most corporations would be like ‘ok use that'
[01:42:02] hiddenloop: has joined #ruby
[01:42:07] Radar: Depends on the corporation
[01:42:30] ellisTAA: Radar: lets say google
[01:42:37] austinprog: has joined #ruby
[01:42:40] houhoulis: has joined #ruby
[01:42:43] Radar: You're asking me
[01:42:44] xMopxShell: has joined #ruby
[01:42:46] speakingcode: has joined #ruby
[01:42:49] Radar: What a corporation's opinion is
[01:42:50] Radar: about a gem
[01:43:01] Radar: Does this not seem ridiculous to you too?
[01:43:07] ellisTAA: no not at all
[01:43:10] Radar: Why do you think I can speak on behalf of a corporation?
[01:43:16] Radar: That I don't even work for!
[01:43:21] ruby[bot]: Why don't you try it and see for yourself?
[01:43:45] ellisTAA: do u not have the ability to discern weather a gem is relatively credible or absolutely not, why is this such a difficult question for u
[01:44:00] Radar: Are you asking yourself that?
[01:44:02] Radar: https://rubygems.org/gems/httparty
[01:44:05] Radar: 19 million downloads
[01:44:09] Radar: Is that not credible enough?
[01:44:26] ellisTAA: if its so obvious why did u make it so difficult
[01:44:31] Radar: It's a popular HTTP gem. If it wasn't secure / good, why would it have so many downloads?
[01:44:40] Radar: Because I expect people to do their due diligence before coming here.
[01:44:51] ellisTAA: thats my thought, just getting a second opinion perhaps there’s something im not aware of
[01:45:44] LoneHermit: has joined #ruby
[01:46:32] ekinmur: has joined #ruby
[01:46:34] twintail: has joined #ruby
[01:46:48] ellisTAA: has left #ruby: ()
[01:47:04] grs: has joined #ruby
[01:52:42] rubyrubyruby: 19 million downloaders can't be wrong
[01:53:23] janebootydoe: has joined #ruby
[01:54:19] dikaio: has joined #ruby
[01:55:57] LaT0rtue: has joined #ruby
[01:56:00] ReK2: has joined #ruby
[01:56:00] ReK2: has joined #ruby
[01:58:16] LaT0rtue: has joined #ruby
[02:03:50] wldcordeiro: has joined #ruby
[02:05:10] halfamind: has joined #ruby
[02:06:27] Nawn: has left #ruby: ("ERC (IRC client for Emacs 24.5.1)")
[02:07:44] akiTendo: has joined #ruby
[02:08:09] arescorpio: has joined #ruby
[02:11:18] domgetter: has joined #ruby
[02:11:42] brianpWins_: has joined #ruby
[02:11:45] domgetter: Is there a way to have a ruby script run in the background from within the script?
[02:12:02] bougyman: define 'background'
[02:12:16] xall: has joined #ruby
[02:12:32] domgetter: bougyman: so as to keep running but release control back to the shell.
[02:12:59] domgetter: that is, do the same thing as calling it with a trailing &, but I don't want the whole thing to run in the background from the get go
[02:13:04] bougyman: there are solid mechanisms to do that without going into some spooky daemon or background space.
[02:13:06] domgetter: just from a certain point on
[02:13:26] bougyman: I use runit, personally.
[02:13:38] chip_: has joined #ruby
[02:13:42] bougyman: it sounds like what you want is a special case, though.
[02:14:25] bougyman: see the daemons gem
[02:15:54] moeabdol: has joined #ruby
[02:16:51] domgetter: bougyman: To add more info, what I want is to know that a ruby script has gotten to a certain state (ready to accept client connections) before I start trying to connect to it
[02:17:21] bougyman: ok that does sound like something runit could do.
[02:20:17] betafive: has joined #ruby
[02:24:39] coffeecupp: has joined #ruby
[02:28:56] matp: has joined #ruby
[02:30:24] postmodern: with the ffi gem, how do you define enum types where in the C equivalent you have "FOO = 1, ..., BAR = FOO"?
[02:36:07] halfamind: has joined #ruby
[02:39:48] postmodern: er nevermind
[02:39:50] rocfig: has joined #ruby
[02:44:16] Devalo: has joined #ruby
[02:52:17] liulantao: has joined #ruby
[02:52:42] bruno-: has joined #ruby
[02:54:00] Madplatypus: has joined #ruby
[02:55:03] skolman_: has joined #ruby
[03:01:16] halfamind: has joined #ruby
[03:03:13] stardiviner: has joined #ruby
[03:03:26] aharlan: has joined #ruby
[03:04:50] karmatr0n: has joined #ruby
[03:08:35] cdg: has joined #ruby
[03:09:39] mr_robot_: has joined #ruby
[03:12:53] halfamind: has joined #ruby
[03:14:15] moeabdol: has joined #ruby
[03:15:01] houhoulis: has joined #ruby
[03:16:00] braincrash: has joined #ruby
[03:17:17] Yiota: has joined #ruby
[03:17:38] pawnbox: has joined #ruby
[03:17:50] gix: has joined #ruby
[03:18:25] sp4rrow: has joined #ruby
[03:20:07] elifoster: has joined #ruby
[03:20:29] zast: has joined #ruby
[03:21:47] oetjenj: has joined #ruby
[03:23:01] m_antis: has joined #ruby
[03:24:00] arescorpio: has joined #ruby
[03:27:24] bronson: has joined #ruby
[03:28:27] pawnbox: has joined #ruby
[03:31:40] SilverKey: has joined #ruby
[03:32:03] alex88: has joined #ruby
[03:32:42] alex88: hi there, I'm trying to parse this csv https://gist.github.com/alex88/0f0693e217dd8dba24be9b3dd0db4010 but I get the error you can find in the gist, however I don't see anything special on that line
[03:32:46] sneakerhax: has joined #ruby
[03:33:51] alex88: I know it's a weird csv, but this is what the customer can do... :(
[03:35:28] LoneHerm_: has joined #ruby
[03:35:32] m_antis: has joined #ruby
[03:36:47] m_antis: has joined #ruby
[03:37:14] Nice_BikeMaN: has joined #ruby
[03:39:02] Xaitec: has joined #ruby
[03:39:04] rorra_: has joined #ruby
[03:39:57] monoprotic: alex88 it seems to work for me
[03:40:18] idefine: has joined #ruby
[03:40:43] alex88: monoprotic: damn... let me see if I can make a reproducible link on repl.it
[03:42:09] alex88: copy pasted the file content and it works, but reading from file doesn't..
[03:43:23] alex88: File.read with the same filename i use for CSV parse shows the file
[03:43:31] moeabdol: has joined #ruby
[03:43:34] alex88: maybe there are some special characters or s*** like that
[03:46:10] halfamind: has joined #ruby
[03:46:21] alex88: yeah a lot, and this is an output from a "tech guy for that company", he might never have seen a csv
[03:46:41] alex88: one empty line after each data line...
[03:47:04] zzak: has joined #ruby
[03:47:58] alex88: well even gist complains about stuff on the csv file
[03:48:12] monoprotic: yeah i tried to figure that out
[03:48:50] rbennacer: has joined #ruby
[03:48:53] monoprotic: might be a weird quote character
[03:49:18] monoprotic: two diffrent quote characters which were both coerced into " on the website
[03:50:08] alex88: in atom if I type " in the search field it correctly highlights the quotes in the file, so they should be fine
[03:51:08] alex88: is there a way to see all the other chars? like \r \n etc?
[03:52:15] alex88: so, by default it gives error on line 3, if I remove the first line it says error is on 4th line :S
[03:52:31] alex88: if I remove 2 lines, error on line 6
[03:55:36] alex88: here we go
[03:56:01] alex88: added this https://gist.github.com/alex88/0f0693e217dd8dba24be9b3dd0db4010#file-ruby-rb-L21 and it works
[03:56:13] alex88: so maybe there were some dirty stuff on the file
[03:57:26] johnny56: has joined #ruby
[03:58:14] monoprotic: i dont see any weird line endings in the raw file i downloaded
[03:58:43] hk238: has joined #ruby
[03:58:54] alex88: monoprotic: how do you check that?
[03:59:01] alex88: so I can test the same on my input file
[03:59:18] monoprotic: many text editors let you see line endings
[03:59:25] monoprotic: i was looking at a hexdump
[03:59:32] alex88: oh way better
[03:59:44] monoprotic: not sure if uploading to gist does anything to the file, though
[04:00:13] alex88: monoprotic: oh no, the file was copy pasted, since the original file is much larger
[04:00:20] alex88: maybe copy-paste does something
[04:00:42] skolman_: has joined #ruby
[04:00:45] monoprotic: how much larger? too large to upload?
[04:01:16] alex88: oh nope, but I thought it was something different so I just copied the last 10 lines instead of the 11k lines
[04:01:42] alex88: also because csv said error was on line 3
[04:05:38] alex88: monoprotic: anyway, thanks a lot for helping
[04:06:18] jaguarmagenta: has joined #ruby
[04:10:33] jancel: has joined #ruby
[04:11:42] bruno-: has joined #ruby
[04:11:49] SyncYourDogmas: has joined #ruby
[04:16:51] djbkd: has joined #ruby
[04:17:42] DanyC: has joined #ruby
[04:20:21] ffs: has joined #ruby
[04:22:21] ffs: what's a good source for learning ruby if i'm already very comfortable with other related languages like python, c, and lisp? i'm terrible at learning from docs/manpages
[04:23:13] halfamind: has joined #ruby
[04:24:43] ffs: "There are some enforced case-conventions (ex. class names start with a capital letter, variables start with a lowercase letter)." does this mean classes are not first-class objects?
[04:25:06] nofxx: ffs, it is from start, but for you it'll be 15 min: "learn to program by chris pine"
[04:25:46] nofxx: ffs, oh boy, no idea how they ARE =D hehe
[04:26:13] nofxx: python OO isn't truly OO. You see what I mean.
[04:26:43] nofxx: ffs, actually, Constants need capital, and classes are constants
[04:27:14] nofxx: but usually you'll see constants in upcase
[04:27:21] ffs: but can you then assign a variable to that class?
[04:27:45] nofxx: yup, instance and class variables
[04:27:47] ffs: or the other way around, whatever the correct order of words is
[04:30:33] ffs: so in python, the underlying philosophy is that everything is really just a dict and most of the "design decisions" are really just consequences of that. is there a similar philosophy in ruby?
[04:31:27] agent_white: has joined #ruby
[04:33:13] nofxx: ffs, only philosophy is have fun... and make things readable
[04:34:15] nofxx: ruby ppl hate when you need to comment stuff, it should be *english* readable ;)
[04:35:21] nofxx: ffs, next unless array.include? 3 what's comment for that? "Go to next unless array include 3"? =D
[04:35:24] rubyrubyruby: ffs: in ruby everything is chunky bacon
[04:35:47] ffs: if what you're doing doesn't require comments you aren't working on anything interesting
[04:35:53] dikaio: has joined #ruby
[04:36:14] nofxx: you missed the point
[04:36:28] m_antis: has joined #ruby
[04:36:54] nofxx: and yes, a 50 lines mathematical equation for rocket fuel analysis won't be much readable... even in english
[04:39:00] nofxx: ffs, but as a tip from python: everything is object here... so expect foo to respond methods
[04:39:18] nofxx: ffs, eg: count a string: python count(str) ruby: str.count
[04:39:26] nofxx: don't remember the python command tho*
[04:39:35] ffs: python has str.count
[04:39:51] nofxx: in 3? didn't have when I coded, can swear
[04:40:13] nofxx: but anyways, you got it
[04:40:14] ffs: 2.7 >>> "abbbc".count("b")
[04:40:24] RegulationD: has joined #ruby
[04:40:25] ffs: outputs 3
[04:40:41] nofxx: damn... can swear I lost some time with this char counting... hence why I remember heh
[04:40:55] ffs: i think it had count since at least 2.5
[04:40:55] nofxx: but there's a functional counterpart as I said: count(str) right?
[04:41:00] ffs: there's len()
[04:41:05] ffs: i don't think there's count
[04:41:05] nofxx: yup, that one
[04:41:19] ffs: but there's technically str.__len__(), too
[04:41:34] janebootydoe2: has joined #ruby
[04:42:03] ffs: len(x) <-> x.__len__()
[04:42:29] nofxx: yeah.. in ruby there's #count and #size
[04:45:26] crystal77: has joined #ruby
[04:45:50] Devalo: has joined #ruby
[04:46:05] alex88: monoprotic: anyway, problem is back, actually I've seen that just opening/saving file with atom changes it and makes it readable by csv
[04:47:33] alex88: yeah, well, I don't care, I'll ask them to get some better made csv
[04:47:57] nofxx: alex88, I think I know, csv utf8 issues... wait a sec!
[04:48:02] nofxx: is it utf8?
[04:48:17] alex88: nofxx: file -I shows charset=us-ascii
[04:48:31] alex88: not 100% sure how to check
[04:48:51] nofxx: well, worth a try... trying to find here the code... just a sec
[04:49:28] alex88: nofxx: error was "CSV - Unquoted fields do not allow \r or \n" and after a chomp seems it's fixed but now error was back...
[04:49:31] alex88: sure thank you!
[04:49:58] nofxx: alex88, now I don't remember what the issue was, but this been working since.. with some ill formatted csvs:
[04:50:03] nofxx: CSV.parse(File.open(file, 'rb:UTF-16:UTF-8'), { col_sep: "\t" })
[04:50:24] alex88: nofxx: oh I've also read to use rb when opening file
[04:50:52] nofxx: yeah, and maybe change the encodings... iirc its rb:FROM:TO
[04:51:21] alex88: nofxx: here I have to do https://gist.github.com/alex88/00f8e54e0d45f98fc5bba0eb6c6513c3 to clear lines and remove metacharacters that were creating that issue
[04:51:29] alex88: anyway let me try that :D
[04:51:48] nofxx: cool.. going to eat, let me know later =D
[04:51:58] alex88: sure, enjoy :)
[04:52:08] Nawn: has joined #ruby
[04:52:12] blackgoat: has joined #ruby
[04:52:32] mr_robot_: has joined #ruby
[04:54:04] `tim`: has joined #ruby
[04:54:16] alex88: nofxx: nothing, same error, I've still to rely on .chomp on every line :D
[04:54:40] alex88: the funny part was that csv was saying error on line 3, then I removed line 1 and it said error on line 4 :D
[04:57:25] kareeoleez: has joined #ruby
[05:00:04] mynameisbrian: has joined #ruby
[05:00:21] bazzy: I want to programatically add to a class definition from an instance of a closely related class
[05:00:46] tax: has joined #ruby
[05:00:49] bazzy: I want to be able to use its instance variables in the addition to the class definition
[05:01:12] bazzy: or local variable
[05:01:51] bazzy: I tried using class_eval, but the local variable's meaning immediately disappears in the block
[05:01:53] ffs: has left #ruby: ("Leaving")
[05:03:33] bazzy: I fixed it .. it was a name clash .. (the class had a method or variable/accessor/etc of the same name)
[05:04:29] mynameisbrian: https://gist.github.com/brianbower/04001c8573da358ada1f70a1dde87e84 why would we call it: greet['hello'] and not: greet.['hello'] ?
[05:04:41] mynameisbrian: since [] is basically the method name
[05:05:07] mynameisbrian: also, do people actually use this?
[05:05:31] mynameisbrian: I'm just learning about it since I'm reading about Hash[1,2,3,4]
[05:05:53] mynameisbrian: wait, I mean... greet.[]('hello')
[05:06:50] mynameisbrian: well, we can call it that way. But I don't know why greet['hello'] works in this case.
[05:08:40] bazzy: mynameisbrian, because that is an operator overloader (I assume)
[05:09:13] karmatr0n: has joined #ruby
[05:09:16] mynameisbrian: yeah I figured its something like that
[05:09:40] mynameisbrian: at first I thought greet.[]('hello') wasn't working so I was confused
[05:09:49] mr_robot_: has joined #ruby
[05:09:52] bazzy: you are just customizing what the [] operator does.. but it's always after the name .. like with arrays
[05:10:07] bazzy: or string elements ...
[05:10:16] mynameisbrian: I think I did: greet.['hello'] instead of greet.[]('hello') so it just made me confused about the entire thing.
[05:10:18] dikaio: has joined #ruby
[05:10:39] mynameisbrian: yeah that's what I was thinking
[05:11:37] mynameisbrian: Do you see people using it? I think it could be useful as some default way like Hash and Array work
[05:12:07] bazzy: I'm a ruby n00b, this is my first time even acknowleding that ruby has operator overloading .. Look what i found, all the operators apparently that ruby can overload: http://stackoverflow.com/questions/3331962/list-of-ruby-operators-that-can-be-overridden-implemented
[05:12:08] bruno-: has joined #ruby
[05:12:46] mynameisbrian: I forgot what the term was so I couldn't look it up
[05:13:08] nanoz: has joined #ruby
[05:13:09] nanoz: has joined #ruby
[05:13:41] mynameisbrian: I"m having a lot of fun learning ruby
[05:13:49] mynameisbrian: haven't learned a language in awhile
[05:15:25] mynameisbrian: well actually I think "operator overload" doesn't work in this case, since [] is a method name and not being used as an operator
[05:16:03] mynameisbrian: but since [] commonly follows without the dot operator it looks like they just made it work that way
[05:16:44] mynameisbrian: just like 1 + 1 works and we don't have to do 1.+(1) every time
[05:17:13] dionysus69: has joined #ruby
[05:17:28] idefine: has joined #ruby
[05:18:06] alex88: mmhh https://repl.it/CQvu what's wrong here? date seems correct to me
[05:18:24] alex88: format shouldn't be the same as strftime?
[05:19:35] lxsameer: has joined #ruby
[05:19:50] monoprotic: are those dashes valid?
[05:22:09] dionysus69: any ideas why I might be getting this error when launching middleman? https://gist.github.com/anonymous/07f0f08755935c133fdeb56a3245dbb6
[05:25:28] Nawn: has joined #ruby
[05:26:04] raeoks: has joined #ruby
[05:27:03] mynameisbrian: Why do we need splat operator when I can simply do: c = 1, 2, 3 ?
[05:27:24] mynameisbrian: and then c is an array
[05:27:58] bazzy: You can use a splat in a method definition to gather up any remaining arguments
[05:28:09] LoneHerm_: has joined #ruby
[05:28:45] TomPeed: has joined #ruby
[05:28:53] SilverKey: has joined #ruby
[05:28:59] alex88: monoprotic: seems they're valid only when formatting a date to a string, not when parsing
[05:29:14] alex88: nevermind, removed them and seems to work
[05:29:36] mynameisbrian: I know what the splat operator does, but I don't know why the last parameter wouldn't eat up the rest of the arguments, when you can do that with a variable: c = 1, 2, 3
[05:29:42] bronson: has joined #ruby
[05:30:08] mynameisbrian: >> c = (1, 2, 3)
[05:30:09] ruby[bot]: mynameisbrian: # => /tmp/execpad-255545bcd18b/source-255545bcd18b:2: syntax error, unexpected ',', expecting ')' ...check link for more (https://eval.in/571696)
[05:30:16] mynameisbrian: >> c = 1, 2, 3
[05:30:17] ruby[bot]: mynameisbrian: # => [1, 2, 3] (https://eval.in/571697)
[05:30:27] mynameisbrian: okay, I see now
[05:34:02] mynameisbrian: well, I still don't see
[05:34:23] tmtwd: has joined #ruby
[05:34:49] rocfig: has joined #ruby
[05:35:03] mynameisbrian: I guess I picture 1,2,3,4 as a datatype, such as a list, and so if I can pass it to a variable, it seems like it should work that way in a method invocation too
[05:41:53] kareeoleez: has someone been involved with FFI 's?
[05:44:25] ItSANgo: has joined #ruby
[05:44:39] karmatr0n: has joined #ruby
[05:48:07] kareeole_: has joined #ruby
[05:53:38] moeabdol: has joined #ruby
[05:57:51] halfamind: has joined #ruby
[05:58:56] eliand: has joined #ruby
[06:00:36] moeabdol: has joined #ruby
[06:03:17] SilverKey: has joined #ruby
[06:04:49] Ishido: has joined #ruby
[06:05:57] dsea: has joined #ruby
[06:06:43] lessless: has joined #ruby
[06:09:08] the_drow: has joined #ruby
[06:10:18] d0lph1n98: has joined #ruby
[06:13:28] bruno-: has joined #ruby
[06:15:38] pablod: has joined #ruby
[06:16:05] pablod: anyone around?
[06:16:22] pablod: I got a question about alias_method
[06:18:27] pabloh: has joined #ruby
[06:19:57] nankyokusei: has joined #ruby
[06:20:14] tildes: has joined #ruby
[06:21:20] spider-mario: has joined #ruby
[06:22:25] Nawn: has joined #ruby
[06:23:13] patrick_star_3: has joined #ruby
[06:24:12] darkxploit: has joined #ruby
[06:25:51] p1k: has joined #ruby
[06:26:21] p1k: how correctly preserve a grep command in a ruby string ?
[06:27:02] p1k: e.g. grep -R "[\"']" will become escaped as "grep -R \"[\"']\""
[06:27:08] p1k: which cannot be executed correctly after that
[06:29:26] p1k: I guess gsub('\', '\\') but that can have unwanted consequences..
[06:30:49] bronson: has joined #ruby
[06:34:12] yfeldblum: has joined #ruby
[06:35:04] crdpink: has joined #ruby
[06:35:36] roamingdog: has joined #ruby
[06:35:53] idefine: has joined #ruby
[06:37:19] the_drow: has joined #ruby
[06:37:50] pabloh: p1k, use simple commas
[06:38:00] pabloh: instead of doubles
[06:40:05] p1k: simple commas ?
[06:40:57] tildes: has joined #ruby
[06:41:16] RegulationD: has joined #ruby
[06:41:18] rocfig: has joined #ruby
[06:41:29] p1k: did you mean single quote e.g. grep -R '["\']' ?
[06:41:59] pabloh: that single quote
[06:42:08] rubyrubyruby: what should I use for the "platform" attribute in a gemspec for a gem that runs on all windows platforms (mswin{32,64}, mingw{32,64}, etc.)
[06:44:22] wnd: has joined #ruby
[06:45:17] pabloh: single quote won't apply escaping except for the single quote itself
[06:45:31] pabloh: or to '//'
[06:45:48] pabloh: sorry to '\\'
[06:47:25] Devalo: has joined #ruby
[06:53:11] Tempesta: has joined #ruby
[06:53:13] LoneHerm_: has joined #ruby
[06:54:59] Ropeney: has joined #ruby
[06:56:21] noobsu: has joined #ruby
[06:58:06] raeoks: has joined #ruby
[07:01:51] tildes: has joined #ruby
[07:02:50] karmatr0n: has joined #ruby
[07:04:57] p1k: pabloh: but the <<-SCRIPT <script> SCRIPT syntax breaks the single quote escaping =/
[07:05:40] pabloh: oh, I didn't know you wanted to use multiline string
[07:06:01] pabloh: heredoc always escapes I think
[07:06:10] antgel: has joined #ruby
[07:06:16] clifford_: has joined #ruby
[07:06:18] bronson: has joined #ruby
[07:06:32] pabloh: plk, do u have a gist with what u are trying to do?
[07:07:19] p1k: pabloh: but you won't be able to use an unscaped double quote in a regular string
[07:07:34] p1k: pabloh: I just used .gsub('\', '\\') but I was wondering if there was a more consistent way
[07:08:28] pabloh: http://makandracards.com/makandra/15003-how-to-ruby-heredoc-without-interpolation
[07:08:50] pabloh: apparently you can use HEREODOCS with single quote semantics, see the link
[07:09:16] pabloh: although I'm not 100% sure I understand what you are trying to do, do you have a gist/pastie?
[07:10:11] raeoks: has joined #ruby
[07:14:40] clifford_: has joined #ruby
[07:15:15] bruno-: has joined #ruby
[07:17:30] Caerus: evening #ruby
[07:17:49] Vile`: has joined #ruby
[07:19:02] chip_: has joined #ruby
[07:21:05] ur5us: has joined #ruby
[07:22:54] pabloh: who's #ruby-lang admin?
[07:24:03] the_drow: has joined #ruby
[07:26:02] v0dro: has joined #ruby
[07:28:23] Caerus: I suppose the ones with op access are the ones with ruby/staff cloak but I'm not sure who's the actual admin (if there
[07:28:31] Caerus: if there's any.
[07:30:44] pabloh: I think theres a lot more plp that can access, since it's access by invitation
[07:31:38] v0dro: SciRuby is inviting applications for a TensorFlow Ruby wrapper. 1800$ stipend over 3 months. See this post: http://www.somatic.io/blog/tensorflow-is-coming-to-ruby
[07:31:58] v0dro: Join sciruby at #sciruby if you need more details.
[07:34:29] mercerist: has joined #ruby
[07:37:43] idefine: has joined #ruby
[07:37:56] Caerus: kareeoleez, my ruby woke up defaulted to 1.8.7 after doing rvm --default use ruby-1.8.7-head going to try to set it back to 2.3 and see if it works after reboot(the find out why).
[07:38:07] pawnbox_: has joined #ruby
[07:40:11] skade: has joined #ruby
[07:53:20] Devalo: has joined #ruby
[07:54:30] Devalo: has joined #ruby
[07:55:30] clifford_: has joined #ruby
[07:57:31] mercerist: has joined #ruby
[07:57:35] firstdayonthejob: has joined #ruby
[07:58:14] jenrzzz: has joined #ruby
[07:58:15] jenrzzz: has joined #ruby
[07:59:27] rippa: has joined #ruby
[08:02:37] zenlot: has joined #ruby
[08:03:13] uranellus: has joined #ruby
[08:03:14] uranellus: has joined #ruby
[08:03:38] karmatr0n: has joined #ruby
[08:03:42] skade: has joined #ruby
[08:07:43] CloCkWeRX: has joined #ruby
[08:09:07] SCHAAP137: has joined #ruby
[08:10:38] agent_white: has joined #ruby
[08:12:02] jgt1: has joined #ruby
[08:16:36] bronson: has joined #ruby
[08:17:17] ruskie: has joined #ruby
[08:18:07] wigust: has joined #ruby
[08:18:53] Fransen: has joined #ruby
[08:20:36] ur5us: has joined #ruby
[08:20:48] nankyokusei: has joined #ruby
[08:20:58] toretore: has joined #ruby
[08:23:01] solars: has joined #ruby
[08:28:16] skade: has joined #ruby
[08:35:47] chipotle: has joined #ruby
[08:38:05] ferr: has joined #ruby
[08:38:15] grassass: has joined #ruby
[08:42:01] skade: has joined #ruby
[08:44:55] jaguarmagenta: has joined #ruby
[08:45:06] minimalism: has joined #ruby
[08:45:13] yfeldblum: has joined #ruby
[08:46:30] blaxter: has joined #ruby
[08:51:30] yaw: has joined #ruby
[08:52:55] Mon_Ouie: has joined #ruby
[08:59:35] astrobun_: has joined #ruby
[09:03:50] raeoks: has joined #ruby
[09:04:23] karmatr0n: has joined #ruby
[09:06:07] p1k: so is there anyting I can do for tracing all called ruby functions by a process ?
[09:08:01] jhass: p1k: http://ruby-doc.org/core-2.3.1/TracePoint.html
[09:08:30] p1k: jhass: ty
[09:11:33] roamingdog: has joined #ruby
[09:12:45] startupality: has joined #ruby
[09:14:25] blackmesa: has joined #ruby
[09:16:51] xall: has joined #ruby
[09:16:58] bruno-: has joined #ruby
[09:19:12] clifford_: has joined #ruby
[09:24:08] urine535: has joined #ruby
[09:24:12] urine535: burn all jews in oven
[09:24:14] urine535: death to infidels
[09:25:33] urine535: allahu akhbar
[09:25:36] p1k: what's the name of the feature that let's you scope changes to a class on a module level ?
[09:25:43] urine535: burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all
[09:25:44] urine535: jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ###
[09:25:57] Mon_Ouie: !troll urine535
[09:25:57] ruby[bot]: +bb urine535!*@*$#ruby-banned *!*@85-76-15-154-nat.elisa-mobile.fi$#ruby-banned
[09:25:57] ruby[bot]: ruby[bot] kicked urine535: is a bannable offense, see http://ruby-community.com/pages/user_rules
[09:26:04] apeiros: Mon_Ouie: beat me to it
[09:26:06] squigz: Mon_Ouie: you're my new best friend
[09:26:51] apeiros: squigz: it's !ops, but I guess I'll make an alias for !op
[09:28:41] nankyokusei: has joined #ruby
[09:29:05] v0dro1: has joined #ruby
[09:29:08] oetjenj: has joined #ruby
[09:29:54] Mon_Ouie: p1k: They're called refinements
[09:30:12] p1k: Mon_Ouie: that was it, thanks
[09:30:25] p1k: it's odd that google searches don't give me that =/
[09:34:42] raeoks: has joined #ruby
[09:37:46] skade: has joined #ruby
[09:38:55] yaw: has joined #ruby
[09:39:23] tildes: has joined #ruby
[09:40:34] pabloh: has joined #ruby
[09:42:32] pabloh: ACTION is lost
[09:43:16] apeiros: pabloh: I hope you have a "return to owner" tag on you then ;-p
[09:44:32] d0lph1n98: has joined #ruby
[09:45:20] braincrash: has joined #ruby
[09:46:43] skade: has joined #ruby
[09:54:51] skingsbu: has joined #ruby
[10:01:01] startupality: has joined #ruby
[10:01:26] pawnbox: has joined #ruby
[10:01:50] pabloh: apeiros, hahah
[10:05:17] karmatr0n: has joined #ruby
[10:07:37] TomyLobo: has joined #ruby
[10:10:41] raeoks: has joined #ruby
[10:10:47] Labaleine: has joined #ruby
[10:12:19] roamingdog: has joined #ruby
[10:19:49] jaguarmagenta: has joined #ruby
[10:22:54] shinnya: has joined #ruby
[10:23:19] Ocratech: has joined #ruby
[10:24:30] stardiviner: has joined #ruby
[10:25:29] mr_robot_: has joined #ruby
[10:25:47] idefine: has joined #ruby
[10:26:01] araujo: has joined #ruby
[10:28:47] yeukkf: has joined #ruby
[10:29:00] aries_liuxueyang: has joined #ruby
[10:31:36] d0nn1e: has joined #ruby
[10:36:19] BTRE: has joined #ruby
[10:37:46] al2o3-cr: has joined #ruby
[10:39:34] yfeldblum: has joined #ruby
[10:39:34] pxwpst: has joined #ruby
[10:42:27] RegulationD: has joined #ruby
[10:44:40] madgen: has joined #ruby
[10:45:22] pawnbox: has joined #ruby
[10:46:08] gizmore: has joined #ruby
[10:48:24] nankyokusei: has joined #ruby
[10:48:50] KikoSalguero123: has joined #ruby
[10:51:03] KikoSalguero123: Hello, im trying to do a Hash that has a "ç" in the keys. When a puts that hash it didn't shows th"ç", its shows "\u00E7". That i need to do?
[10:52:20] KikoSalguero2: has joined #ruby
[10:52:28] KikoSalguero2: Hello, im trying to do a Hash that has a "ç" in the keys. When a puts that hash it didn't shows th"ç", its shows "\u00E7". That i need to do?
[10:52:39] toretore: KikoSalguero2: what is the problem with it?
[10:54:02] KikoSalguero2: I just need to print the ç intead of u00E7
[10:54:06] apeiros: KikoSalguero2: \u00e7 is ç
[10:54:59] KikoSalguero2: But when i print the hash i want to show ç
[10:55:04] apeiros: if it prints it like that it iirc means that a) you're printing an inspect and b) the encoding for your output is not set to utf-8
[10:55:12] toretore: KikoSalguero2: why?
[10:55:14] apeiros: how do you print the hash?
[10:56:04] apeiros: yeah, that'll print an inspect
[10:56:15] apeiros: what's the result of `$stdout.external_encoding || Encoding.default_external`?
[10:56:34] jenrzzz: has joined #ruby
[10:56:34] jenrzzz: has joined #ruby
[10:59:00] KikoSalguero2: I put it, nothing happens
[10:59:28] KikoSalguero2: i will try something here...
[10:59:45] apeiros: if you're not in an interactive session (pry/irb), you have to print the result. preferably using Kernel#p:
[10:59:51] apeiros: `p $stdout.external_encoding || Encoding.default_external`
[11:01:20] toretore: KikoSalguero2: what exactly is it you're trying to do?
[11:01:43] apeiros: lovely, they left
[11:02:30] KikoSalguero2: A supermarket list
[11:02:37] KikoSalguero2: a exercise program
[11:03:10] apeiros: or they joined twice...
[11:03:11] KikoSalguero2: i create a hash with products in the key, and quantity in the value
[11:03:18] toretore: gist your code
[11:03:20] ruby[bot]: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[11:04:06] toretore: you sound like you're confused about the actual contents of a string and its representation when you inspect it
[11:04:08] KikoSalguero2: Im really noob... sorry... I will see how to use github and than i get back
[11:04:23] shevy: you copy/paste your existing code and paste it there
[11:04:33] apeiros: `puts hash` is the wrong tool for that, as that'll inspect the hash (inspects are for debugging).
[11:04:46] apeiros: but regardless, you should still tell me the result of that expression I gave you
[11:05:12] apeiros: because inspect too will show ç with encodings set properly
[11:06:12] karmatr0n: has joined #ruby
[11:09:38] jhass: now they left :P
[11:11:25] Caerus: you guys have become my personal heroes, other channels are SO not newbie friendly
[11:13:07] roamingdog: has joined #ruby
[11:13:12] shevy: I could swear that newbies were more durable some years ago
[11:16:42] Labaleine: Hello ! I don't get why my code is doing an infinite loop since I am using until. When the condition is met it should go to the other part of my code ?
[11:16:44] apeiros: shevy: I'd concur
[11:16:56] apeiros: there's a ton of entitlement in so many nowadays
[11:17:08] Labaleine: user_input = gets.chomp
[11:17:10] Labaleine: until user_input == "q" do prompt(show)
[11:17:29] bronson: has joined #ruby
[11:17:38] apeiros: Labaleine: yes, that should terminate upon the user entering q
[11:17:52] Labaleine: yes but it is not I don't understand why
[11:18:00] stardiviner: has joined #ruby
[11:18:07] apeiros: can you gist the full code?
[11:18:17] bruno-: has joined #ruby
[11:18:27] Labaleine: Aperos: Yes thank you for your kind help
[11:18:37] apeiros: ?tabnick Labaleine
[11:18:37] ruby[bot]: Labaleine: pro-tip - use tab completion for nicks. avoids typos in nicks.
[11:18:52] shevy: you can call him apieros!
[11:18:56] apeiros: ACTION ain't a snack ;-p
[11:18:59] thomas: has joined #ruby
[11:19:10] Labaleine: https://gist.github.com/anonymous/b3ff5dd00bef5991dbf6f617122d0eb4
[11:19:41] apeiros: oy, tabs for indent…
[11:19:42] sepp2k: has joined #ruby
[11:19:57] nadir: has joined #ruby
[11:20:04] apeiros: anybody want to write a piece of code to repaste a gist with proper formatting? :) I'd add it to ruboto
[11:20:04] shevy: labaleine btw you can save with .rb as file end on gist.github, then you get colour highlighting for free there
[11:20:44] apeiros: labaleine: oh
[11:20:51] apeiros: you actually get the userinput only once
[11:21:17] apeiros: so your loop will only end (or actually never run) if the very first user input is "q"
[11:21:48] apeiros: you probably want to assign the return value of `prompt` to `user_input` in that loop.
[11:22:24] Caerus: I need some help molding my brain to the ruby ways, been practicing with string manipulation and I'm looking for suggestions (not solution please) as to how could I go about formatting a text file.
[11:23:31] shevy: Caerus with already existing methods? or do you want to build them on your own :D
[11:23:58] Caerus: I reckon doing either of these are bad to begin with: lines_array = File.readlines(ARGV.first), txt_file = File.open(ARGV.first, "r") { |iofile| iofile.gets(nil)}
[11:24:19] shevy: are they bad?
[11:24:20] Labaleine: Apeiros: more something like this > until ['q'].include?(user_input = prompt(show).downcase)
[11:24:25] shevy: I'd use methods though
[11:24:51] shevy: and a class. for reformatting, look at .center .ljust .rjust, also % / sprintf for String, and also .gsub
[11:25:01] Caerus: is it possible to do file.new and work on the file itself?
[11:25:49] skade: has joined #ruby
[11:26:17] apeiros: Caerus: I think that's the entire point of File.new?
[11:26:19] Labaleine: has joined #ruby
[11:26:25] jhass: Caerus: how to best read it depends on what exact operations you want to do to it and what to do with the result(s)
[11:26:44] tildes: has joined #ruby
[11:26:51] Labaleine: Apeiros > just got a problem on IRC. So my code looks better like this apparently > until ['q'].include?(user_input = prompt(show).downcase)
[11:27:38] apeiros: labaleine: you can reduce that to just: `until "q" == prompt(show)` (move the downcase into the prompt)
[11:27:50] flughafen_: has joined #ruby
[11:28:40] Caerus: so my reasoning behind calling the File.open approaches wrong is correct? I should be using File.new for this along with +w mode yes?
[11:29:01] apeiros: File.new == File.open iirc
[11:29:16] jhass: I don't see any reasoning nor my question answered
[11:29:24] Labaleine: Oh it works ! thank you very much !
[11:30:26] Caerus: oh yeah. reasoning being coping whole file to memory is not healthy?
[11:30:29] flughafen_: hello everybody
[11:30:53] shevy: flughafen_!
[11:30:53] Caerus: and I want to format it so it has either a set amount of words per line or max characters
[11:30:57] apeiros: Caerus: copying the whole file into memory can be convenient and make things easier. but it doesn't scale.
[11:30:59] Caerus: whatever happens first.
[11:31:03] flughafen_: shevy: i still havent taken off
[11:31:17] shevy: flughafen_ yeah, even some dude from brazil made fun of the flughafen
[11:31:21] Caerus: I stand corrected, not w
[11:31:28] flughafen_: shevy: that jerk!
[11:31:29] jhass: Caerus: write it to a new file, replace contents?
[11:31:45] Caerus: *'wrong' per se, but not scalable.
[11:32:16] apeiros: Caerus: and with regards to in-place modification of files: that's considered unsafe. if your app crashes mid-process you end up with a corrupt file.
[11:32:53] jhass: also given you'll be inserting \n's you'll overwrite stuff before you read it unless you're very careful
[11:33:14] Caerus: apeiros, good point, hand't thought of that.
[11:33:54] DanyC: has joined #ruby
[11:34:12] flughafen_: is github.com/vim-ruby/vim-ruby already in vim?
[11:34:16] Caerus: jhass, yeah thats why first thought of copying the file to memory. That also brought me to the question of whether to use .readlines or .read
[11:34:44] jhass: if you want to avoid temporary loading all into memory you could write to a tempfile and move that one over the original once done
[11:35:20] jhass: do you want to preserve existing newlines?
[11:35:21] apeiros: Caerus: both .read and .readlines will consume the whole file
[11:35:35] apeiros: so both with regards to "not read the whole file into memory", they're equal.
[11:36:06] Caerus: but with readlines I get an Array and with read the way I tried it I got a big String
[11:36:12] apeiros: File#each_* or File::foreach
[11:36:28] apeiros: Caerus: so? it's still the full file in memory
[11:36:43] apeiros: and a big string chunked into an array of smaller strings is larger than the big string itself
[11:36:52] DanyC: has joined #ruby
[11:37:41] jhass: another note though, you don't have like gigabyte sized text files, right?
[11:37:49] Caerus: jhass, I was looking to transform the actual file, your suggestion of duplicating the file is awesome
[11:38:00] jhass: all of this will hardly be relevant considerations for text files
[11:39:32] Caerus: and apeiros being past the memory issue, I wondered which would be better for actually manipulating the String to match the desired formatting
[11:40:02] Caerus: yeah jhass nothing mission critical just overall practice hehe
[11:41:59] pawnbox: has joined #ruby
[11:42:24] d0lph1n98: has joined #ruby
[11:43:14] shevy: Caerus is on his way to ruby mastery
[11:43:41] apeiros: from ruby mystery to ruby master
[11:43:48] Caerus: thanks for the suggestions I'll on another approach based on them
[11:43:59] Caerus: ! there is a book name
[11:44:29] flughafen_: shevy: im a ruby master, i can open files in ruby
[11:44:33] apeiros: that lacked a "y" :(
[11:44:54] apeiros: flughafen_: yeah, but will it fly?
[11:44:55] jgt1: has joined #ruby
[11:45:21] flughafen_: apeiros: flying files i have no mastered
[11:45:21] Caerus: apeiros, what lacked a "y"?
[11:45:29] Caerus: oh mastery
[11:45:31] apeiros: "from ruby mystery to ruby master"
[11:45:59] nischay_: has joined #ruby
[11:46:28] dionysus69: has joined #ruby
[11:48:26] Caerus: I'd read that you should write it apeiros
[11:48:47] apeiros: the list of things I should write is sadly quite long :(
[11:49:28] Caerus: start with ruby multicore? ;)
[11:49:47] apeiros: why'd I write a single line book?
[11:49:58] apeiros: ruby multicore, page 1: just use jruby.
[11:50:00] shevy: to fight against those pesky newlines
[11:50:24] Caerus: do you all use jruby?
[11:50:35] shevy: not me! I am in the resistance fighters group
[11:50:39] apeiros: … "alternatively, use Process.fork, but be aware that this will not work on windows."
[11:51:04] apeiros: Caerus: not at the moment. but that's mostly due to me being slow at changing things which work.
[11:53:26] Caerus: is it that different from official interpreter?
[11:53:42] kam270: has joined #ruby
[11:53:55] apeiros: it's very close. the biggest issue I'm aware of is native extensions.
[11:54:13] apeiros: but that's an issue which depends entirely on your context and might not be an issue at all.
[11:55:32] AzzA: has joined #ruby
[11:57:01] noService: has joined #ruby
[11:57:12] Caerus: wow 2.2 compatible
[11:59:52] apeiros: ah, yeah, that might also be an issue - it's usually lagging a bit behind MRI. e.g. now 2.3 is out and jruby is at 2.2, so no &. for you f.ex.
[12:00:31] Caerus: is that the lonely operator?
[12:00:58] patrick_star_3: has joined #ruby
[12:02:56] shevy: hehe yeah
[12:03:03] shevy: dude staring at a dot on the floor
[12:03:12] Hanmac: has joined #ruby
[12:05:08] skade: has joined #ruby
[12:06:58] karmatr0n: has joined #ruby
[12:08:41] Yiota: has joined #ruby
[12:09:39] Caerus: Oh wow the sun is up, that's my cue. See ya later #ruby | thanks for the input apeiros, jhass. U too shevy. Have a good day.
[12:09:45] nankyokusei: has joined #ruby
[12:09:52] flughafen_: has joined #ruby
[12:11:36] m_antis: has joined #ruby
[12:12:17] nadir: has joined #ruby
[12:18:31] pawnbox: has joined #ruby
[12:19:07] bruno-: has joined #ruby
[12:19:17] sdothum: has joined #ruby
[12:20:32] jaguarmagenta: has joined #ruby
[12:24:39] nanoz: has joined #ruby
[12:27:35] roamingdog: has joined #ruby
[12:29:48] the_drow: has joined #ruby
[12:31:26] p1k: has joined #ruby
[12:32:54] Azure: has joined #ruby
[12:36:50] lubekpl: has joined #ruby
[12:37:20] blur3d: has joined #ruby
[12:37:50] DanyC: has joined #ruby
[12:38:59] eagduw: has joined #ruby
[12:43:28] RegulationD: has joined #ruby
[12:46:01] trinaldi: has joined #ruby
[12:47:21] diegoviola: has joined #ruby
[12:52:20] shakes: has joined #ruby
[12:52:50] qasaur: has joined #ruby
[12:55:03] shevy: oh yes the sun
[12:55:05] shevy: our old nemesis
[12:55:23] arpegius: has joined #ruby
[12:55:40] apeiros: praise the sun
[12:56:37] davedev24: has joined #ruby
[12:59:46] jenrzzz: has joined #ruby
[13:04:57] Madplatypus: has joined #ruby
[13:05:18] flashpoint9: has joined #ruby
[13:07:51] jgt1: has joined #ruby
[13:07:52] karmatr0n: has joined #ruby
[13:09:22] m_antis: has joined #ruby
[13:09:28] qasaur: has joined #ruby
[13:19:40] giz|work: has joined #ruby
[13:19:48] antgel: has joined #ruby
[13:24:07] thomas: has joined #ruby
[13:25:21] BTRE: has joined #ruby
[13:26:01] marchelzo: has joined #ruby
[13:26:31] marchelzo: why does 'foo' === /foo/ yield false, but /foo/ === 'foo' yield true?
[13:27:11] flughafen_: has joined #ruby
[13:27:17] apeiros: because String#=== is different from Regexp#===
[13:27:35] apeiros: === is still a method and its behavior depends on the object you call the method on
[13:28:11] marchelzo: that's cool
[13:28:21] marchelzo: it seems like === is a bad name though
[13:28:26] apeiros: note that you should not (or only rarely) use === in code. it exists for case/when and some rare methods like Enumerable#grep
[13:29:22] The_Phoenix: has joined #ruby
[13:29:29] marchelzo: it's confusing, since in most languages, === means the same as == without any implicit type conversions
[13:29:43] The_Phoenix: has joined #ruby
[13:29:43] marchelzo: why not call it match? or something
[13:30:07] apeiros: in other words: the name === is poorly chosen in those other languages because it's confusing me coming from ruby?
[13:30:46] apeiros: "other languages use X differently" makes for a poor argument. there's probably >1k languages out there by now.
[13:30:54] marchelzo: intuitively, === would be a stricter version of ==. also, it would be symmetric, like equality operators usually are.
[13:31:20] marchelzo: ruby's === behaves nothing like ==, which is confusing, even if you don't compare it to other languages.
[13:31:24] apeiros: I don't think so. this isn't instinct, it's learned (from those other languages)
[13:32:03] apeiros: ruby's == doesn't behave like other languages' == either.
[13:32:13] apeiros: so stop using other languages as a reference for how ruby should behave.
[13:33:00] apeiros: and yeah, === is a different method than ==, so *obviously* it will behave differently
[13:33:06] apeiros: otherwise there'd be no point in having it
[13:33:24] marchelzo: right, but their behavior isn't even remotely related
[13:33:30] marchelzo: which is confusing
[13:33:32] apeiros: that's what you think now
[13:33:52] apeiros: === is the "case equality operator"
[13:34:07] marchelzo: even if you've never programmed before, you would see === and think it's a symmetric relation
[13:34:19] apeiros: again, learned
[13:34:24] apeiros: == isn't symmetric either
[13:34:34] apeiros: it's all methods, so no symmetry.
[13:34:35] Biopandemic: has joined #ruby
[13:35:10] apeiros: also things like +, -, *, / -- they're all not symmetric. they're all methods.
[13:35:14] AlexRussia: has joined #ruby
[13:35:51] hk238: has joined #ruby
[13:35:56] skade: has joined #ruby
[13:36:35] apeiros: also the term you're looking for is actually commutative, not symmetric
[13:36:43] marchelzo: of course, but usually when defining the + method, you'd make sure it's associative. when defining an == method, you'd make sure it's symmetric and reflexive, etc. whereas with ===, you almost never want those properties
[13:37:04] roamingdog: has joined #ruby
[13:37:27] marchelzo: symmetry and commutativity are the same in this case, basically
[13:38:42] rbennacer: has joined #ruby
[13:38:42] DanyC: has joined #ruby
[13:39:30] apeiros: anyway, you've now learned that it's not the way you expected it. you can either accept it and try to also learn why it makes sense, or you can pretend to know better despite being new to the language and lament how bad it is.
[13:39:40] rbennacer: has joined #ruby
[13:39:57] crystal77: has joined #ruby
[13:40:04] apeiros: I see no reason for me to participate in the latter
[13:40:48] marchelzo: i do accept it, but i still think it's a poor name. i think most people would agree. no need to be so defensive.
[13:41:08] Kus: has joined #ruby
[13:41:14] shevy: did you make a poll to establish that most people would agree
[13:41:40] marchelzo: no, that's why i said "i think".
[13:42:11] apeiros: i think most people would disagree. there. turned your point moot.
[13:42:13] shevy: I think most people would not agree
[13:42:43] apeiros: "most people would agree" is probably an authority fallacy anyway.
[13:42:44] shevy: you can try to file at https://bugs.ruby-lang.org/projects/ruby-trunk to see whether they will change the name
[13:42:56] apeiros: (even without the "I think")
[13:43:07] marchelzo: "most people" doesn't mean "most ruby programmers"
[13:43:46] shevy: yeah I'll ask my barber about programming
[13:44:05] marchelzo: most programmers, then
[13:44:27] apeiros: "please choose your preferred set of biases"
[13:44:56] apeiros: it's a pointless statement, aiming to improve your argument, while it actually does nothing of that sort. you can just leave it away.
[13:45:47] piliplaker: has joined #ruby
[13:46:34] marchelzo: actually, the goal when naming things is to make their meaning clear and concise. if most people agree that a name is poor, then you've failed.
[13:46:53] marchelzo: it's not an "authority fallacy"
[13:47:07] apeiros: I guess you failed to understand why it's pointless.
[13:47:22] apeiros: yes, clear and concise - to the target audience.
[13:47:34] apeiros: now guess who the target audience of ruby is. hint, it's not "programmers".
[13:48:03] apeiros: if it was, I'd suggest to go to haskell and complain about all their "poorly named operators"
[13:48:47] shevy: he may have done so already!
[13:48:51] apeiros: and we're back at "I'm new and pretend I know better". and back at "I'm out of this". but this time for real :)
[13:48:54] marchelzo: a programming language whose target audience is not programmers?
[13:49:20] marchelzo: how did ruby every become popular if its target audience is only people who already know ruby?
[13:49:33] shevy: because the language is better than xyz perhaps?
[13:50:16] apeiros: by aiming at people who like rubys design choices
[13:50:35] apeiros: and the set of people who like rubys design choices is by no means equivalent to the set of "all programmers"
[13:51:05] apeiros: and that's simplified
[13:52:41] marchelzo: using that logic, everything ever made is perfect
[13:52:52] antgel: has joined #ruby
[13:52:53] marchelzo: that target audience of X is people who like X
[13:53:03] diego1: has joined #ruby
[13:53:09] shevy: where is the perfect programming language
[13:53:17] marchelzo: ruby, clearly
[13:53:46] apeiros: you have an interesting definition of perfect there
[13:53:50] Es0teric: has joined #ruby
[13:54:24] marchelzo: if you don't like something about ruby, your opinion doesn't matter, since ruby is only aimed at people who like ruby. is that right?
[13:54:25] apeiros: anyway, I'm out, as said. I see no point in continuing this.
[13:54:35] shevy: even matz himself is working on a better language https://github.com/mruby/mruby :) AND https://github.com/matz/streem
[13:55:24] marchelzo: good idea. time for breakfast anyway. take care.
[13:55:50] idefine: has joined #ruby
[13:56:36] Mia: has joined #ruby
[13:56:36] diego2: has joined #ruby
[13:56:36] Mia: has joined #ruby
[13:58:13] qasaur: has joined #ruby
[14:06:45] sinkensabe: has joined #ruby
[14:07:01] the_drow: has joined #ruby
[14:07:44] diego2: has joined #ruby
[14:09:00] karmatr0n: has joined #ruby
[14:10:04] diego1: has joined #ruby
[14:10:47] nankyokusei: has joined #ruby
[14:11:01] allcentury: has joined #ruby
[14:11:56] diego1: has joined #ruby
[14:13:48] raz: ha, funny trap with the snav nav operator. i naively tried hsh[:foo]&[:bar]&[:baz] ... and took me way too long to realize that's not how it works ;)
[14:14:19] apeiros: with hash, use Hash#dig
[14:15:14] raz: yes, doing that now
[14:15:25] raz: ACTION wonders if his constructs deserves an addition to rubocop
[14:16:43] apeiros: if, then only when written without spaces
[14:17:00] apeiros: hm, though
[14:17:12] apeiros: if written without spaces or with multiple array literals
[14:17:34] raz: yea well at least it's hard to write an actual bug that way
[14:17:35] apeiros: while ary1 & ary2 & ary3 makes sense, I guess ary1 & [literal1] & [literal2] does not
[14:18:30] raz: seems unlikely at least, but who knows :)
[14:18:59] raz: on another note i really wish ruby would finally at dot notation for hash access
[14:19:00] apeiros: not just unlikely. with literals, you can combine it into a single one.
[14:19:07] raz: im getting finger cramps from all that [] mess
[14:19:39] raz: (see, that's how weak my fingers have become, can't even spell 3 letter words anymore)
[14:19:55] apeiros: you can do .store() instead of []=. and .fetch(key, nil) instead of []
[14:20:33] raz: no, i just want foo.bar.batz instead of foo.lots_of_typing('bar').even_more_typing('batz')
[14:20:43] apeiros: oh. no. please not.
[14:20:45] bronson: has joined #ruby
[14:20:50] apeiros: use an openstruct if you want that.
[14:21:01] raz: i dont want structs or hashie or what not, i've tried them all
[14:21:06] raz: i want it native on all hashes
[14:21:15] |2701: has joined #ruby
[14:21:21] raz: use a new operator if you have to (i know, dots and method names..)
[14:21:27] raz: ACTION is in rant mode
[14:21:33] shevy: hashie is a cool name
[14:21:37] shevy: sounds like a drug
[14:21:50] raz: it's also a relatively useful gem :)
[14:22:07] apeiros: raz: and what was your problem with hashie etc.?
[14:22:15] shevy: the name!!!
[14:22:19] raz: but sadly can only do so much. i.e. fix it for your own hashes - and put you into that certain place in hell where you're juggling with raw and fixed hashes..
[14:22:31] raz: apeiros: ^ that
[14:22:33] shevy: actually, HashWithIndifferentAccess is even worse as a name
[14:22:37] raz: they don't fix the problem, they arguably make it worse
[14:22:52] raz: by adding inconsistency to the injury
[14:23:01] chipotle: has joined #ruby
[14:23:04] shevy: layers on layers on layers
[14:23:07] shevy: lipstick on a pig!
[14:23:09] apeiros: how about refinements?
[14:23:12] raz: shevy++
[14:23:29] raz: apeiros: that can't be tacked on. it needs to be fixed in the language, like the hash literal synrax.
[14:23:42] shevy: hehe synrax
[14:23:47] apeiros: raz: uh, you do know what refinements are, yes?
[14:24:06] raz: apeiros: something i add to my codebase to make it incompatible with everything else?
[14:24:09] apeiros: because that'd be the point of using one - adding your desired dot-notation to Hash itself
[14:24:39] apeiros: raz: again, no. that's the point of refinements. they're lexically scoped. the change only applies to your code. even for objects shared between your and others' code.
[14:24:50] raz: apeiros: i don't want it on my code, i want it on YOUR code
[14:24:53] raz: on all ruby code
[14:25:01] apeiros: raz: why? you don't write my code
[14:25:09] raz: apeiros: but i may have to access your hashes
[14:25:20] apeiros: ok. again. reread what I wrote.
[14:25:25] apeiros: that's. the. point. of. refinements.
[14:25:34] apeiros: it WILL apply to hashes you get from my code.
[14:25:51] pawnbox: has joined #ruby
[14:25:57] raz: apeiros: gnah. and then i have to everyone and their rubocop why *my* ruby code is different
[14:26:01] raz: explain to
[14:26:36] raz: apeiros: this is a language wart. we should just fix it on the language for everyone's greater good.
[14:26:48] apeiros: I doubt there's a rubocop rule which figures that you're having a hash there and calling methods which normally don't exist on a hash.
[14:26:52] raz: at the same time the symbol/string-key mess could be sorted
[14:26:58] apeiros: no thanks.
[14:27:19] apeiros: and next the integer/string key mess?
[14:27:48] raz: why would there be an integer/string mess?
[14:28:15] apeiros: because asking for "foo" and :foo be the same key is the same bad idea as asking for 1 and "1" to be the same key.
[14:29:02] raz: apeiros: you are right, symbols were a bad idea
[14:29:18] shevy: well newcomers will always ask the string versus symbol access dichotomy for hashes
[14:29:19] apeiros: no. people being willfully ignorant is a bad idea.
[14:29:28] apeiros: if you're confused about the difference between strings and other objects, then just stick with strings.
[14:29:35] apeiros: in the worst case your code will be tiny bit slower.
[14:29:36] raz: apeiros: explain, why are symbols needed in a language?
[14:29:43] shevy: but they read that symbols are faster and should be used :)
[14:30:08] apeiros: raz: no. I'll not take that much from my time. please educate yourself on the advantages of symbols.
[14:30:25] apeiros: and as said, if you don't think they exist - just stick with strings.
[14:30:42] raz: shevy: yea, newbies happily take every bullshit that's fed to them as gospel :/
[14:30:48] shevy: raz I remember that for my main configuration object (for some bigger projects), I tend to use . methods such as: if @config.use_colours? because I found it more readable than @config[:use_colours]
[14:31:01] apeiros: I'm against dumbing down tools just because some people can't be bothered to learn how and why things work the way they do.
[14:31:03] shevy: or perhaps without the ? there, I actually forgot
[14:31:09] shevy: but I like the ? there
[14:31:22] raz: apeiros: oh. advantages of symbols. how does that work in the context of now immutable strings again?
[14:31:39] apeiros: a string is not a symbol
[14:31:46] raz: i'd really be curious to hear an advantage, just one. and don't say performance.
[14:31:48] apeiros: and a symbol is not a string
[14:31:49] sinkensabe: has joined #ruby
[14:31:59] jgt1: has joined #ruby
[14:32:01] apeiros: a symbol is (for the machine) closer to an integer than to a string.
[14:32:22] shevy: raz hah that's an interesting thought, I haven't yet considered how immutable strings would affect symbols
[14:32:27] apeiros: "and don't say performance" - go away then :-p
[14:32:33] raz: yea just how do all these other languages do it, without exposing symbols...
[14:32:42] apeiros: I'll say it anyway: performance. there.
[14:32:54] raz: apeiros: symbols were a mistake. not having dot notation is sort of defensible, but ultimately just awfully inconvenient.
[14:33:07] apeiros: I could also say GC stress. but that's just convoluted for "performance".
[14:33:23] apeiros: I could also say "using the native representation". but again, that's just convoluted for "performance".
[14:33:45] shevy: let's not forget bottlenecks!!!
[14:33:56] czerasz: has joined #ruby
[14:33:56] apeiros: raz: you are being willfully ignorant. please, do stick with strings. let the grown up keep their advanced tools. thanks.
[14:33:56] raz: apeiros: red herring. ruby is slow. wasting trillions of developer hours for a difference that rarely can even be measured was *not* worth it.
[14:34:17] apeiros: you sure you didn't mean to say trollions?
[14:34:23] raz: apeiros: you're just bitter because i know more than you :P
[14:34:34] apeiros: lol, yeah, sure.
[14:34:47] Ocratech: has left #ruby: ("Leaving")
[14:34:49] raz: nah trillions seems accurate, tho i'll admit i didn't research the number
[14:35:22] raz: but thinking about strings/symbols probably costs me an hour or so a month. for newbs the number is much higher. multiply by number of ruby users. it adds up.
[14:35:51] apeiros: again: just stick with strings then.
[14:36:03] raz: apeiros: you know that doesn't work, why do you keep suggesting it!
[14:36:13] apeiros: I know it works perfectly.
[14:36:15] raz: why must you dilute my beautiful sunday rant!
[14:38:36] Elvin: has joined #ruby
[14:38:48] apeiros: oh, oh, oooh: better yet: go use node
[14:38:59] bruno-: has joined #ruby
[14:39:06] apeiros: js' hashes only know string keys
[14:39:15] apeiros: better yet - they aren't really hashes
[14:39:36] raz: i'm suggesting to fix a wart on a nice language and you tell me to go use an awful language instead
[14:39:46] raz: i guess that's the nerd version of 'fu'
[14:40:01] DanyC: has joined #ruby
[14:40:10] whathappens: has joined #ruby
[14:40:42] sesquipedalian: has joined #ruby
[14:40:49] apeiros: no. you suggest to change a non-issue into a dumbed down stupidity.
[14:41:16] raz: improving syntax has nothing to do with 'dumbing down'
[14:41:48] apeiros: making symbols be the same as strings has nothing to do with syntax
[14:42:14] apeiros: removing symbols would, but only to the extend as it'd mean to remove the symbol literal from the syntax
[14:42:19] raz: that was a secondary subject, and yes that's not dumbing down either, that's fixing a design bug
[14:42:45] apeiros: today's motto of discussions: ignorants trying to have their way.
[14:43:04] apeiros: or "wanting to"
[14:43:08] raz: ignorants huh
[14:43:34] raz: you still haven't explained the purpose of symbols in ruby, in contrast to lisp and smalltalk
[14:43:44] cdg: has joined #ruby
[14:44:13] apeiros: "I don't know the purpose of symbols" -> that's what makes you an ignorant.
[14:44:14] RegulationD: has joined #ruby
[14:44:47] apeiros: and your unwillingness to educate yourself on it makes you a willful ignorant.
[14:45:02] raz: well, i have educated myself. why don't you enlighten me?
[14:45:13] raz: if i replace all symbols in my code with strings, somehow it still works
[14:45:17] raz: what am i missing?
[14:45:53] apeiros: obviously that "I educated myself" part.
[14:46:23] raz: or maybe you just don't have an argument huh? ¯\_(ツ)_/¯
[14:46:38] apeiros: oh, yes. yes. you won. done well there. good bye.
[14:47:22] davedev24: has joined #ruby
[14:47:23] rkazak: has joined #ruby
[14:48:32] nankyokusei: has joined #ruby
[14:49:32] kaleido: a symbol is always the same in any context, correct?
[14:49:36] jancel: has joined #ruby
[14:49:58] jancel: has joined #ruby
[14:51:31] sdothum: has joined #ruby
[14:51:49] skade: has joined #ruby
[14:52:10] SilverKey: has joined #ruby
[14:52:56] apeiros: mostly. as of ruby 2.2, dynamically generated symbols can be gc'ed.
[14:54:12] sdothum: has joined #ruby
[14:55:23] raz: and strings are staged to be immutable by default
[14:55:24] raz: ACTION chuckles
[14:55:32] raz: (from 2.3)
[14:56:05] apeiros: and yet, strings are just as much not symbols as integers aren't.
[14:56:18] apeiros: though again, integers are actually closer to symbols than strings.
[14:56:42] raz: apeiros: but i already won, you can stop flailing :P
[14:56:58] apeiros: sure. you won. the prize of the ignorant of the day.
[14:58:31] raz: ACTION wonders about the difference between an immutable string and a symbol
[14:59:11] apeiros: don't worry your head. keep using strings. it'll be fine.
[14:59:57] raz: i like your way of arguing without arguments :D
[15:00:00] shevy: but they are so slow... did we mention this already :D
[15:00:14] p1k: underlying representation aside, they have a completely different use type
[15:00:22] apeiros: shevy: you must not say that. or any other performance related metric.
[15:00:25] mercerist: has joined #ruby
[15:00:33] monoprotic: has joined #ruby
[15:00:39] pawnbox: has joined #ruby
[15:00:45] p1k: (although hashes where the keys are used as string values hide this in places)
[15:00:55] raz: apeiros: so what's the performance difference between these immutable strings and symbols... why don't you help the ignorant :(
[15:01:05] apeiros: things like memory consumption, gc pressure or any other performance related metrics are taboo in raz' world
[15:01:27] apeiros: raz: because I refuse to spoon feed the lazy.
[15:01:35] apeiros: is that a single word?
[15:01:45] jenrzzz: has joined #ruby
[15:01:46] jenrzzz: has joined #ruby
[15:01:46] apeiros: hm, hyphenated it seems
[15:02:02] raz: apeiros: but.. don't they use the same code-path in the vm?
[15:02:09] raz: ACTION so confused :(
[15:02:21] chouhoulis: has joined #ruby
[15:02:41] shevy: ruby people deal with the VM?
[15:02:51] mooe: has joined #ruby
[15:03:33] raz: only if they speak japenese!
[15:03:51] shevy: hmm norc is not here, he usually goes to the VM
[15:04:05] shevy: and Ox0dea
[15:04:23] shevy: this is also something that has changed... a few years ago, that really could not be observed on #ruby
[15:06:00] shevy: the speed discussions are admittedly much older :)
[15:08:22] p1k: for the same reason you wouldn't do stuff like :archived + :active
[15:08:40] raz: well, matz himself *wanted* to scrap symbols for 1.9
[15:08:52] raz: but he couldn't, too much legacy code broke
[15:09:01] p1k: raz: if strings are immutable you get about half-way
[15:09:10] raz: the new immutable string default is probably meant to be a slower take on the issue
[15:09:16] raz: p1k: exactly
[15:09:19] p1k: but for example in python where this the case it's not uncommon to define constants to mimic c-style enums
[15:09:33] karmatr0n: has joined #ruby
[15:09:44] p1k: e.g. ACTIVE = 0; ARCHIVED = 1 etc.
[15:09:47] raz: p1k: yea python is a good example here. their ongoing py2/py3 debacle is the prime argument against aprupt major syntax changes.
[15:10:15] hutch34: has joined #ruby
[15:10:24] raz: p1k: i wouldn't even mind retaining the symbol syntax, they should just behave as strings (i.e. indifferent access) where it matters
[15:10:33] raz: i.e. just make :foo syntactic sugar for 'foo'
[15:10:43] shevy: how does this work with a static object id
[15:10:44] p1k: raz: what's the benefit?
[15:11:00] raz: p1k: getting rid of the whole symbolize_keys and related mess
[15:11:26] p1k: raz: but I think this is just because a lot of people use enums where they are going to later use them as strings
[15:11:27] raz: p1k: removing one blocker from the road to dot-notation hash access
[15:11:42] wigust_: has joined #ruby
[15:11:52] p1k: raz: which {foo:1} being easier to write then { "foo" => 1} kind of promotes
[15:12:05] p1k: esp. { "foo".freeze => 1 }
[15:12:24] raz: p1k: well yes and yes. there simply is no reason for ruby to expose symbols as something special. they were a mistake, i think matz said that himself.
[15:12:43] pawnbox: has joined #ruby
[15:12:47] p1k: raz: I just thing the hash case is intermingled
[15:13:09] raz: hm, like how?
[15:13:12] p1k: ENUM's make plenty of sense to me, but that's not something you usually string interpolate
[15:14:13] raz: yea as said, i don't even mind to retain the syntax (doing away with that isn't realistic anyway)
[15:14:33] noService: has joined #ruby
[15:14:33] raz: but hashes shouldn't get on my neves when i access [:foo] as 'foo'
[15:14:43] p1k: where as with a hash you might say |k,v| "#{k} is set to {v}" (or something of that sort <a href=v>k</a> )
[15:15:35] raz: hm, not sure what you're going at there :)
[15:16:01] p1k: I mean that some key's you use as literals which is that intermingled frozen string usecase you are speaking of
[15:16:03] raz: when in interpolated (via to_s) they already look the same.. which is one of the problems with them
[15:16:31] raz: p1k: oh, you're talking about the performance difference now?
[15:16:36] p1k: I think e.g. enum use type is usually not for interpolation but representation of state
[15:17:01] Mon_Ouie: p1k: {"foo" => 1} and {"foo".freeze => 1} are the same though
[15:17:12] Mon_Ouie: >> {"foo" => 1}.keys.map(&:frozen?)
[15:17:13] p1k: raz: that's 50% of why I'd define ENUM in postgres rather than varchar
[15:17:18] ruby[bot]: Mon_Ouie: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
[15:17:44] raz: Mon_Ouie++
[15:18:17] akiTendo: has joined #ruby
[15:18:46] p1k: the other reason being constraints
[15:19:29] symm-: has joined #ruby
[15:19:32] apeiros: p1k: if only pg's enums could be meaningfully modified :-/ iirc deletion of a value being especially problematic.
[15:20:54] p1k: apeiros: when do you actually delete values from enums though? :o
[15:21:13] apeiros: p1k: when you have thing like country-, language- or currency-codes as enum
[15:21:25] ekinmur: has joined #ruby
[15:22:20] raz: ACTION mumbles something about static, ordered set
[15:22:33] p1k: apeiros: oh, I've never used enum for things like that I guess
[15:23:04] apeiros: or say you use it for something like progress codes (static, ordered set), and the requirements change after a year…
[15:24:52] p1k: apeiros: meh, once a year, shouldn't be that expensive to update alter type on the column?
[15:25:05] apeiros: the alter type isn't the expensive thing
[15:25:30] apeiros: as far as I remember the problem was how pg handles the enums internally and that deletion leads to the whole enum degrading
[15:25:35] p1k: I mean drop value might be nice, but if it literally map's to a c enum they'd have to have a different structure to handle drop
[15:25:49] apeiros: I don't remember the details, though. it's almost 2y ago since I came across that.
[15:25:56] kirun: has joined #ruby
[15:25:57] diegoviola: has joined #ruby
[15:27:14] p1k: I think it's still not on Rails anyways =/
[15:28:29] idefine: has joined #ruby
[15:29:19] `tim`: has joined #ruby
[15:30:14] nankyokusei: has joined #ruby
[15:34:04] Labaleine: has joined #ruby
[15:35:05] flashpoint9: has joined #ruby
[15:35:48] kareeoleez: has joined #ruby
[15:40:06] sdothum: has joined #ruby
[15:40:37] nando294021: has joined #ruby
[15:40:58] shinnya: has joined #ruby
[15:44:54] wigust: has joined #ruby
[15:45:03] RegulationD: has joined #ruby
[15:47:45] joelwallis: has joined #ruby
[15:51:01] idefine: has joined #ruby
[15:54:08] tmtwd: has joined #ruby
[15:54:09] rocfig: has joined #ruby
[15:54:45] rodfersou: has joined #ruby
[15:55:36] AlexRussia: has joined #ruby
[16:00:29] A124: has joined #ruby
[16:00:38] jancel: has joined #ruby
[16:00:53] hinbody: has joined #ruby
[16:02:29] jenrzzz: has joined #ruby
[16:02:29] jenrzzz: has joined #ruby
[16:03:26] SilverKey: has joined #ruby
[16:03:39] ixti: has joined #ruby
[16:05:18] DanyC: has joined #ruby
[16:05:35] Bugboy1028: has joined #ruby
[16:08:41] rumia: has joined #ruby
[16:09:55] mtkd: has joined #ruby
[16:10:29] karmatr0n: has joined #ruby
[16:11:37] A124: has joined #ruby
[16:13:12] zast: has joined #ruby
[16:13:35] JoshGlzBrk: has joined #ruby
[16:13:54] idefine: has joined #ruby
[16:14:41] roamingdog: has joined #ruby
[16:18:06] Masonn: has joined #ruby
[16:20:08] s00pcan_: has joined #ruby
[16:21:14] LBo: has joined #ruby
[16:22:14] jackjackdripper: has joined #ruby
[16:22:27] idefine: has joined #ruby
[16:23:31] bronson: has joined #ruby
[16:23:52] benzrf: has joined #ruby
[16:28:03] sepp2k: has joined #ruby
[16:32:32] A5101: has joined #ruby
[16:36:23] crystal77: has joined #ruby
[16:38:09] kgrz: has joined #ruby
[16:39:39] idefine: has joined #ruby
[16:40:41] karmatr0n: has joined #ruby
[16:42:26] jancel: has joined #ruby
[16:44:14] opentux: has joined #ruby
[16:44:29] Yzguy: has joined #ruby
[16:45:50] `tim`: has joined #ruby
[16:48:23] Azure: has joined #ruby
[16:49:35] giz|work: has joined #ruby
[16:50:30] moeabdol: has joined #ruby
[16:50:31] Devalo: has joined #ruby
[16:55:30] rocfig: has joined #ruby
[16:55:35] bonhoeffer: has joined #ruby
[16:55:59] madgen: has joined #ruby
[16:56:10] bonhoeffer: i have 19 lines of data -- i can do comma separated -- i tried to use a heredoc, but that is painful -- how should i load the variable
[16:56:23] bonhoeffer: i suppose i could use csvread or similar
[16:56:41] bonhoeffer: but think this should be really simple -- i could also save as a json
[16:56:57] mistermocha: has joined #ruby
[16:58:00] IrishGringo: has joined #ruby
[16:58:13] patie: has joined #ruby
[17:00:21] jancel: has joined #ruby
[17:00:57] bonhoeffer: got it working -- just used ruby array syntax
[17:01:29] sdothum: has joined #ruby
[17:03:11] colegatron: has joined #ruby
[17:03:42] crystal77: has joined #ruby
[17:04:06] jenrzzz: has joined #ruby
[17:04:06] jenrzzz: has joined #ruby
[17:07:19] jancel: has joined #ruby
[17:08:15] houhoulis: has joined #ruby
[17:08:43] Cohedrin: has joined #ruby
[17:10:19] chip_: has joined #ruby
[17:12:19] nhhc: has joined #ruby
[17:13:29] xall: has joined #ruby
[17:18:04] colegatron_origi: has joined #ruby
[17:18:50] sarlalian: has joined #ruby
[17:21:48] sdothum: has joined #ruby
[17:22:10] Guest53755: has joined #ruby
[17:22:42] madgen: has joined #ruby
[17:24:31] mic_e: has joined #ruby
[17:25:04] tmtwd: has joined #ruby
[17:25:25] firstdayonthejob: has joined #ruby
[17:26:08] allcentury: has joined #ruby
[17:28:48] jgt1: has joined #ruby
[17:28:59] jaguarmagenta: has joined #ruby
[17:31:51] Es0teric: has joined #ruby
[17:33:10] Yiota: has joined #ruby
[17:33:20] Elvin: has joined #ruby
[17:33:30] Rasmusolle: has joined #ruby
[17:35:55] yodeler: has joined #ruby
[17:37:00] idefine: has joined #ruby
[17:37:04] nankyokusei: has joined #ruby
[17:37:33] Rasmusolle: http://tinyurl.com/jfcurn5
[17:38:21] Rasmusolle: has left #ruby: ("Leaving")
[17:38:40] apeiros: !spam Rasmusolle
[17:38:40] ruby[bot]: +bb Rasmusolle!*@*$#ruby-banned *!*@78-67-125-136-no247.tbcn.telia.com$#ruby-banned
[17:38:42] ruby[bot]: -b *!*@unaffiliated/lovich$#ruby-banned
[17:40:35] govg: has joined #ruby
[17:42:20] skade: has joined #ruby
[17:48:37] jancel: has joined #ruby
[17:52:11] isxek: has joined #ruby
[17:53:37] ravishankarjha: has joined #ruby
[17:58:47] Azure|dc: has joined #ruby
[18:00:10] zacts: morning #ruby
[18:00:39] sinkensabe: has joined #ruby
[18:01:22] karmatr0n: has joined #ruby
[18:03:27] apeiros: moin zacts
[18:03:32] apeiros: ?ugt |2701
[18:03:32] ruby[bot]: |2701: it's morning, see http://www.total-knowledge.com/~ilya/mips/ugt.html
[18:03:47] |2701: that's cringy
[18:04:17] Yiota: has joined #ruby
[18:04:25] apeiros: less so than "20:00 |2701: its 2pm"
[18:05:12] mic_e: has joined #ruby
[18:06:00] giz|work: has joined #ruby
[18:06:17] tildes: has joined #ruby
[18:06:58] agriffis: has joined #ruby
[18:10:15] agriffis: has left #ruby: ("WeeChat 1.4")
[18:10:43] valkyr1e: has joined #ruby
[18:10:58] Devalo: has joined #ruby
[18:11:59] flughafen_: has joined #ruby
[18:12:42] rbennacer: has joined #ruby
[18:14:38] iamvery: has joined #ruby
[18:17:40] GregUK: has joined #ruby
[18:18:42] crystal77: has joined #ruby
[18:19:34] Dimik: has joined #ruby
[18:20:32] symm-: has joined #ruby
[18:22:54] GregUK: has joined #ruby
[18:23:48] cooldavid: has joined #ruby
[18:24:57] bronson: has joined #ruby
[18:26:07] cooldavid: what are your thoughts on elixir?
[18:26:32] rbennacer: has joined #ruby
[18:28:59] shevy: cures diseases
[18:30:10] pwnd_nsfw: has joined #ruby
[18:32:39] zacts: moin apeiros
[18:32:43] zacts: Is your nick greek?
[18:32:46] zacts: I like it
[18:32:50] jancel: has joined #ruby
[18:32:55] apeiros: yes, it is
[18:33:01] zacts: nice nice
[18:33:20] zacts: ACTION is learning ancient (attic) greek right now... slowly, but surely
[18:33:32] zacts: anyway I'm almost done with Head First Ruby
[18:33:37] zacts: I'll be done either tonight or tomorrow
[18:33:41] zacts: and next is poodr
[18:34:43] shevy: good old poodles
[18:37:17] rbennacer: has joined #ruby
[18:37:46] AlexRussia: has joined #ruby
[18:37:47] |2701: poodr is really great
[18:39:12] Apelsin: has joined #ruby
[18:40:12] IrishGringo: has joined #ruby
[18:40:26] edwinvdgraaf: has joined #ruby
[18:42:06] codeurge: has joined #ruby
[18:42:22] Apelsin: So, I've read the guide for good questions a bit, and realize that this doesn't quite fall under those categories but eh...
[18:42:33] dumdedum: has joined #ruby
[18:42:49] edwinvdgraaf: has joined #ruby
[18:42:56] bluOxigen: has joined #ruby
[18:43:11] Apelsin: So, I'm trying to learn Ruby on codeacademy and I've gotten to the part where they talk about yield. I've read their stuff and some other sites, but I got problems wrapping my head around what it's good for/why to use it. Anyone got any good examples?
[18:43:26] Apelsin: ..too long string?
[18:43:31] apeiros: Apelsin: tons of strategy patterns
[18:43:35] Apelsin: oh nvm the last part
[18:43:41] apeiros: example: people.sort_by { |person| person.first_name }
[18:44:03] apeiros: people.sort { |person1, person2| person1.age <=> person2.age }
[18:44:15] apeiros: first_names = people.map { |person| person.first_name }
[18:44:24] apeiros: or callbacks:
[18:44:34] rbennacer: has joined #ruby
[18:44:41] apeiros: every(5.minutes) do puts "another five minutes of your life are forever gone!" end
[18:44:50] apeiros: there's plenty more
[18:44:57] apeiros: blocks are omnipresent in ruby
[18:44:59] Apelsin: but there are others things than yield that gives the same results no?
[18:45:10] Apelsin: and to me blocks and methods are kind of the same thing
[18:45:14] startupality: has joined #ruby
[18:45:15] Apelsin: which might be why I'm confused
[18:45:19] GodFather: has joined #ruby
[18:45:19] apeiros: yes @ other things
[18:45:30] apeiros: no @ blocks and methods being the same thing. they're similar.
[18:45:53] apeiros: methods belong to an object (self, within the method definition), blocks do not.
[18:46:10] apeiros: blocks also capture the surrounding lexical context, methods do not
[18:46:29] apeiros: >> a = 1; def foo; yield; end; foo { a += 1 }; a
[18:46:30] ruby[bot]: apeiros: # => 2 (https://eval.in/571845)
[18:46:46] apeiros: a method could not access the local variable "a"
[18:47:02] Apelsin: that makes sense
[18:47:43] Apelsin: Thanks for your patience with me
[18:47:50] apeiros: yield is a convenience. you could achieve the same goal differently. and with current ruby version even without much more code. e.g. via lambdas:
[18:48:13] apeiros: people.mySort(->(person1, person2) { person1.age <=> person2.age })
[18:48:51] apeiros: ugh, doing JS at the moment has a bad influence. pretend I wrote "my_sort", not "mySort"
[18:49:02] Apelsin: Haha, No worries
[18:49:06] Apelsin: Thanks for the help :)
[18:49:19] Apelsin: I guess it will also help sitting with it more than just reading about it once/twice haha
[18:49:51] Apelsin: just another fast, and this time dumb question. On codeacademy I don't have to write the ;'s after things, but I noticed that you did. Is it depending on the editor/compiler?
[18:50:14] apeiros: ; is (almost) the same as a newline to ruby
[18:50:16] Apelsin: (cause CA accepts ;'s without complaining, but their example code doesn't use it)
[18:50:31] apeiros: so we use it in irc to write multiple lines in a single line while still having valid ruby
[18:50:42] Apelsin: Aah, I see
[18:50:43] apeiros: you can read ";" as "replace with a newline here"
[18:51:15] Apelsin: Thanks alot!
[18:51:34] xall: has joined #ruby
[18:52:34] bobbycvi: has joined #ruby
[18:53:13] JammyHammy: has joined #ruby
[18:53:20] LoneHermit: has joined #ruby
[18:54:05] marr: has joined #ruby
[18:57:24] GodFather: has joined #ruby
[18:57:43] firstdayonthejob: has joined #ruby
[18:58:33] eliand: has joined #ruby
[18:58:54] flashpoint9: has joined #ruby
[19:00:35] last_staff: has joined #ruby
[19:00:40] brunto: has joined #ruby
[19:00:44] czerasz: has joined #ruby
[19:02:35] GodFather: has joined #ruby
[19:02:39] qasaur: has joined #ruby
[19:03:16] y3: has joined #ruby
[19:04:09] vipaca: has joined #ruby
[19:04:19] Xaitec: has joined #ruby
[19:05:30] codecop: has joined #ruby
[19:05:34] jenrzzz: has joined #ruby
[19:05:35] jenrzzz: has joined #ruby
[19:09:09] karmatr0n: has joined #ruby
[19:09:54] duncannz: has joined #ruby
[19:10:39] Elvin_: has joined #ruby
[19:17:34] e4xit: has joined #ruby
[19:19:42] eliand: has left #ruby: ("Leaving")
[19:21:34] sesquipedalian: has joined #ruby
[19:22:51] futilegames: has joined #ruby
[19:23:33] GodFather: has joined #ruby
[19:24:42] yfeldblum: has joined #ruby
[19:24:49] snath: has joined #ruby
[19:25:13] snath: has left #ruby: ()
[19:27:44] GodFather: has joined #ruby
[19:30:25] mistermocha: has joined #ruby
[19:32:30] GodFather: has joined #ruby
[19:33:06] claw: hey channel
[19:33:31] claw: i have a gzip function to compress a string http://paste.debian.net/684056/
[19:34:01] claw: the result of gzip(data).valid_encoding? is false
[19:34:24] apeiros: you should set its encoding to binary
[19:35:59] claw: apeiros: i want to store the result on a remote server using net-sftp
[19:36:05] GodFather: has joined #ruby
[19:36:45] pwnd_nsfw: has joined #ruby
[19:37:12] apeiros: was that supposed to be a question?
[19:37:35] nankyokusei: has joined #ruby
[19:37:48] GodFather: has joined #ruby
[19:38:29] jackjackdripper: has joined #ruby
[19:38:36] claw: apeiros: should i just use .encode("binary") on the result to encode it ?
[19:39:17] jhass: actually I'd be surprised if StringIO doesn't use that as a default encoding already
[19:39:20] apeiros: no. encode() tries to translate from the current encoding to the target encoding. but your data already is binary. you can't (and hence shouldn't) translate it.
[19:39:36] apeiros: jhass: uses utf-8 here
[19:39:39] apeiros: not sure based on what
[19:39:53] apeiros: probably depends on the ruby version too
[19:40:03] apeiros: but in the newest, I'd assume that's the default
[19:40:15] apeiros: claw: set the encoding when you create the StringIO
[19:40:37] claw: io.string.encoding => "UTF-8"
[19:41:44] apeiros: btw., your code is broken anyway. String.new("wb") does not do what you think it does.
[19:41:53] apeiros: >> StringIO.new("wb").string # surprise
[19:41:54] ruby[bot]: apeiros: # => "wb" (https://eval.in/571895)
[19:42:20] apeiros: interestingly enough you're already the second person within around a week making this mistake.
[19:43:31] apeiros: also seems even when properly using new's arguments, wb won't set the encoding to binary. you'll have to initialize it with an empty binary string.
[19:43:42] roamingdog: has joined #ruby
[19:44:46] claw: http://paste.debian.net/684067/ that worked
[19:44:49] claw: thank you apeiros
[19:44:50] GodFather: has joined #ruby
[19:44:59] claw: added io.set_encoding("binary")
[19:45:12] apeiros: you didn't read the part about your code being broken, did you? you should :-p
[19:45:29] apeiros: your code is still broken the very same way.
[19:45:51] apeiros: StringIO.new("w") still does not do what you think it does.
[19:46:13] startupality: has joined #ruby
[19:46:44] apeiros: though, probably you're lucky, because by default, writing to that StringIO will start at position 0 and thus override your "w"
[19:47:08] claw: the results where fine but i understand now what you mean
[19:47:10] knaesig: has joined #ruby
[19:47:17] claw: i does not set mode
[19:47:23] apeiros: so… broken and wrong, but happens to work correctly by coincidence.
[19:47:37] claw: i grabbed that from *somewhere*
[19:47:44] apeiros: just replace line 2 & 3 by: io = StringIO.new("".b)
[19:47:59] claw: http://code-dojo.blogspot.de/2012/10/gzip-compressiondecompression-in-ruby.html
[19:48:11] jaguarmagenta: has joined #ruby
[19:48:52] apeiros: do me a favor and leave a comment, hinting a) at the wrong idea about StringIO.new("w") and how to do it properly in current ruby
[19:49:07] GodFather: has joined #ruby
[19:50:18] Xeago_: has joined #ruby
[19:50:38] raeoks: has joined #ruby
[19:51:00] agent_white: has joined #ruby
[19:51:50] LoneHerm_: has joined #ruby
[19:53:31] GodFather: has joined #ruby
[19:56:58] Elvin: has joined #ruby
[19:57:29] GodFather: has joined #ruby
[19:58:40] aries_liuxueyang: has joined #ruby
[20:01:29] skade: has joined #ruby
[20:01:55] LoneHerm_: has joined #ruby
[20:02:38] GodFather: has joined #ruby
[20:03:12] ule: anyone from Philadelphia?
[20:04:44] roamingdog: has joined #ruby
[20:05:24] symm-: has joined #ruby
[20:07:07] jenrzzz: has joined #ruby
[20:07:15] lubekpl: has joined #ruby
[20:07:17] y3: has joined #ruby
[20:08:02] idefine: has joined #ruby
[20:09:56] bruno-: has joined #ruby
[20:11:41] roamingdog: has joined #ruby
[20:12:57] Oog: has joined #ruby
[20:13:11] Oog: https://gist.github.com/anonymous/0fa62e0507cbbb9ae3fa37bb90aaefc3 - so weird the return not only returns out of boo but all the way out of foo?!
[20:13:18] Devalo: has joined #ruby
[20:13:23] Oog: when i call boo - hiiiiiiiii is not printed...?!
[20:14:18] stannard: has joined #ruby
[20:15:16] apeiros: return does not return control to the yielding method
[20:15:28] Rixius: has joined #ruby
[20:15:35] apeiros: it returns from the method within which the return statement is lexically located
[20:15:56] apeiros: (which actually means that you'll get a LocalJump error if you defer execution of the passed block)
[20:16:12] apeiros: use `next` if you want to return control to the yielding method
[20:16:24] apeiros: use `break` if you want to return from the yielding method
[20:17:24] mooe: has joined #ruby
[20:18:50] bazzy: simplest way to take a params hash and send it as a POST to a URL?
[20:19:05] idefine: has joined #ruby
[20:20:27] bazzy: ACTION learns about Net::HTTP
[20:20:38] nankyokusei: has joined #ruby
[20:22:11] apeiros: bazzy: maybe httparty
[20:22:14] govg: has joined #ruby
[20:23:43] dreinull: has joined #ruby
[20:23:58] pawnbox: has joined #ruby
[20:24:08] bazzy: apeiros, I got it done with Net::HTTP already ^_^
[20:24:14] dreinull: is there a better "Enumerable#all" than map{|e|e}?
[20:24:44] adaedra: What is it you're trying to do?
[20:24:47] bruno-: has joined #ruby
[20:25:14] idefine: has joined #ruby
[20:25:22] postmodern: has joined #ruby
[20:25:22] adaedra: moin apeiros
[20:25:27] apeiros: moin adaedra
[20:25:33] dreinull: I have included enumerable to one of my classes and would like to return itself as an array
[20:25:40] ljames: has joined #ruby
[20:25:49] apeiros: to_a then indeed.
[20:26:35] jancel: has joined #ruby
[20:26:40] dreinull: #all is more intuitive
[20:26:47] dreinull: but to_a i totally forgot.
[20:26:53] bronson: has joined #ruby
[20:27:01] apeiros: #all is rails
[20:27:04] dreinull: sequel user.
[20:27:12] apeiros: to_a is standard for anything ruby
[20:27:17] dreinull: sorry, no rails.
[20:27:33] apeiros: and #all there (and I'm pretty sure in sequel too) return a relation
[20:27:35] apeiros: not an array
[20:27:39] apeiros: so you're doubly mistaken
[20:27:55] dreinull: apeiros, no, all returns an array
[20:29:10] dreinull: http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-all
[20:29:11] apeiros: poor choice by jeremy then IMO.
[20:29:42] adaedra: well, I'd disagree on this one, but this is not really the subject
[20:29:44] dreinull: rails is not ruby afaik
[20:30:25] dreinull: anyway, to_a will do for now
[20:30:48] dreinull: no, I'm having lots of fun without ever touching or knowing rails
[20:30:50] Masonn: has joined #ruby
[20:31:15] Masonn: has joined #ruby
[20:31:27] apeiros: dreinull: well, same thing for sequel - sequel isn't ruby
[20:31:46] apeiros: (in that sense of "isn't")
[20:31:58] dreinull: of course not. Also, I'm not into flame wars.
[20:32:25] dreinull: Not worth it
[20:32:39] hightower2: has joined #ruby
[20:32:58] ur5us: has joined #ruby
[20:33:40] hightower2: Hey, where does Ruby hold the last syscall error? (Like $! in Perl)
[20:35:03] apeiros: though, the last exception, not just syscall error
[20:35:45] hightower2: apeiros, well, in irb, I run something which results in an error, like Dir.rmdir('/etc'), and I get Errno::EACCES: Permission denied. But printing $! immediately afterwards tells me $! is nil.
[20:36:00] idefine_: has joined #ruby
[20:36:28] apeiros: probably ruby cleans $! up after the `end` of the surrounding begin/rescue.
[20:36:50] apeiros: so I think you'll have to begin/rescue/end wrap the expression yourself
[20:37:41] arlek: has joined #ruby
[20:38:00] hightower2: apeiros, oh indeed. Works, thanks.
[20:38:19] adaedra: you can try adding `rescue $!` in irb to have it as a return I guess.
[20:39:14] adaedra: that's not a pretty pattern to use in code, but I guess it's ok for one-time-use in irb/pry.
[20:39:40] idefine: has joined #ruby
[20:41:07] apeiros: adaedra: nice
[20:41:44] hightower2: apeiros, though still I don't seem to be able to get syscall errors. E.g., if I call Dir.exist?( dir), that doesn't trigger an exception but I'd still like to read out the syscall error (like, was it a not found, or it was found but it was a file and not a dir)
[20:42:06] adaedra: let's try.
[20:42:11] `derpy: http://ruby-doc.org/core-2.3.0/SystemCallError.html#method-i-errno
[20:42:56] rbennacer: has joined #ruby
[20:43:44] adaedra: It does raise an exception here
[20:45:04] adaedra: https://gist.github.com/adaedra/8233dd6afa4f34ae5f4d9c02a43f4567
[20:45:32] whiteline: has joined #ruby
[20:45:50] adaedra: Ah, exist?, duh.
[20:46:26] adaedra: Not sure there's a system error here
[20:46:27] smathy: has joined #ruby
[20:46:37] apeiros: I think if you want to do it in a single syscall, File.stat is the only option.
[20:47:05] apeiros: otherwise there's File.directory?, File.file? etc.
[20:47:16] RegulationD: has joined #ruby
[20:47:30] bluOxigen: has joined #ruby
[20:48:02] jcomito: has joined #ruby
[20:48:03] ruby-lang385: has joined #ruby
[20:48:20] adaedra: Dir#exist? could be implemented with a stat(2) and not have a syscall error at all.
[20:51:09] auxbuss: has joined #ruby
[20:51:18] eam: you definitely want stat()
[20:51:28] bazzy: How can I set the http_referer in a Net::HTTP post request?
[20:51:43] blackmesa: has joined #ruby
[20:51:50] bazzy: I am using Net::HTTP.post_form(uri, params)
[20:55:15] pawnbox: has joined #ruby
[20:55:20] agent_white: bazzy: Checkout the documentation, there's a section titled "Setting Headers"
[20:55:59] roamingdog: has joined #ruby
[20:56:05] aeterne: has joined #ruby
[20:56:05] bazzy: agent_white, what confuses me is it seems like people are putting the 'Referer' => "http://example.com" into where I have my params .. but doing that isn't solving my issue
[20:56:12] yqt: has joined #ruby
[20:56:24] agent_white: bazzy: What's the issue?
[20:57:25] bazzy: I am testing a webhook that uses the http refer to create new data .. when I test from localhost, the referer is blank .. (using sinatra to receive the post requests) .. I'd like to spoof the referer so I can test locally, ideally without modifying the server code
[20:58:32] kaleido: sinatra is based on rack. cant you look at req.referer?
[20:59:03] bazzy: well I look at request.referer (must be a sinatra wrapper) .. as stated it's blank when testing from localhost
[20:59:04] Gasher: has joined #ruby
[20:59:10] malcolmva: has joined #ruby
[20:59:40] kaleido: request.env['REMOTE_ADDR'] also might do the trick
[20:59:43] bazzy: it populates fine when sending the POST from the production site
[21:00:25] aaa__: has joined #ruby
[21:00:59] startupality: has joined #ruby
[21:01:55] bluOxigen: has joined #ruby
[21:02:04] kaleido: id be stumped to i spose. i would have thought request.referer would have done it :/
[21:02:31] bazzy: it looks like I'm improperly passing the referer as params and not properly as a header
[21:02:55] bazzy: I'll try converting the GET request with header settings to a Post and see what happens .. although I'm not sure where to put my params in that example code
[21:03:03] idefine: has joined #ruby
[21:03:05] bazzy: http://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Setting+Headers
[21:03:22] koxu: has joined #ruby
[21:03:36] apeiros: bazzy: check out the post_form code
[21:03:55] apeiros: should not be too hard to add the header-setting piece of code from your above link
[21:04:18] bazzy: I already use post_form .. ^.^ but uh .. the context is way different from those examples for header-setting (new blocks and such)
[21:05:01] bazzy: post_form doesn't seem to take header parameters either :\ that's why I'm in this predicament
[21:05:18] apeiros: yes. I know. and you want to add a header. which is why I suggest you use the post_form code to start from.
[21:05:32] bazzy: It's not clear enough to me
[21:05:53] bazzy: I already am starting from post_form lol
[21:06:34] auxbuss: has joined #ruby
[21:06:35] bazzy: I think I'll take some time on my own to try to handle this.. Thanks for your help
[21:07:02] rickmasta: has joined #ruby
[21:07:28] jenrzzz: has joined #ruby
[21:07:35] startupality: has joined #ruby
[21:07:43] chouhoulis: has joined #ruby
[21:09:02] bazzy: ok .. converting the header example code from a Get to a POST. with the 'Referer' => 'http://example.com' got the referer variable to be set appropriately .. now I just need to find out how to get my params into the request
[21:10:55] tildes: has joined #ruby
[21:11:21] rbennacer: has joined #ruby
[21:11:31] bazzy: apeiros, I understand you now - you want me to look at the definition of post_form so I can use its impl code possibly -- least that's what I'm headed to do
[21:12:18] rbennacer: has joined #ruby
[21:12:32] bazzy: I've got it! req.form_data = params let me try it :D
[21:13:11] bazzy: YES it works!~
[21:13:20] kaleido: rack makes it so easy
[21:13:36] kaleido: well, easier
[21:13:48] kaleido: i still fight with the same kinds of things
[21:13:53] bazzy: I've never used it x_X
[21:14:04] bazzy: apeiros, I got it working :D ^
[21:14:15] bazzy: thanks :D
[21:21:31] stannard: has joined #ruby
[21:22:01] mtkd: has joined #ruby
[21:22:49] shevy: until a bug hits!
[21:25:25] GodFather: has joined #ruby
[21:25:34] Yzguy: has joined #ruby
[21:26:11] aryaching: has joined #ruby
[21:27:24] vdamewood: has joined #ruby
[21:27:36] JoshGlzBrk: has joined #ruby
[21:33:50] jackjackdripper: has joined #ruby
[21:37:15] SilverKey: has joined #ruby
[21:39:22] mdw: has joined #ruby
[21:41:46] y3: has joined #ruby
[21:42:43] sneakerhax: has joined #ruby
[21:44:24] MyMind: has joined #ruby
[21:48:56] jaguarmagenta: has joined #ruby
[21:52:05] minimalism: has joined #ruby
[21:54:04] |ifei5g00d: has joined #ruby
[21:55:14] mic_e: has joined #ruby
[21:57:12] Es0teric: has joined #ruby
[22:01:38] chrisja: has joined #ruby
[22:02:51] roamingdog: has joined #ruby
[22:03:00] wigust: has joined #ruby
[22:03:01] RegulationD: has joined #ruby
[22:06:14] rbennacer: has joined #ruby
[22:08:16] ljames: has joined #ruby
[22:08:51] jenrzzz: has joined #ruby
[22:08:53] jenrzzz: has joined #ruby
[22:13:57] Cohedrin_: has joined #ruby
[22:14:44] Devalo: has joined #ruby
[22:15:26] jancel: has joined #ruby
[22:15:35] moeabdol: has joined #ruby
[22:19:54] j_mcnally: has joined #ruby
[22:19:54] bruno-: has joined #ruby
[22:21:14] skolman_: has joined #ruby
[22:21:31] Nawn: has joined #ruby
[22:23:36] idefine: has joined #ruby
[22:23:36] y3: has joined #ruby
[22:26:15] yfeldblum: has joined #ruby
[22:28:19] roshanavand: has joined #ruby
[22:28:48] hakunin: has joined #ruby
[22:29:48] bronson: has joined #ruby
[22:30:10] hakunin: Hm, the `lazy` doesn't seem to work here… 1.step(by: 0.01).lazy.each_cons(2){|a,b| puts [a,b].inspect}.take(3)
[22:30:14] hakunin: bug in 2.3.0?
[22:32:37] apeiros: you want enum_for there
[22:32:41] dionysus69: has joined #ruby
[22:36:32] zenlot6: has joined #ruby
[22:36:50] idefine: has joined #ruby
[22:38:29] banister: has joined #ruby
[22:38:41] diegoaguilar: has joined #ruby
[22:40:52] skolman_: has joined #ruby
[22:41:08] xall: has joined #ruby
[22:47:45] stardiviner: has joined #ruby
[22:49:52] CloCkWeRX: has joined #ruby
[22:50:33] elifoster: has joined #ruby
[22:52:21] twistedpixels_: has joined #ruby
[22:52:21] twistedpixels_: has joined #ruby
[22:57:39] hightower3: has joined #ruby
[22:58:57] govg: has joined #ruby
[22:59:58] joneshf-laptop: has joined #ruby
[23:00:11] twistedpixels: has joined #ruby
[23:00:12] twistedpixels: has joined #ruby
[23:00:42] Kallis: has joined #ruby
[23:01:26] idefine: has joined #ruby
[23:03:10] |2701: has joined #ruby
[23:05:35] bodgix: has left #ruby: ()
[23:06:41] idefine: has joined #ruby
[23:06:45] agent_white: has joined #ruby
[23:07:11] Kallis: has joined #ruby
[23:08:52] aeterne: has joined #ruby
[23:10:04] halfamind: has joined #ruby
[23:12:15] Guest43: has joined #ruby
[23:13:13] moeabdol: has joined #ruby
[23:13:29] Guest43: has joined #ruby
[23:13:47] jaguarmagenta: has joined #ruby
[23:14:28] idefine: has joined #ruby
[23:14:41] idefine: has joined #ruby
[23:14:55] pawnbox: has joined #ruby
[23:15:52] chip_: has joined #ruby
[23:19:55] jgt1: has joined #ruby
[23:19:57] freija: has joined #ruby
[23:20:30] quazimod1: has joined #ruby
[23:21:19] startupality: has joined #ruby
[23:26:04] symm-: has joined #ruby
[23:26:55] chopin: has joined #ruby
[23:27:48] d5sx43: has joined #ruby
[23:28:00] govg: has joined #ruby
[23:28:02] startupality: has joined #ruby
[23:31:35] Madplatypus: has joined #ruby
[23:35:47] pawnbox: has joined #ruby
[23:36:11] d0nn1e: has joined #ruby
[23:37:00] chip_: has joined #ruby
[23:39:15] nankyokusei: has joined #ruby
[23:40:28] gregf: has joined #ruby
[23:42:49] mynameisbrian: has joined #ruby
[23:43:39] govg: has joined #ruby
[23:43:53] mynameisbrian: Hey guys. I'm confused about what a block is exactly. is do ... end always a block? I see a lot of resources differentiating lambda's and blocks, but I can do this: l = lambda do | num | num * 2 end
[23:44:54] apeiros: not always. but almost always. `while cond do; end` is not a block f.ex., but it's a rare exception
[23:45:12] apeiros: your example: yes, that is a block. passed to the Kernel#lambda method, which returns a Proc instance.
[23:45:21] PlasmaStar: has joined #ruby
[23:45:24] mynameisbrian: so what makes it a block?
[23:46:10] apeiros: the do/end, and being passed to a method as block argument.
[23:46:26] mynameisbrian: so in my example, it's both a block and a lambda?
[23:46:27] apeiros: in the exceptions (like with while), it's not passed to a method (while is syntax)
[23:47:03] apeiros: no. it's just a block. passed as an argument to lambda. that expression creates your lambda. which is, as said before, a Proc instance.
[23:47:17] apeiros: >> x = lambda {}; [x.class, x.lambda?]
[23:47:18] ruby[bot]: apeiros: # => [Proc, true] (https://eval.in/571921)
[23:47:58] mynameisbrian: okay, I understand now, thanks.
[23:48:27] eljimmy: has joined #ruby
[23:48:51] bazzy: I sometimes move a function into a separate module and have it as a module function .. this is just to organize the code .. is that behavior OK? I was also wondering if it matters using module self methods vs. class self methods for this purpose
[23:49:11] govg: has joined #ruby
[23:49:12] mynameisbrian: I get confused with the arguments. the fact we're passing do and end. I was seeing it as an entire construct
[23:49:17] shevy: bazzy yeah I think module FileUtils is one big module_function
[23:50:36] apeiros: I'd usually say "it's methods, not functions", but in this case they might actually be functions :)
[23:50:43] shevy: https://gist.github.com/shevegen/4d9b58e4ab1a0adb0d459bf7760ff663#file-fileutils-rb-L106
[23:50:58] apeiros: bazzy: do those functions of yours reference self in any way? e.g. via self itself, or via an @ivar?
[23:51:06] shevy: funny code though
[23:51:20] shevy: module_function :pwd; alias getwd pwd; module_function :getwd
[23:52:13] shevy: dir == '/' ? dir : dir.chomp(?/)
[23:52:15] bazzy: oh no, there's a difference between functions and methods in Ruby.. heh (I come from C/CPP background) .. I think I meant methods, as in `def method_name`
[23:52:27] apeiros: bazzy: there aren't really functions in ruby
[23:52:33] koooge: has joined #ruby
[23:53:01] apeiros: but some methods are used like functions
[23:53:33] bazzy: I don't note a difference, but it's besides the point. No, in this particular case, I'm not referencing self, I'm only operating on the arguments and returning new data
[23:53:52] bazzy: sometimes I may want to call one of the other "static" functions in the module
[23:54:35] apeiros: ok, in that case the proper way to do it is indeed to put them into a module, define them as instance methods, and use module_function
[23:55:14] apeiros: that does the right thing for you. one being to allow you to use the method as YourModule.some_func, and additionally by include YourModule; some_func
[23:55:40] apeiros: see e.g. Math module from core
[23:55:44] bazzy: this is my first time hearing of module_function .. my situation gets a little hairier.. let
[23:55:58] bazzy: let's say I have 3 modules .. and I want them to share some parent functions
[23:56:07] bazzy: I guess I need to make a "parent module" for all of them
[23:56:18] apeiros: a method: called on a receiver. thus belongs to an object and has a self, can access @ivars from the object it's called upon.
[23:56:23] bazzy: and then to call the parent "shared" functions.. use ParentModuleName.func
[23:56:34] apeiros: a function: does not have a receiver, has no self, therefore no access to @ivars either
[23:57:04] apeiros: since ruby allows methods to be called without explicit receiver, we can pretend to have functions. though they're really methods and called on self.
[23:57:22] bazzy: I think I may have to make a gist and ask for approval or improvement points
[23:57:36] apeiros: sure. code review is a great way to get more idiomatic ruby code.
[23:57:56] Cohedrin: has joined #ruby
[23:58:44] stardiviner: has joined #ruby