« Back to channel list

#ruby - 15 November 2018

« Back 1 day Forward 1 day »
[00:00:05] sputnik13: I'm assuming the latter, i.e. I can store the https instance as a member variable and reuse it
[00:00:20] sputnik13: but again, not terribly familiar with ruby so :(
[00:00:32] al2o3-cr: sputnik13: sure, it's just a socket underneath.
[00:01:14] Scriptonaut: hey all, I need help from some of you old ruby devs. I am working on an ancient ruby app, in 1.8.7. There is some kind of change that happened to strings in 1.9.3. I am using a library that was built for 2.4 or something relatively new, but when I run the code with the 1.8.7 interpreter, I get an encoding exception, specifically this: 'Exception encountered: undefined method `encoding' for "INFO VER RUBY
[00:01:20] Scriptonaut: 1.0.104b":String'
[00:01:37] Scriptonaut: could someone help me understand the encoding exceptions that happen from running this code through a 1.8.7 interpreter?
[00:01:58] Scriptonaut: this is the line that causes the exception: send_command "INFO VER RUBY #{@@VERSION}.#{@@BUILD}"
[00:02:48] Scriptonaut: here is the send_command method: https://gist.github.com/robins35/a2f6059fee2b4170ae626d7704b36ced
[00:04:44] ellcs: has joined #ruby
[00:06:20] al2o3-cr: Scriptonaut: it does say undefined method `encoding'. 1.8.7 doesn't have String#encoding.
[00:06:59] Scriptonaut: oh, it's because I'm calling if !command.encoding.ascii_compatible?
[00:07:20] Scriptonaut: I wonder if I can get rid of that check
[00:12:20] al2o3-cr: Scriptonaut: years back iconv wsa use for encoding.
[00:14:02] DigitallyBorn: has joined #ruby
[00:14:04] ansraliant: has joined #ruby
[00:16:00] al2o3-cr: command.encoding.name != 'UTF-8' is redundant in 1.8.7
[00:16:15] Scriptonaut: ya, I'm confused by this code, I'm not sure why encoding should matter at all. It seems to be using a string with class variables interpolated in it. Class variables that don't change, so it's essentially a string literal. Why would they need to check the encoding? Oh well, thanks for pointing me in the right direction
[00:17:18] al2o3-cr: 1.8.7 was bytes not encodes.
[00:21:55] nchambers: has joined #ruby
[00:22:05] Scriptonaut: sweet it's working now, thanks
[00:22:38] Radar: "I am working on an ancient ruby app, in 1.8.7" <- holy moly
[00:23:13] Radar: That belongs in a museum!
[00:23:34] Scriptonaut: I can't even put into words how messed up this app is
[00:23:41] Scriptonaut: you would all die inside if you saw it
[00:24:25] Radar: A tomb recently unearthed in Egypt has hieroglyphics that were only decoded this week: RUBY_VERSION == 1.8.7
[00:24:37] Radar: That is how old your app is 😂
[00:24:50] Scriptonaut: it's like the original dev gutted ruby on rails 2.0 (or possibly even older), and pulled those libraries into a few directories in the project. Then the backend server is handled by asp (not .NET, legacy asp), by sending the requests to a VM running windows 95
[00:24:51] Radar: Scriptonaut: It would be... educational!
[00:25:07] Scriptonaut: also there is Java and PHP on the backend
[00:25:24] Radar: Scriptonaut: You're getting paid for this, yeah?
[00:25:27] Scriptonaut: no idea how it works, it has two databases, a really nice postgresql db, and a microsoft SQL db (running on that windows 95 VM)
[00:25:42] Scriptonaut: ya, getting paid pretty well, otherwise I would have *not* agreed to this
[00:25:51] al2o3-cr: this gets worse!
[00:27:34] mroutis_: is there a better way to write this? >>> 'A..A..'.gsub(/A(\.+)A/) { |x| x.gsub('.', 'A') }
[00:28:50] Radar: Scriptonaut: Hearing stories like this makes me wonder at what it's going to be like in like 10 or 20 years time when the world has _even more_ legacy software. We have ways and means of assessing and repairing collapsing buildings, bridges / etc. But we don't seem to have a clear way of assessing software quality in the same way. Pieces don't fall off software, usually. So I wonder how we'll handle this into the future.
[00:28:55] Scriptonaut: why are you calling gsub twice on it mroutis_
[00:28:56] mroutis_: what I want is to convert the dots between two letters into the letter that wraps them, just if the letter is the same
[00:29:49] mroutis_: Scriptonaut: because I couldn't find the regex expression to do it on a single gsub :c
[00:29:52] Scriptonaut: oh, that's more complicated, I'm not sure
[00:30:21] mroutis_: also, another non-regex solution would be awesome
[00:30:26] Scriptonaut: I mean I'm sure it can be way worse, apparently there is *a lot* of COBOL code out there
[00:30:33] Scriptonaut: it used to be the number one business language
[00:30:55] nchambers: Radar: I'm sure people will still be supporting legacy COBOL codebases by then
[00:30:55] Scriptonaut: COBOL programmers are needed to maintain the gigantic legacy codebases, and a lot of them start at 1/4 million $ a year apparently
[00:31:02] Radar: &>> 'A..A..'.gsub(/A(\.+)A/) { |x| x.gsub('.', 'A') }
[00:31:04] rubydoc: # => "AAAA.." (https://carc.in/#/r/5iv4)
[00:31:40] mroutis_: thanks, Radar, I thought it was >>>
[00:32:05] Radar: mroutis_: usually >> but ruby[bot] is failing
[00:32:39] elcontrastador: has joined #ruby
[00:36:12] eckhardt_: has joined #ruby
[00:36:19] Radar: I can't think of a clean way to do that.
[00:36:38] Radar: A slightly shorter way is using tr
[00:36:42] Radar: &>> 'A..A..'.gsub(/A(\.+)A/) { |x| x.tr('.', 'A') }
[00:36:44] rubydoc: # => "AAAA.." (https://carc.in/#/r/5iv7)
[00:37:14] Scriptonaut: instead of using the first gsub I would probably just use a regexp
[00:37:21] Scriptonaut: and then based on the match data do something
[00:37:23] Scriptonaut: to make it a bit more clear
[00:37:29] Scriptonaut: the first gsub isn't really doing much
[00:37:52] Radar: What do you mean? It's doing everything. Without it, the replacement wouldn't happen
[00:38:18] Scriptonaut: the first gsub is more about detecting the patter
[00:38:27] Scriptonaut: then it passes it so the second gsub
[00:38:29] Radar: Yes, but then the block for that first gsub is replacing it
[00:38:33] Scriptonaut: and the actual replacement happens there
[00:38:45] Scriptonaut: but he hardcoded those 'A' in there
[00:38:53] Scriptonaut: if he needs to do that for any character, it will get more tricky
[00:39:00] Scriptonaut: because that gsub block only takes the outermost match
[00:41:22] jidar: is there a nice way of doing two arrays intersections but with include? rather then exact matches?
[00:41:55] Scriptonaut: I figured out a way to do it
[00:41:57] Scriptonaut: not sure if better
[00:42:00] Scriptonaut: but it will work on any letter
[00:42:24] mroutis_: Scriptonaut: any letter is fine!
[00:42:39] Scriptonaut: &>> 'A..A..'.gsub(/(\w)(\.+)(\w)/) { Regexp.last_match[0].gsub('.', Regexp.last_match[1]) }
[00:42:41] rubydoc: # => "AAAA.." (https://carc.in/#/r/5iv8)
[00:42:45] Scriptonaut: &>> 'B..B..'.gsub(/(\w)(\.+)(\w)/) { Regexp.last_match[0].gsub('.', Regexp.last_match[1]) }
[00:42:45] rubydoc: # => "BBBB.." (https://carc.in/#/r/5iv9)
[00:42:52] Scriptonaut: oh wait my solution isn't complete
[00:42:57] Scriptonaut: &>> 'A..B..'.gsub(/(\w)(\.+)(\w)/) { Regexp.last_match[0].gsub('.', Regexp.last_match[1]) }
[00:42:58] rubydoc: # => "AAAB.." (https://carc.in/#/r/5iva)
[00:44:40] Scriptonaut: ok I figured it out
[00:45:05] Scriptonaut: &>> 'A..A..'.gsub(/(\w)(\.+)(\w)/) { Regexp.last_match[1] == Regexp.last_match[3] ? Regexp.last_match[0].gsub('.', Regexp.last_match[1]) : Regexp.last_match[0] }
[00:45:05] rubydoc: # => "AAAA.." (https://carc.in/#/r/5ivb)
[00:45:08] mroutis_: Scriptonaut: you can use $1 instead of `Regexp.last_match`
[00:45:22] Scriptonaut: I knew there was an easier way haha
[00:47:26] DigitallyBorn: has joined #ruby
[00:48:46] al2o3-cr: mroutis_: $~
[00:48:56] AJA4350: has joined #ruby
[00:49:31] Scriptonaut: too bad there's no shorthand for Regexp.last_match[0]
[00:49:46] al2o3-cr: Scriptonaut: $~[0]
[00:50:08] al2o3-cr: mroutis_: i *see* what you mean.
[00:50:49] mroutis_: al2o3-cr: I tried, but it doesn't work as expected ($1, $2, you know)
[00:51:07] al2o3-cr: Scriptonaut: $~ if you want the matchdata object or $1 if the match string.
[00:51:45] Scriptonaut: &>> 'A..A..'.gsub(/(\w)(\.+)(\w)/) { $~[1] == $~[3] ? $~[0].gsub('.', $~[1]) : $~[0] }
[00:51:46] rubydoc: # => "AAAA.." (https://carc.in/#/r/5ivc)
[00:51:49] Scriptonaut: &>> 'Z..A..'.gsub(/(\w)(\.+)(\w)/) { $~[1] == $~[3] ? $~[0].gsub('.', $~[1]) : $~[0] }
[00:51:50] rubydoc: # => "Z..A.." (https://carc.in/#/r/5ivd)
[00:52:00] Scriptonaut: &>> 'Z..Z..A..A..'.gsub(/(\w)(\.+)(\w)/) { $~[1] == $~[3] ? $~[0].gsub('.', $~[1]) : $~[0] }
[00:52:01] rubydoc: # => "ZZZZ..AAAA.." (https://carc.in/#/r/5ive)
[00:52:07] Scriptonaut: thanks al2o3-cr
[00:52:10] Radar: ACTION finds a bucket
[00:52:16] Radar: Scriptonaut: Did you take this code from your 1.8.7 app?
[00:52:32] Scriptonaut: the regexp stuff?
[00:52:43] Radar: it's gross :P
[00:52:44] Scriptonaut: no I just typed it in my console, but it is running in 1.8.7
[00:52:53] Scriptonaut: it was pretty gross to begin with
[00:52:58] Scriptonaut: I would probably just write a method for this
[00:53:04] queip: has joined #ruby
[00:53:12] Radar: 'A..A..'.gsub(/A(\.+)A/) { |x| x.tr('.', 'A') } <- I like mine
[00:53:17] Radar: It's easy enough to read
[00:53:24] Scriptonaut: yours isn't the actual solution
[00:53:26] Scriptonaut: it only works with A
[00:53:37] Scriptonaut: it has to work with any character
[00:53:42] mroutis_: any letter ^
[00:56:48] Exuma: has joined #ruby
[00:57:31] venmx: has joined #ruby
[00:58:55] safetypin: has joined #ruby
[01:01:56] DigitallyBorn: has joined #ruby
[01:04:44] ivanskie: trying to write a script to download gist file. supply gist url (without the raw url).. it scans the page for raw url. then tries to download the raw file.
[01:05:05] ivanskie: now for some reason i cannot make it give me the contents. i don't understand
[01:05:06] sgen: has joined #ruby
[01:05:39] orbyt_: Why not just use the API?
[01:06:05] Radar: Scriptonaut: ohhhhh right
[01:06:46] ellcs: has joined #ruby
[01:07:56] ivanskie: can you get a gist without having an api key?
[01:08:30] ivanskie: i can already get the `raw_url` https://developer.github.com/v3/gists/#get-a-single-gist
[01:08:54] ivanskie: im using the download block from here https://github.com/piotrmurach/tty-file/blob/master/lib/tty/file/download_file.rb#L33-L53
[01:09:10] Radar: ivanskie: y u no use GitHub's gem?
[01:09:35] ivanskie: im writing this to include in my own gem.. i'm trying not to have too many pre-reqs.
[01:09:47] ivanskie: i guess i could..
[01:10:00] viaduct: has joined #ruby
[01:11:03] ivanskie: i do want to add a little bit of git and github automation later on...
[01:11:22] Radar: Well this will help with the gist thing :) Rugged is what I've been using for git automation myself.
[01:11:26] ivanskie: but why would it return an empty string
[01:14:54] al2o3-cr: ivanskie: so download method just returns a string (the response body)?
[01:21:27] al2o3-cr: i think they wanted File.open(foo, ?w) { |io| IO.copy_stream open(url), io }
[01:28:09] al2o3-cr: what host does this return? URI.parse "http://1.1.1.1&@8.8.4.4#@8.8.8.8/"
[01:28:36] al2o3-cr: &>> URI.parse("http://1.1.1.1&@8.8.4.4#@8.8.8.8/").host
[01:28:37] rubydoc: # => "8.8.4.4" (https://carc.in/#/r/5ivn)
[01:31:49] al2o3-cr: that is borked.
[01:38:15] mroutis: has joined #ruby
[01:51:25] cmhobbs: has joined #ruby
[01:52:37] queip: has joined #ruby
[01:52:42] cmhobbs: is there any sane way to put restrictions on Kernel#eval? at the moment, i've got a user providing a string containing boolean logic that looks something like "A && (B || C)" and i pass that to eval after some munging. i check to see if the string has && or || in it and won't run it if it doesn't but that still leaves room for abuse
[01:52:45] cmhobbs: any ideas?
[01:52:53] cmhobbs: i trust the user and they have to be behind several layers of security to use this
[01:52:55] cmhobbs: but it makes me nervous
[01:53:14] cmhobbs: one could still do something like "some_nasty_method || some_nasty_method"
[01:55:31] sgen: has joined #ruby
[02:08:16] al2o3-cr: cmhobbs: could you not use $SAFE = 1?
[02:08:27] al2o3-cr: or in a binding.
[02:11:46] cthulchu: folks, how do I connect my nginx to ruby backend if I don't wanna use a framework like rails?
[02:11:54] cthulchu: I also don't want to use CGI
[02:15:42] safetypin: has joined #ruby
[02:17:32] safetypin: has joined #ruby
[02:30:35] sgen: has joined #ruby
[02:36:42] white_lilies: has joined #ruby
[02:37:06] SCHAPiE: has joined #ruby
[02:40:56] TheDracle: has joined #ruby
[02:41:27] sgen_: has joined #ruby
[02:46:23] esrse: has joined #ruby
[02:47:07] roshanavand: has joined #ruby
[02:51:08] jidar: is there a nice way of doing two arrays intersections but with include? rather then exact matches?
[02:52:05] Radar: jidar: input and expected output please
[02:53:14] jidar: ["a1", "b1", "c1"] & ["a", "b"] # => ["a1", "b1"]
[02:54:05] Radar: jidar: I think zip + include would be your best bet:
[02:54:12] jidar: I'd like to write that somehow better than O(n^2) ie: ary1.each { ary2.each }
[02:54:17] queip: has joined #ruby
[02:54:21] Radar: sorry, zip + select
[02:54:41] Radar: &>> ["a1", "b1", "c1"].zip(["a", "b"]).select { |a, b| b && a.include?(b) }
[02:54:42] rubydoc: # => [["a1", "a"], ["b1", "b"]] (https://carc.in/#/r/5iwl)
[02:57:10] cmhobbs: al2o3-cr: $SAFE = 1 won't let me use require
[02:57:19] cmhobbs: so that's not going to fly
[02:57:58] al2o3-cr: cmhobbs: then use it in a binding.
[02:58:07] cmhobbs: cthulchu: do you just want to proxy requests from nginx to your ruby script or are you saying you want a framework different than rails?
[02:58:27] safetypin: has joined #ruby
[02:58:57] c0ncealed4: has joined #ruby
[02:59:15] cmhobbs: cthulchu: unicorn, puma, and raptor are all options for ruby webservers. you can proxy nginx to them. did you build your own webserver? i'm trying to understand the use case
[02:59:22] cmhobbs: al2o3-cr: i'll have to read up on that, thanks
[02:59:48] cthulchu: I don't want anything to do with web really
[02:59:49] al2o3-cr: cmhobbs: np, with ensure.
[02:59:54] cthulchu: nginx will do it for me
[03:01:03] cthulchu: all I want to do is to return a string to nginxz
[03:01:14] cthulchu: based on what nginx passed to me
[03:01:28] cmhobbs: you may still need a ruby webserver for that
[03:01:44] cmhobbs: if i understand it right, when nginx proxies a request, it hands off the full http request
[03:02:01] cmhobbs: you;d have to process that and hand back a response as well
[03:02:13] roshanavand: has joined #ruby
[03:02:19] tdy1: has joined #ruby
[03:02:28] cthulchu: interesting
[03:02:44] cmhobbs: unicorn is the least fancy of the three i mentioned
[03:02:45] cthulchu: maybe I could parse that request... manually...
[03:02:46] cmhobbs: check it out maybe
[03:02:46] cthulchu: as a string
[03:02:50] cmhobbs: https://bogomips.org/unicorn/
[03:03:58] cmhobbs: for nginx, look up the docs on proxy_pass
[03:04:21] cmhobbs: you'll want to set proxy_pass to the location of your local listening server (ruby script)
[03:04:27] cmhobbs: and then set some headers for it
[03:04:34] cmhobbs: with proxy_set_header
[03:04:52] cmhobbs: you still need to have something speaking tcp or using a socket to talk to nginx
[03:05:06] cthulchu: okaym, socket sounds fine
[03:05:17] cthulchu: but I will need something rubbyish to listen to it...
[03:05:23] cthulchu: so ruby should run all the time
[03:05:26] cmhobbs: unicorn or puma should do that for you
[03:05:29] cmhobbs: s/should/can
[03:05:39] cmhobbs: they're both rack middleware http servers
[03:05:50] cthulchu: well then I don't need nginx
[03:05:52] cmhobbs: and there's tons of examples of using proxy_pass to talk to them via port or socket
[03:06:02] cmhobbs: eh, technically no
[03:06:08] cmhobbs: but if you're going to have a lot of traffic, you'll want it
[03:06:15] cthulchu: nah, it's for internal use only
[03:06:19] cmhobbs: why use the web then?
[03:06:27] JankyDoodle: has joined #ruby
[03:06:33] cthulchu: I want to let anybody ability to the QA backend
[03:06:37] bmurt: has joined #ruby
[03:06:46] cthulchu: so that they could create and manipulate test accounts
[03:07:00] cmhobbs: thin is another option http://code.macournoyer.com/thin/
[03:07:14] cthulchu: mkay, gotta go. will look it up tomorrow, thanks
[03:13:37] eblip: has joined #ruby
[03:17:16] elphe: has joined #ruby
[03:28:15] akem: has joined #ruby
[03:39:30] jidar: Radar: I'm not sure that works quite the way it needs too, here is a working example (but in O(n^2)) : https://gist.github.com/a54397a044799a422f1ed0cfec918392
[03:40:16] jidar: at the end of the day, I'm simply trying to find a short hostname inside of a fqdn to see if they exist and then return that as an array
[03:41:52] jidar: I read over zip, I don't think that's doing what needs to be done imho
[03:42:31] darkhanb: has joined #ruby
[03:48:18] Freshnuts: has joined #ruby
[03:49:53] queip: has joined #ruby
[03:50:01] Freshnuts: has joined #ruby
[03:50:02] mroutis: has joined #ruby
[03:53:14] Freshnuts: has joined #ruby
[04:01:17] thejs: has joined #ruby
[04:08:56] braincrash: has joined #ruby
[04:29:12] ChatCodingLab: has joined #ruby
[04:30:11] ChatCodingLab: Hi! I've been using Ruby for almost 6 years... now got a project wanted to have cross platform GUI... I'm fascinated with the output from the WxWidget but seems WxRuby is not being updated
[04:30:31] ChatCodingLab: Is there any where I can get the library for the WxRuby up to date with WxWidget?
[04:30:49] al2o3-cr: ChatCodingLab: isn't that hanmac lib?
[04:31:32] al2o3-cr: the maintainer
[04:31:43] al2o3-cr: i might be wrong tho.
[04:32:58] ChatCodingLab: Oh hanmac if really that I'm interested to know...
[04:33:06] ChatCodingLab: Probably can maintain together
[04:33:12] ChatCodingLab: But no sure what's the state now
[04:33:49] al2o3-cr: ChatCodingLab: idk, but you might well hit him up.
[04:36:00] Iambchop: https://www.irccloud.com/pastebin/mFAU2Ggt
[04:36:01] ruby[bot]: Iambchop: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
[04:36:27] Iambchop: nodes.select{|n| n.sub(/\.*\Z/,'').match(hosts.to_s)}
[04:37:08] Iambchop: ["agent01.localdomain", "agent02.localdomain"]
[04:37:58] jidar: > /\.*\Z/
[04:38:00] jidar: ACTION groks
[04:38:29] jidar: no, that won't work either
[04:38:59] nchambers: what is \Z?
[04:39:17] marz_d`ghostman: has joined #ruby
[04:39:57] Iambchop: \Z end of whole string; $ end of any line
[04:39:57] marz_d`ghostman: https://gist.github.com/marzdgzmn/96b252c0d6c5b28271d7876cb9545ff0 How do I define a local variable for the given describe block. It appears the last declaration overrides all previous declarations of it.
[04:40:30] DigitallyBorn: has joined #ruby
[04:43:40] Iambchop: jidar: upload some rspec or minitest showing desired inputs and outputs :-)
[04:45:44] al2o3-cr: Iambchop: \Z Matches end of string. If string ends with a newline, it matches just before newline | \z Matches end of string
[04:48:00] roshanavand: has joined #ruby
[04:52:14] ivanskie: has joined #ruby
[04:54:05] za1b1tsu: has joined #ruby
[04:55:21] al2o3-cr: Iambchop: example.
[04:55:31] al2o3-cr: &>> ["foo\nbar\nbaz\n".match(/baz\Z/), "foo\nbar\nbaz\n".match(/baz\z/)]
[04:55:34] rubydoc: # => [#<MatchData "baz">, nil] (https://carc.in/#/r/5iyo)
[05:01:09] esrse: has joined #ruby
[05:08:08] sarink: has joined #ruby
[05:08:51] sarink: why is this validation not working how i expect? https://pastebin.com/wzm1fmSF
[05:08:52] ruby[bot]: sarink: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[05:09:25] sarink: as a gist: https://gist.github.com/sarink/f74dc9a50595204916d6c2e2839cbda2
[05:10:14] al2o3-cr: sarink: what do you expect?
[05:10:36] sarink: i expect it to only validate "if: false", aka never
[05:10:51] sarink: am i misunderstanding something?
[05:11:06] sarink: validate that the scenario must exist*
[05:13:10] al2o3-cr: sarink: validate if false is a false negative? no?
[05:19:07] sarink: has left #ruby: ()
[05:28:27] Iambchop: sarink: the docs show passing the param when using Proc.new, but not passing the param when using ->
[05:28:31] Iambchop: https://github.com/rails/rails/pull/33548/files
[05:31:23] Exuma: has joined #ruby
[05:33:00] MoritaShinobu: has joined #ruby
[05:47:19] al2o3-cr: Iambchop: that I is missing a good L with mint sauce =)
[05:54:03] queip: has joined #ruby
[05:55:12] akem: has joined #ruby
[05:56:24] solocshaw: has joined #ruby
[05:59:44] jmcgnh_: has joined #ruby
[06:00:36] Puffball: has joined #ruby
[06:00:55] sparc: has joined #ruby
[06:00:56] jnix: has joined #ruby
[06:01:06] Mutsuhito: has joined #ruby
[06:01:10] teej: has joined #ruby
[06:01:50] wmoxam: has joined #ruby
[06:03:03] goez: has joined #ruby
[06:12:23] Exuma: has joined #ruby
[06:17:38] jp: has joined #ruby
[06:17:43] conta: has joined #ruby
[06:25:00] roshanavand: has joined #ruby
[06:29:35] dnewkerk: has joined #ruby
[06:30:22] ivanskie: has joined #ruby
[06:37:05] orbyt_: has joined #ruby
[06:39:15] sauvin: has joined #ruby
[06:42:05] TheDracle: has joined #ruby
[06:42:47] Xiti: has joined #ruby
[06:44:06] phaul: has joined #ruby
[06:44:59] sarink: has joined #ruby
[06:55:13] queip: has joined #ruby
[07:01:23] havenwood: has joined #ruby
[07:02:56] elphe: has joined #ruby
[07:05:45] Exuma: has joined #ruby
[07:10:18] elphe: has joined #ruby
[07:10:40] ansraliant: has joined #ruby
[07:20:00] elphe: has joined #ruby
[07:21:37] awkwords_: has joined #ruby
[07:28:18] MoritaShinobu: has joined #ruby
[07:38:38] nchambers: is there a way to alias the name of a function, besides just wrapping another function around a call?
[07:39:41] elphe: has joined #ruby
[07:43:09] al2o3-cr: nchambers: how ya mean?
[07:44:01] nchambers: al2o3-cr: its not a big deal really, but internally in a class i want to refer to a function as get_complete_token (as opposed to its internal method get_token_piece), but externally want to expose it as just get
[07:44:55] sarink: has joined #ruby
[07:46:13] al2o3-cr: nchambers: functions you speak of are methods in ruby. that being, sending messages to obj.
[07:46:39] nchambers: erm, sorry yes, methods not functions
[07:47:20] al2o3-cr: nchambers: you can send any message to any obj.
[07:47:30] al2o3-cr: even private.
[07:47:55] nchambers: thats fine. im not trying to hide get_token_piece
[07:48:15] nchambers: get_complete_token just seems like it wouldn't make much sense outside the context of the class internals
[07:48:32] al2o3-cr: nchambers: what do you want `get_token_peice` to do?
[07:48:36] sarink: has joined #ruby
[07:49:53] alehander42: has joined #ruby
[07:50:05] nchambers: "[1 2 3]" -> get_token_piece -> token [, token 1, ..., token ] -> get_complete_token -> list<1, 2, 3>
[07:50:08] al2o3-cr: nchambers: private methods are private to the a Module/Class
[07:50:19] nchambers: these are in a class called tokenizer
[07:50:25] alehander42: what is the idea of those new `>>` proc methods
[07:51:05] al2o3-cr: i'd make them private then.
[07:51:24] al2o3-cr: that method anyhow.
[07:51:50] queip: has joined #ruby
[07:51:53] al2o3-cr: alehander42: what?
[07:52:13] nchambers: al2o3-cr: sure, but what about exposing it publicly
[07:52:32] nchambers: i guess i could just always do def get\nself.get_complete_token\nend
[07:52:46] al2o3-cr: nchambers: use attr_* for reading and writing.
[07:52:46] alehander42: I read that `>>` is planned for use with `&:..` or something
[07:55:07] al2o3-cr: nchambers: make private your methods not accessible API(as such) or any other class. state use; attr_* to r/w etc.
[07:55:30] alehander42: also what happens with ruby3
[07:55:35] sarink: has joined #ruby
[07:55:41] alehander42: and the typing ideas
[07:55:51] nchambers: al2o3-cr: really im just looking for how to give two names to the same function
[07:56:44] al2o3-cr: nchambers: why would you want to do that.
[07:57:31] nchambers: the public function users call is Tokenizer.get, but inside the Tokenizer source code it makes more sense to be called get_complete_token
[07:57:43] nchambers: but they both do the same thing
[07:58:29] al2o3-cr: ?xy nchambers
[07:58:29] ruby[bot]: nchambers: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[07:58:40] nchambers: im not really trying to solve any problem
[07:59:19] nchambers: the method name is get_complete_token. that doesn't seem very nice to call externally, since externally you're only ever dealing with complete tokens
[07:59:27] nchambers: so it would be nice to call .get
[07:59:40] nchambers: internally however, the name makes perfect sense
[07:59:53] nchambers: im not sure how else to explain it
[08:00:16] al2o3-cr: yeah, not sure i'm following ;|
[08:00:37] al2o3-cr: nchambers: you got an example, i got 5 mins.
[08:00:42] nchambers: im probably just overthinking it :/
[08:00:45] nchambers: yeah ill whip one up
[08:03:26] nchambers: https://clbin.com/DsTlP
[08:03:41] nchambers: not perfect ruby but hopefully it shows what i mean
[08:06:24] al2o3-cr: what is self.get_token_piece?
[08:06:41] elphe: has joined #ruby
[08:07:09] al2o3-cr: oh, nvm lol
[08:07:32] nchambers: if it helps im (re) writing a lisp
[08:09:10] nchambers: so get_token_piece might be something like (, foo, 1, 2, (, bar, 3, 4, ), and ), whereas get_complete_token would give (bar 3 4) (foo 1 2 result_of_bar)
[08:10:03] al2o3-cr: nchambers: do you know what self is?
[08:10:18] al2o3-cr: i gotta go in a bout 5.
[08:10:25] Freshnuts: has joined #ruby
[08:10:38] al2o3-cr: what is self in class definition?
[08:10:48] nchambers: referring to the current object
[08:11:16] al2o3-cr: nchambers: so what is the current obj at class level?
[08:11:48] yohji: has joined #ruby
[08:11:56] al2o3-cr: what is self at get_complete_token?
[08:12:10] nchambers: still tokenizer
[08:12:51] marz_d`ghostman: There is a bypass to simulate a failing command via (exit 1); is there anything that will make it output anything?
[08:12:52] nchambers: i can bug you about this tomorrow if its going to be lengthy
[08:13:03] nchambers: hate for you to be late for anything on my account
[08:13:19] havenwood: marz_d`ghostman: abort 'foo'
[08:13:20] elphe_: has joined #ruby
[08:13:36] al2o3-cr: nchambers: give me couple of hours, i'll explain.
[08:13:45] havenwood: marz_d`ghostman: Or say more about what you're wanting to do?
[08:13:46] al2o3-cr: need to go.
[08:13:47] marz_d`ghostman: havenwood: Oh, I'm trying to stub a command for rspec though
[08:13:53] nchambers: thanks al2o3-cr
[08:14:12] clemens3_: has joined #ruby
[08:14:14] marz_d`ghostman: havenwood: Like I want to feed a failing command that outputs to stderr to test if my code is handling it properly
[08:15:41] za1b1tsu: has joined #ruby
[08:16:18] cd: has joined #ruby
[08:17:02] marz_d`ghostman: Guess I can feed it with (echo 'error' >&2; exit 1)
[08:17:17] DigitallyBorn: has joined #ruby
[08:17:52] jmcgnh: has joined #ruby
[08:21:11] malen: has joined #ruby
[08:22:20] roshanavand: has joined #ruby
[08:35:54] Nilium: has joined #ruby
[08:37:22] alehander42: has joined #ruby
[08:40:05] ellcs: has joined #ruby
[08:41:39] stoffus: has joined #ruby
[08:53:43] burgestrand: has joined #ruby
[08:54:26] queip: has joined #ruby
[09:06:51] hiroaki: has joined #ruby
[09:07:24] jlebrech: has joined #ruby
[09:08:42] elphe: has joined #ruby
[09:09:24] Fernando-Basso: has joined #ruby
[09:12:34] venmx: has joined #ruby
[09:15:17] lxsameer: has joined #ruby
[09:20:00] roshanavand: has joined #ruby
[09:22:01] keden: has joined #ruby
[09:24:12] conta: has joined #ruby
[09:49:00] queip: has joined #ruby
[09:53:42] whysthatso: has joined #ruby
[10:09:33] ellcs: has joined #ruby
[10:12:45] havenwood: has joined #ruby
[10:18:03] Nilium: has joined #ruby
[10:18:08] asphyxia: has joined #ruby
[10:23:18] asphyxia: has joined #ruby
[10:31:31] elphe: has joined #ruby
[10:37:00] voolik: has joined #ruby
[10:44:11] TheDracle: has joined #ruby
[10:50:38] queip: has joined #ruby
[10:55:07] vonfry: has joined #ruby
[10:57:57] elphe: has joined #ruby
[11:11:11] nickjj: has joined #ruby
[11:15:13] apparition: has joined #ruby
[11:18:33] AJA4350: has joined #ruby
[11:35:42] roshanavand: has joined #ruby
[11:36:06] BH23: has joined #ruby
[11:38:48] ua_: has joined #ruby
[11:42:54] conta: has joined #ruby
[11:47:23] lomex: has joined #ruby
[11:50:14] queip: has joined #ruby
[11:53:26] DigitallyBorn: has joined #ruby
[11:57:36] vonfry1: has joined #ruby
[12:05:46] conta: has joined #ruby
[12:20:14] fredmorcos: has joined #ruby
[12:24:22] za1b1tsu: has joined #ruby
[12:31:06] fredmorcos: hello, so this is my first time with ruby (i come from a systems programming background, but i know python well), what's the golden standard gems for building a RESTful API using Sinatra, including writing tests for it and interfacing with MongoDB?
[12:33:19] kapil____: has joined #ruby
[12:33:57] lomex: has joined #ruby
[12:34:07] LinuxKnight: has joined #ruby
[12:38:57] elphe: has joined #ruby
[12:40:56] awkwords: has joined #ruby
[12:41:03] za1b1tsu: has joined #ruby
[12:41:35] whysthatso: has joined #ruby
[12:48:39] im0nde: has joined #ruby
[12:51:48] queip: has joined #ruby
[12:52:18] nicesignal: has joined #ruby
[12:52:44] theartist: has joined #ruby
[12:54:38] theartist: Hi guys! If i run 'gem install -V bundler' in my server (latest debian) it gets stuck and does nothing, but locally works flawlessly.
[12:54:47] Fr0stBit: What could go wrong?
[13:01:08] bak1an: has joined #ruby
[13:08:51] Fr0stBit: Nvm i found it, its a problem with the ipv6 servers of api.rubygems.org
[13:09:11] Fr0stBit: has left #ruby: ("WeeChat 2.3")
[13:16:15] BH23: has joined #ruby
[13:16:46] cow[moo]: has joined #ruby
[13:20:52] stoffus: has joined #ruby
[13:22:07] wildermind: has joined #ruby
[13:23:56] sagax: how to get schema declaration field for database in CouchDB?
[13:28:50] bmurt: has joined #ruby
[13:32:36] leitz: has joined #ruby
[13:51:01] aufi: has joined #ruby
[13:53:16] arup_r: has joined #ruby
[13:53:58] queip: has joined #ruby
[14:12:57] arup_r: has joined #ruby
[14:15:30] Nicmavr: has joined #ruby
[14:26:38] chouhoulis: has joined #ruby
[14:28:12] vondruch_: has joined #ruby
[14:29:43] jlebrech: has joined #ruby
[14:29:52] jlebrech: how do you permanently change indentation on vs code for ruby to 2 spaces?
[14:30:20] arup_r: has joined #ruby
[14:31:13] arup_r1: has joined #ruby
[14:33:20] TheDracle: has joined #ruby
[14:34:39] edwardly: has joined #ruby
[14:47:50] Inline: has joined #ruby
[14:49:13] yokel: has joined #ruby
[15:04:15] AltLock: has joined #ruby
[15:04:56] DigitallyBorn: has joined #ruby
[15:06:23] roshanavand: has joined #ruby
[15:14:18] bak1an: has joined #ruby
[15:17:14] Inside: Any recommendations for a YAML schema validator?
[15:17:41] Inside: jlebrech: ctrl+,
[15:17:57] Inside: then you want "editor.insertSpaces:" true, "editor.tabSize": 2
[15:17:59] Inside: in your user settings
[15:18:04] Rapture: has joined #ruby
[15:18:35] sgen_: has joined #ruby
[15:22:59] DigitallyBorn: has joined #ruby
[15:24:39] _habnabit: has joined #ruby
[15:29:33] jottr: has joined #ruby
[15:31:21] _habnabit: has joined #ruby
[15:38:30] roshanavand: has joined #ruby
[15:39:29] BH23: has joined #ruby
[15:46:23] chouhoulis: has joined #ruby
[15:46:23] crankharder: has joined #ruby
[15:47:07] Exuma: has joined #ruby
[15:48:07] queip: has joined #ruby
[15:48:15] jlebrech: has joined #ruby
[15:48:22] jlebrech: Inside: thanks :)
[15:49:55] za1b1tsu: has joined #ruby
[15:53:54] TheDracle: has joined #ruby
[15:56:37] keden: has joined #ruby
[15:57:14] vondruch: has joined #ruby
[15:57:44] elphe: has joined #ruby
[15:58:38] akaiiro: has joined #ruby
[16:02:09] roshanavand: has joined #ruby
[16:09:29] whysthatso: has joined #ruby
[16:19:18] za1b1tsu: has joined #ruby
[16:20:07] Cork: has joined #ruby
[16:25:57] millerti: has joined #ruby
[16:30:35] roshanavand: has joined #ruby
[16:31:17] dviola: has joined #ruby
[16:36:55] elphe: has joined #ruby
[16:37:13] ivanskie: has joined #ruby
[16:37:28] jcarl43: has joined #ruby
[16:37:45] ivanskie: radar you were right. it's way easier with octokit
[16:38:05] irdr: has joined #ruby
[16:40:09] sputnik13: has joined #ruby
[16:40:25] bheesham: has joined #ruby
[16:42:28] jottr: has joined #ruby
[16:43:44] polishdub: has joined #ruby
[16:47:19] queip: has joined #ruby
[16:49:57] Cork: has joined #ruby
[16:50:37] za1b1tsu: has joined #ruby
[16:51:16] DigitallyBorn: has joined #ruby
[16:54:41] sgen_: has joined #ruby
[16:56:43] za1b1tsu: has joined #ruby
[16:58:37] akaiiro: has joined #ruby
[17:00:04] govg: has joined #ruby
[17:01:16] elphe: has joined #ruby
[17:03:07] za1b1tsu: has joined #ruby
[17:03:43] sarink: has joined #ruby
[17:09:33] conta: has joined #ruby
[17:10:07] yokel: has joined #ruby
[17:15:26] orbyt_: has joined #ruby
[17:19:09] gregf_: has joined #ruby
[17:23:54] darkhanb: has joined #ruby
[17:24:13] sameerynho: has joined #ruby
[17:27:53] gix: has joined #ruby
[17:38:01] sarink: has joined #ruby
[17:38:36] elphe: has joined #ruby
[17:43:51] whysthatso: has joined #ruby
[17:51:21] elphe: has joined #ruby
[17:51:52] queip: has joined #ruby
[18:01:07] bmurt: has joined #ruby
[18:02:47] Dbugger: has joined #ruby
[18:03:45] eckhardt_: has joined #ruby
[18:11:03] elphe: has joined #ruby
[18:11:31] reber: has joined #ruby
[18:13:32] reber__: has joined #ruby
[18:15:35] conta: has joined #ruby
[18:28:05] rippa: has joined #ruby
[18:28:20] sarink: has joined #ruby
[18:29:21] jetchisel: has joined #ruby
[18:34:26] nchambers: has joined #ruby
[18:36:11] cd: has joined #ruby
[18:42:16] postmodern: has joined #ruby
[18:42:59] sputnik13: has joined #ruby
[18:45:00] despai: has joined #ruby
[18:54:54] elphe: has joined #ruby
[18:57:34] Fernando-Basso: has joined #ruby
[19:12:08] DigitallyBorn: has joined #ruby
[19:14:16] elphe: has joined #ruby
[19:14:18] beowuff: has joined #ruby
[19:15:16] renardiere: has joined #ruby
[19:21:16] hiroaki: has joined #ruby
[19:21:34] orbyt_: has joined #ruby
[19:22:35] TheBloke: has joined #ruby
[19:25:41] TheBloke: has joined #ruby
[19:27:03] matcouto: has joined #ruby
[19:31:51] ivanskie: is it possible to push `caller` when raising?
[19:32:57] ivanskie: i have a rescue of entire app .. uhm. basically a catch all. and caller for that is obviously its own file / line / col. and not the actual caller way deeper in the app.
[19:33:45] ivanskie: so im scratching my head. how do I handle errors/exceptions nicely, and still be able to have --trace argv so i can print a nice backtrace
[19:38:06] Exuma: has joined #ruby
[19:40:38] bak1an: has joined #ruby
[19:42:46] phaul: has joined #ruby
[19:43:12] dminuoso: ivanskie: I dont understand the question.
[19:43:17] dminuoso: Just return it?
[19:44:03] dminuoso: begin ... rescue StandardError => e; return e.backtrace; end
[19:46:01] ivanskie: https://github.com/piotrmurach/tty/blob/master/exe/teletype#L13-L18
[19:46:26] dminuoso: ACTION does not understand the question or the probilem
[19:46:28] dminuoso: ACTION does not understand the question or the problem
[19:47:12] ivanskie: if i raise TTY::CLI::Error from anywhere in the application... the trace will be exe/teletype:15
[19:47:22] ivanskie: about two lines
[19:47:39] ivanskie: and not from where i called `raise`
[19:48:35] ivanskie: which is what i'd expect
[19:48:39] sgen: has joined #ruby
[19:49:26] ivanskie: but it's okay. I understand how this works now. i'll just have to put rescue block a lot close to raise
[19:50:36] queip: has joined #ruby
[19:51:07] conta: has joined #ruby
[19:55:34] despai: has joined #ruby
[19:55:48] phaul: hiya dminuoso
[19:58:14] phaul: what happened? you disappeared for a while
[19:58:33] Exuma: has joined #ruby
[20:03:12] sanscoeur: has joined #ruby
[20:16:47] elphe: has joined #ruby
[20:26:32] despai: has joined #ruby
[20:26:32] bmurt: has joined #ruby
[20:35:13] ur5us: has joined #ruby
[20:37:30] dminuoso: has left #ruby: ("WeeChat 2.0.1")
[20:42:30] jackrandom: has joined #ruby
[20:43:36] darkhanb: has joined #ruby
[20:49:40] queip: has joined #ruby
[20:50:39] elphe: has joined #ruby
[20:51:39] matcouto: has joined #ruby
[20:54:16] ausmat: has joined #ruby
[20:57:33] TheBloke: has joined #ruby
[21:02:31] nchambers: has joined #ruby
[21:04:04] roshanavand: has joined #ruby
[21:08:12] TheBloke: has joined #ruby
[21:10:29] GodFather_: has joined #ruby
[21:10:55] sputnik13: has joined #ruby
[21:17:08] darkhanb: has joined #ruby
[21:25:50] Exuma: has joined #ruby
[21:32:23] ausmat: has joined #ruby
[21:32:25] ivanskie: just noticed a bit of an annoying behaviour between TTY::File and TTY::Spinner
[21:33:20] ivanskie: if i start a spinner and then want to stop it After TTY::File stuff finished.. it no longer keeps track of that buffer and just prints new line after TTY::File finishes. :(
[21:35:40] awkwords: has joined #ruby
[21:49:54] venmx: has joined #ruby
[21:51:46] queip: has joined #ruby
[21:53:25] ivanskie: https://github.com/piotrmurach/tty-file/issues/6
[21:53:25] sgen: has joined #ruby
[21:53:49] ivanskie: I understand why.. but just annoying lol
[21:56:00] sanscoeur: has joined #ruby
[22:06:07] Exuma: has joined #ruby
[22:15:17] despai: has joined #ruby
[22:16:22] sgen: has joined #ruby
[22:17:50] despai: has joined #ruby
[22:18:25] gigetoo: has joined #ruby
[22:21:55] ss_much: has joined #ruby
[22:21:56] cow[moo]: has joined #ruby
[22:23:49] cjohnson: I'm pretty sure there's a way to write this in one line without calling the method twice, isn't there?
[22:23:52] cjohnson: foo = super
[22:23:54] cjohnson: return foo if foo
[22:27:24] blackmesa: has joined #ruby
[22:28:32] nchambers: does `return foo if (foo = super)` work?
[22:32:34] nchambers: seems to work in https://clbin.com/khFjw (although i didn't test it with a class)
[22:32:54] funnel: has joined #ruby
[22:33:58] Cthulu201: has joined #ruby
[22:36:20] DigitallyBorn: has joined #ruby
[22:36:55] akaiiro: has joined #ruby
[22:37:59] mochiyoda: has joined #ruby
[22:39:27] Azure: has joined #ruby
[22:43:31] phaul: how about super.tap { |foo| return foo if foo }
[22:44:35] nchambers: what does .tap do?
[22:44:58] nchambers: i guess i can just google that actually
[22:45:07] rubydoc: https://ruby-doc.org/core-2.5.3/Object.html#method-i-tap
[22:46:19] asphyxia: has joined #ruby
[22:52:40] chouhoulis: has joined #ruby
[22:53:53] queip: has joined #ruby
[22:59:50] phaul: or... super&.tap { |foo| return foo }
[23:02:55] ua: has joined #ruby
[23:05:14] DigitallyBorn: has joined #ruby
[23:09:49] mroutis: has joined #ruby
[23:14:57] RougeR: has joined #ruby
[23:17:45] jaddison: has joined #ruby
[23:17:56] elphe: has joined #ruby
[23:19:18] DigitallyBorn: has joined #ruby
[23:26:47] whysthatso: has left #ruby: ()
[23:27:56] whysthatso: has joined #ruby
[23:29:14] DigitallyBorn: has joined #ruby
[23:30:21] DTZUZO: has joined #ruby
[23:31:55] cow[moo]: has joined #ruby
[23:36:29] ivanskie: piotr are you on here by any chance?
[23:36:55] jetchisel: has joined #ruby
[23:38:09] mroutis: ivanskie: piotr the mythical solnica?
[23:38:30] ivanskie: Piotr Murach
[23:38:49] ivanskie: he could be mythical... never know
[23:39:38] ivanskie: He was just active on github. I have more questions about his other gems. not worth opening an issue
[23:41:58] ivanskie: by the way.. speaking of mythical people..
[23:42:35] ivanskie: anypne know https://github.com/zontik ?
[23:42:52] armatechnicos: has joined #ruby
[23:44:57] cow[moo]: has joined #ruby
[23:45:49] rubydoc: has joined #ruby
[23:48:17] memo1: has joined #ruby
[23:53:45] argoneus: has joined #ruby
[23:53:58] oz: has joined #ruby
[23:55:01] queip: has joined #ruby
[23:56:30] Fusl: has joined #ruby
[23:58:28] phaul: &>> print [?\\, ?/] * ?o
[23:58:32] rubydoc: # => \o/nil (https://carc.in/#/r/5j4w)