adam12

Activity Graph

Page 1 of 10 | Next »

2019-06-18

[19:31:56] adam12: fluxAeon: Correct.
[19:32:28] adam12: fluxAeon: If you copy/pasted that verbatim from a project, I'd say it's not _good_ Ruby code, tho it's functional.
[19:36:14] adam12: fluxAeon: Yeah. It's overly creative.

2019-06-17

[19:59:24] adam12: xco: Pretty sure the %w sigil splits on whitespace, so "Some Brand" as an array element would be impossible. I might be wrong.
[19:59:50] adam12: xco: Rather, it _only_ splits on whitespace. It definitely does split on whitespace.
[20:12:43] adam12: xco: Not sure if you were just using this for an example but this is brittle and I wouldn't rely on split with length in this _specific_ case.
[20:36:43] adam12: xco: If you know you always have X args, then it's actually safer than leaving N args off.
[20:38:25] adam12: xco: ie, in key=value type strings, I split with 2 arguments to ensure that value never gets truncated if it included an = sign.

2019-06-14

[19:46:34] adam12: Vaevictus: You're trying to do this in serial? One command at a time?
[19:47:01] adam12: Vaevictus: You shouldn't need loop.
[19:47:13] adam12: Vaevictus: At least not with the methods that block (ala exec!)
[19:50:26] adam12: Really? so you can't call ssh.exec! twice in a row?
[19:50:52] adam12: What commands are you running? Can you share?
[19:51:45] adam12: What happens if you do it manually with the 3 execs on their own line?
[19:52:17] adam12: I just did this exact same thing a few days ago without issue. I can't share the code because it's propietary but I call ssh.exec! 3 times in a row, near sequential. I doubt this is your use of Net::SSH.
[19:52:35] adam12: (near sequential because I do update a progress bar around each)
[19:54:07] adam12: Vaevictus: Out of curiosity, what is the SSH version on the router? Is it an OpenSSH release like Juniper would be?
[19:54:49] adam12: Juniper just repackages FreeBSD
[19:55:12] adam12: I feel like these commands aren't SSH commands
[19:55:19] adam12: Like a shell.
[19:55:32] adam12: Sounds like it might be something interactive where you'd have better luck with Expect?
[19:56:03] adam12: or rather, exec! first, then expect on the IO stream provided by it.
[20:01:21] adam12: Vaevictus: Net::SSH::Telnet was a thing at one time
[20:01:30] adam12: Vaevictus: Can you type out those commands manually and paste their output in a gist?
[20:01:39] adam12: (provided they show output)
[20:10:43] adam12: I gotta run, but take a look at this. https://gist.github.com/3e9eec0d5480fcd655f2b94cc3ba1076
[20:11:08] adam12: The idea being, the only command actually run as SSH is `conf t`. Once that command is run it's an interactive session and you need to feed it data.
[20:11:29] adam12: When data is recieved on the channel, it's compared. From your paste, it looks like maybe config and config-if are safe stages to send more data.
[20:11:49] adam12: If that works.. then I'd look at some sort of `expect` library that works on Net::SSH.
[20:12:09] adam12: If this doesn't work .. perhaps look at generating a list of commands into a temporary file on the router, then sourcing them.
[20:12:23] adam12: This is just my guess.
[20:12:47] adam12: Good luck.
[20:43:48] adam12: Vaevictus: Does just using ssh work?
[20:45:35] adam12: Vaevictus: Maybe use the normal ssh client and use expect to drive it.
[20:47:35] adam12: Vaevictus: Enjoy your vacation.
[23:24:25] adam12: Vaevictus: I pulled the source and it's similar to what I pasted you earlier.. in some ways.

2019-06-13

[14:03:02] adam12: Can't mute the commenting on that thread apparently. I guess RIP Inbox today if it's just going to be a bunch of -1'ers.
[19:17:16] adam12: #instance_of? isn't something I see that often in the wild.
[19:17:36] adam12: Ironically I thought it was an alias of #is_a? before you mentioned it.
[19:20:07] adam12: I gag a little when I see is_a?(Array) tho. I completely forgot about #kind_of?

2019-06-11

[22:24:06] adam12: Net: If those are exceptional cases, maybe you want to raise an exception.
[22:25:00] adam12: Net: If they are flow control, don't raise the exception. You could use a struct called Result that has a reason being one of those symbols. Or you can just return the symbol.. I am not sure there's any real common idiom.
[22:25:23] adam12: Net: As a third option, you could look at using a result monad. There's a bunch around: Resonad or Dry-monads being 2 gems.

2019-06-07

[00:37:26] adam12: amjam: Did you look in /home/f/.gem/ruby/2.4.0/bin ?
[01:02:59] adam12: amjam: Great news.
[01:04:27] adam12: DaRock: Did you choose test::unit for a reason?
[01:06:07] adam12: DaRock: Don't quote me on it, but I don't know how maintained it is. Most people have moved on to minitest or rspec... so I was curious if it was chosen for a specific reason.
[01:06:39] adam12: DaRock: That said. The easiest thing to do is to paste the backtrace/error you get, and the code that's erroring. Use Github Gist preferably but any paste tool is fine.
[01:07:39] adam12: DaRock: Maybe puts is working, but because it's nil you're getting no output.
[01:08:35] adam12: DaRock: Share some code. Anything else we'll just be speculating.
[01:09:25] adam12: DaRock: If you're on a recent version of Ruby, put binding.irb before the line you're getting an error on, and it should drop you into a REPL that will let you poke at some of the variables.
[01:09:59] adam12: DaRock: If you're not, install the `pry` gem and use binding.pry instead.
[01:12:29] adam12: DaRock: Byebug should just work fine, tho I'll admit I normally just use binding.pry and the REPL it provides.
[01:13:03] adam12: DaRock: Binding is a context for all things in Ruby. pry and irb are methods on that context, and going into the detail on why those methods are on binding is likely more than you need to know at this point.
[01:13:57] adam12: DaRock: If you're curious why I suggested pry and binding.pry, there are some good videos on the Pry website that explain it. It's not a real debugger, but it gives you a breakpoint at the place you insert the call, and let's you poke around inside the context of the call.
[01:14:12] adam12: DaRock: https://pryrepl.org/screencasts.html
[01:15:21] adam12: DaRock: Use 'p' or 'pp' instead of 'puts' when "print debugging" can help too.
[01:15:41] adam12: DaRock: It's not. Binding is just a context that gets past around with methods/etc.
[01:19:43] adam12: comet23: You have an issue with case. You check if 'Gosh' is in the curse word list but it's not, because it's actually in the list as 'gosh'.
[01:35:41] adam12: comet23: is that homework or something else?
[01:40:38] adam12: comet23: I rewrote it in 7 lines, if you want' to see it. But I don't want to spoil homework.
[13:59:12] adam12: iffraff: bundler supports the --jobs (or -j) argument to do things in parallel.
[13:59:52] adam12: iffraff: If you're on Linux, sometimes `bundle install -j $(nproc)` can give you a bit of speed bump.
[14:00:22] adam12: iffraff: You can configure it as a global option too, to always use a number of jobs.
[14:00:34] adam12: iffraff: It's the short version of --jobs, which is how many things to do in parallel.
[14:07:21] adam12: iffraff: I don't use Docker, but if you're using ADD during development maybe you want VOLUME. It allows you to bind-mount instead of copy.
[14:08:48] adam12: cornfeedhobo: No easy way. You can iterate through $LOAD_PATH which is where require looks for files. What are you trying to achieve?
[14:11:48] adam12: iffraff: It sucks but I'm not sure of anything better :\

2019-06-06

[18:50:33] adam12: a7d7p7: What OS?
[18:51:46] adam12: a7d7p7: Do you use Homebrew?
[18:52:39] adam12: a7d7p7: If it fails, install gpg2 via homebrew then try again.
[18:52:55] adam12: a7d7p7: but continue with the curl command for now. Good luck.
[19:00:22] adam12: a7d7p7: It skipped verifying the release... which is interesting but it got you on your way.
[19:00:39] adam12: Or did it skip the download? I don't know because I don't use RVM :P

2019-06-04

[11:00:11] adam12: Read error: Connection reset by peer
[11:02:44] adam12: has joined #ruby

2019-05-30

[14:34:46] adam12: . .. lost+found
[16:20:46] adam12: ngw: To start, I'd use the Hash.new default value feature.
[16:26:06] adam12: ngw: https://gist.github.com/05aa90c61269c6106b46ae903941d234
[16:27:06] adam12: bbiaf. lunch.

2019-05-29

[13:26:00] adam12: koomen: Probably my least favourite part of Ruby is docs mostly suck. Split between YARD/RDoc/Tomdoc (partly). Go with RDoc or YARD. Forget Tomdoc imho.
[13:31:25] adam12: If you use all it's features, it definitely outputs nicer docs.
[13:31:56] adam12: It's a shame that Loren Segals's work to unify docs were kinda stonewalled.
[15:48:37] adam12: Anybody ever seen an at_exit{} handler that checks $!? I'm using the Azure SDK and it will raise an exception but the stacktrace is basically useless. Only includes frames from itself or one of it's dependent libraries. I'd love to see the actual line that triggered it somewhere.
[15:50:05] adam12: _inky: I've normally seen that where Puma is compiled with OpenSSL and it's been a broken compile. There's an environment variable you can set when installing puma that will disable the built-in SSL server.
[15:54:41] adam12: _inky: Maybe something like: env DISABLE_SSL=1 bundle pristine
[15:55:39] adam12: Or maybe just: env DISABLE_SSL=1 bundle pristine puma
[15:59:19] adam12: _inky: cheers!
[22:00:06] adam12: ledhed2222: Sometimes too many arguments is a smell, so keep that in consideration. Sometimes I only have a few args but it still looks narly and for that I might reach for dry-initializer.
[22:01:30] adam12: ledhed2222: https://dry-rb.org/gems/dry-initializer/
[22:01:35] adam12: ledhed2222: Gotta run. Good luck.

2019-05-28

[00:11:56] adam12: dorian: No idiom that I know for class X do (specifically do/end), but there _is_ an idiom for returning a module that might be OK.
[00:13:22] adam12: dorian: So with that, you might be able to make something work by returning a class (Class.new), but I've never personally tried it. Alternatively, use the common include SomeModule.new trick.
[00:14:23] adam12: dorian: You could just make a proc/lambda here?
[00:14:32] adam12: dorian: or are you already that far?
[00:14:54] adam12: dorian: So you're missing context somehow. Can you put together a minimal example?

2019-05-27

[14:28:31] adam12: migalenkom_: If you want to get assistance for your issue, my suggestion is to digest it into a smaller, reproducable issue that shows what you're expecting and what you're getting instead. Not everyone will have knowledge of Texecom or serial ports, but might be able to assist you in decoding some binary if you show expected value. ie. foobar.unpack("*U") == "hello world" or something.

2019-05-22

[15:49:46] adam12: WolfgangGrobar: There's a bunch of ways to "dependency inject" in Ruby. The constructor with default params is just one method. I don't think any specific way is "idiomatic".
[15:50:50] adam12: WolfgangGrobar: Oh. I think people expect more than what is required.
[15:52:15] adam12: WolfgangGrobar: The simplest solution is indeed accessors and perhaps params to the constructor. At the opposite end of the scale is something like dry-auto_inject which is paired with some sort of IoC container.

2019-05-21

[14:06:09] adam12: *.net *.split

2019-05-17

[00:09:40] adam12: leitz: Haven't heard anything. I moved all my OSS Ruby to Circle, for no real reason other than using the Docker images vs Travis test matrix was easier.
[00:11:36] adam12: leitz: CircleCI. https://circleci.com/
[00:11:52] adam12: leitz: Here's one of my configs for Circle. https://github.com/adam12/rack-server-timing/blob/master/.circleci/config.yml
[00:12:19] adam12: I use Gitlab CI too, which is also great. I run my own worker.
[00:12:59] adam12: leitz: Most people don't get the show reference :)
[00:13:40] adam12: leitz: Yeah, tho their worker/runner is in Golang.
[00:13:51] adam12: leitz: Pretty sure their frontend is Rails+Vue.
[00:16:36] adam12: leitz: I write a mix of both, tho I definitely favour Ruby for a ton of stuff.
[00:17:27] adam12: leitz: I'm sitting here staring at the ruby 2.0 shipped with CentOS7 and longing to write this tooling in Go to skip the dependency. But Go+XML parsing is pain and Ruby+XML is bliss.
[00:18:50] adam12: leitz: I'm partial to Oga :)
[00:20:11] adam12: leitz: wb.
[00:21:41] adam12: Oga has no dependency on libxml2, which admittedly has been less of an issue since nokogiri shipped with it, but it was a source of pain in the past.
[00:22:32] adam12: leitz: I'm all ears, lest the mods decide it's offtopic O_O
[00:25:06] adam12: libxml2 definitely has it security bugs. In competition with ImageMagick, I heard.
[00:27:09] adam12: Write some more Perl and then apply retroactively for your grey-beard, I used Linux when Slackware shipped on 14 floppies badge. Bonus points if it's a web app and you deploy it to cgi-bin.
[00:29:55] adam12: Well just remember: Not being able to read yesterdays Perl isn't a sign of sinility. It's just Perl.
[00:32:37] adam12: The Perl portion definitely shows through in some parts.

2019-05-16

[16:12:30] adam12: tj_: Can you access zlib.net manually? I think it's trying to fetch http://zlib.net/fossils/zlib-1.2.11.tar.gz
[16:17:50] adam12: tj_: for some reason Ruby can't connect from the shell. Sadly the error isn't very obvious for why.
[16:18:38] adam12: tj_: Ideally you could simulate the request yourself inside irb and see if it gives you more information.
[16:22:41] adam12: tj_: That was my first assumption but it's communicating on port 80.
[16:23:10] adam12: tj_: ruby -r"net/http" -e 'Net::HTTP.get(URI("http://zlib.net/fossils/zlib-1.2.11.tar.gz")) and puts "OK"'
[16:27:09] adam12: tj_: I forgot you're on Windows so I'm not sure if you can run that command verbatim.
[16:27:52] adam12: xco: Just FYI, that code validated without any changes on my side (other than cleaning up whitespace from pasting gist). Are you on latest Rubocop?
[16:29:21] adam12: xco: Interesting. Maybe that rule is disabled on my install.
[16:30:19] adam12: xco: I was able to reproduce it locally with the example from this page. https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/UselessAssignment
[16:30:32] adam12: xco: No matter. I just thought it was interesting that mine validated fine while yours was complaining.
[16:33:04] adam12: tj_: No surprise since it's installed via the same mechanism.
[16:33:56] adam12: tj_: It needs the zlib dependency. On Linux you can normally get it from libz but on Windows it needs to likely be downloaded and built as a sidecar to the gem.
[17:03:13] adam12: tj_: Could you open up irb and disect that one-liner I pasted earlier?
[20:31:00] adam12: Quit: adam12
[21:04:55] adam12: has joined #ruby

2019-05-15

[15:48:31] adam12: adelvice: Not a Chef user but any chance it comes from the Swedish Chef off Sesame Street?
[15:48:42] adam12: adelvice: I swear he says something similar.

2019-05-14

[18:32:47] adam12: zinefer: The exception is on that Trip.create! line you annotated?
[18:40:28] adam12: zinefer: I digested it down into something runnable and it works as expected. https://gist.github.com/5ca0263e205ae4aecbdde7cc5ada0f42 Maybe it's something else specific to your setup.
[18:40:31] adam12: tf2ftw: o/
[19:47:45] adam12: tf2ftw: Would you rather a normal File? Fairly sure the premise of Tempfile is that it's created when requested, since if not there could be a potential race condition if the new filename could be predicted.
[19:50:27] adam12: tf2ftw: If you just need some sort of random looking filename like Tempfile would produce, you could probably recreate it yourself by pairing Dir.tmpdir + $$ + something else?
[19:50:59] adam12: &>> require "tmpdir"; File.join(Dir.tmpdir, "yourapp", $$)
[19:52:05] adam12: &>> require "tmpdir"; File.join(Dir.tmpdir, "yourapp.#{$$}")
[19:52:19] adam12: tf2ftw: Yeah. It's tucked away.
[19:53:30] adam12: tf2ftw: Kinda surprised myself tbh, but there's probably a ton of legacy behind why it was placed where it was.
[19:55:07] adam12: phaul: Good point.
[19:55:50] adam12: I like knowing which pid created what, so adding another bit of entropy to the string wouldn't hurt. SecureRandom.alphanumeric(8) or something.
[20:01:10] adam12: zinefer: yw.
[20:01:32] adam12: tf2ftw: I believe Ruby will prune Tempfile instances on exit.
[20:01:43] adam12: tf2ftw: And of course, some OS's ship with a tmp cleaner.
[20:02:25] adam12: tf2ftw: If you want to guarantee persistence, maybe look at storing it somewhere you can control and make the filename obtuse. Hash the file and split into a namespace, etc. Probably many ways to do it.

2019-05-09

[14:51:40] adam12: To be fair, there is a bunch of work going on to improve Ruby for networking. The async-* packages and lightweight fibers being one.

2019-05-07

[13:37:40] adam12: ep4sh2k__: I can't speak in depth of this since I normally use bundler on the server but `gem` supports a --user-install argument
[13:37:54] adam12: ep4sh2k__: And if you set GEM_HOME to a path you control, gem will honour it and install there.
[13:39:00] adam12: ep4sh2k__: There's the gem_home tool that automates setting $GEM_HOME and $PATH for you. https://github.com/postmodern/gem_home
[13:39:28] adam12: ep4sh2k__: Oh I see. In that case, your options are either use a version manager like chruby/rbenv, or just manually build it.
[13:40:00] adam12: ep4sh2k__: Actually, I just re-read your issue and I see what you're talking about now. You need system packages installed.
[13:40:24] adam12: (so kinda disregard what I already said?)
[13:40:43] adam12: ep4sh2k__: What distribution?
[13:41:06] adam12: ep4sh2k__: You have root permissions?
[13:41:28] adam12: ep4sh2k__: Well, installing those -devel packages won't hurt anything, since they are just headers.
[13:43:03] adam12: ep4sh2k__: Outside of that, maybe you could get by with the CentOS SIG for Ruby, depending on the Ruby version. I'm not sure they are shipping 2.6 but I believe 2.5 is shipping. https://lists.centos.org/pipermail/centos-announce/2018-June/022919.html
[13:43:16] adam12: ep4sh2k__: but I foresee you needing those -devel packages eventually.
[13:51:11] adam12: ep4sh2k__: Correct. The libraries are likely already installed, and binary installed packages (using yum/dnf) don't need the headers when installing since they're already compiled and linked.
[14:53:42] adam12: havenwood: I'm excited for it, tho I'm not sure how I'll adjust to not developing on FreeBSD
[14:54:31] adam12: havenwood: I wonder if naturally it will come, if they're shipping the kernel.
[14:56:05] adam12: havenwood: tbh I'm more excited about the console. I'm using wsltty which is .. fine, but they're all mostly lackluster.
[14:58:18] adam12: havenwood: As expected, that issue derailed fast :P
[15:04:36] adam12: I wish BSDs weren't so often overlooked. I've started a project to nightly test a bunch of Ruby gems with C extensions just to try to see which ones use Linuxisms and cause breakages.
[15:05:26] adam12: bcrypt and protobuf are the 2 libraries I've recently had issue with.
[15:17:03] adam12: Nice. I hadn't seen that TruffleRuby tool before.
[15:17:40] adam12: I can't say I blame the gem authors. CI for FreeBSD/OpenBSD/whatever has always been a bit of a unicorn, since you can't use Docker to test them.
[15:22:07] adam12: englosh: Are you requiring or loading that file from somewhere? or calling it directly.
[15:22:17] adam12: englosh: You might be able to rescue LoadError. I have no idea.
[15:23:33] adam12: englosh_: First off, how is `file` getting loaded?
[15:23:49] adam12: englosh_: So `ruby file.rb`?
[15:25:47] adam12: englosh_: I'm not sure if Ruby calls Kernel.load for `ruby ARGV[0]` but if it does, you could _bleh_ monkeypatch load.
[15:26:24] adam12: englosh_: ruby -e 'begin; load "file.rb"; rescue LoadError; abort "oh noes"; end'
[15:27:08] adam12: englosh_: if you can get "oh noes" out of that, then you could probably work backwards. Find out if there's an exception being raised and see if you can change the formatting.
[15:50:49] adam12: zenspider: Not sure if you're around? but curious to know if there's a better place to start experimenting with mt6 outside of the branch on your personal repo.

2019-05-06

[15:12:56] adam12: depesz: Enumerable#each_slice is likely what you're looking for.
[22:42:24] adam12: I wonder what goodies RubyVM::AbstractSyntaxTree will eventually yield
[23:22:36] adam12: lemoi: map and join.
[23:24:47] adam12: lemoi: https://gist.github.com/5cef2ccba58ec5c5743f17100c1675ec
[23:26:30] adam12: al2o3-cr: Might have worked? But I guess I'd call that map and join and join.
[23:26:59] adam12: &>> {"-foo-bar" => "xxx", "-bar-baz" => "yyy"}.map {|*attr| attr.join(" ") }.join(" ")
[23:29:33] adam12: neplushko: Not sure I follow exactly, but Arrays are passed by reference. You're mutating the same Array.
[23:30:35] adam12: &>> a = []; a = (1..4).map {|x| a << x }
[23:31:13] adam12: &>> [1] << 2
[23:32:21] adam12: &>> a = [].freeze; a = (1..4).map {|x| a << x }
[23:34:53] adam12: neplushko: Are you just trying to understand what's happening or is this something your experiencing?
[23:40:59] adam12: neplushko: Not at all. Mutation catches many experienced developers. It's good to understand.
[23:55:29] adam12: havenwood: Nice.
[23:56:46] adam12: havenwood: Did you see a talk on "Threadlets" at RubyKaigi? I dont' remember seeing one on the schedule.
[23:58:43] adam12: havenwood: No worries. I only saw references to it on the bug tracker and wondered if there was more going on that I wasn't aware of.

2019-05-03

[18:09:22] adam12: old_relik: A third approach is to use another job to represent the sending of the SMS / logging, and have your job that recieves the list of IDs break them up into multiple jobs
[18:10:02] adam12: old_relik: Then make those smaller jobs idempotent. If you don't care about the job retrying, it might always be easiest to never retry. I'm not sure about Sidekiq but in Que I have an `ensure` that always calls `destroy`.
[18:11:17] adam12: old_relik: I'm just saying, SMSScheduler.enqueue([1, 2, 3]) calls SMSSender.enqueue(1), SMSSender.enqueue(2), etc.
[18:12:00] adam12: old_relik: Then inside the job block for the SMSSender, `def run; send_sms && log; rescue => e; log_failure(e); end`.
[18:12:19] adam12: old_relik: I don't use Sidekiq so I'm obviously paraphrasing here.
[18:18:52] adam12: old_relik: IMHO, anytime I've looped and done work in the same job I've always regretted it later.
[18:21:06] adam12: old_relik: 1. I usually end up needing to scale horizontally and with a single job I'm limited. 2. Some errors are recoverable and I'd rather have a single job retrying than the entire job blocked for retry.
[18:21:32] adam12: old_relik: There's nothing wrong with your implementation design tho, so if you feel it suits you better, just rescue and continue/next/whatever.
[19:31:19] adam12: Has anybody ever seen a way to lazy-capture/parse Ruby without using a String to represent it, and preferably not using method_source? ie. foo = proc { puts "Hello World" }, foo.source # => puts "Hello World"

2019-05-01

[14:48:33] adam12: Rakete1111: Did we talk about this a few days ago? I'm having deja-vu
[14:52:25] adam12: Rakete1111: I reproduced your issue. With characters the result is nil. Without the characters, I get a Mail::Part object back.
[14:52:51] adam12: LANG=en_US.UTF-8
[14:52:53] adam12: LC_CTYPE="en_US.UTF-8"
[14:52:55] adam12: LC_COLLATE=C
[14:56:05] adam12: Rakete1111: I can't look at it now but since you've provided an example email I'll dig into it a bit later and see if there's something I can see.
[16:00:20] adam12: VSpike: If you have to run a non-current version, you're obviously best to run the latest of that minor. The patches will usually switch from bug fixes to security fixes.
[16:00:43] adam12: VSpike: I don't think there's any hard and fast rule, and you could look at 2.4.6 and 2.4.5 and go meh, 2.4.5 is sufficient.
[18:18:29] adam12: 2.6 has such goodness tho
[21:12:28] adam12: cjohnson: Like Enumerable#find ?

2019-04-30

[00:04:10] adam12: CableNinja: Can you share the code you're using?
[00:10:52] adam12: CableNinja: And you're saying, when you run the server, openssl s_client works, Ruby doesn't.
[00:20:08] adam12: CableNinja: There's a ton going on in here. I'd probably try to reduce it down into 2 small scripts to reproduce.
[00:41:13] adam12: CableNinja: Not really. I took the liberty of pulling out a bunch of your code into 2 smaller files and it _looks_ like it works, at least on my end.
[00:41:21] adam12: CableNinja: But I ripped out everything to do with threads and loops and connection handlers.
[00:41:37] adam12: CableNinja: OpenSSL errors are definitely unhelpful :\
[00:41:54] adam12: CableNinja: Maybe try my 2 small versions and see if they work? If they do, maybe we can see where your code differs from mine.
[00:43:57] adam12: CableNinja: https://gist.github.com/adam12/7ef117cde9283e642be94107efe0fd8a
[01:25:48] adam12: seydar: If you're _stuck_ with that style of method signature, you might have to get fancy and accept an array of args.
[01:26:09] adam12: seydar: If you're not stuck with that style of method signature, you might be able to make query a keyword argument and then capture the rest of the keyword arguments as options.
[01:26:25] adam12: seydar: If you're looking for a name of that style of method, I might call it polymorphic?
[01:29:58] adam12: seydar: They're mostly good, tho some parts are jank and Matz yearns to fix them.
[01:30:36] adam12: seydar: You might be able to do something like `def search(query: nil, **opts)` if you're on a reasonably new version of Ruby.
[01:30:51] adam12: seydar: Also, you should come back.
[01:33:54] adam12: seydar: I can't remember when it was introduced but it's wicked handy
[01:34:12] adam12: seydar: Also I screwed up; with kwargs, you can still use a nil-default positional param.
[01:34:23] adam12: seydar: So this signature is fine too if you want it: `def search(query=nil, **opts)`
[14:05:47] adam12: towo: I'm not sure if I followed exactly, but Regexp.match accepts a block to run if it matches.
[14:06:31] adam12: towo: bar.match(foo) { |m| puts m[2] }

2019-04-29

[13:39:28] adam12: ech0s7: Your keys are symbols. 'a' is a string.
[13:39:47] adam12: ech0s7: I bet if you `puts hash.key? :a` it would work :)
[13:40:25] adam12: &>> { a: "a" }.key? :a
[13:49:56] adam12: ech0s7: Couple methods. If you're using Rails, there's a symbolize_keys! method on Hash.
[13:50:09] adam12: ech0s7: If you're not, I believe JSON will accept an argument to symbolize keys/names.
[14:22:39] adam12: ngw: I haven't seen anything but maybe you can dig through the CGI library in stdlib?
[14:26:41] adam12: ngw: Nevermind. I forgot that CGI.rb was a bit barren.
[14:31:15] adam12: ngw: If it's just a single method I'd just lift and shift :)

2019-04-27

[17:39:51] adam12: thadtheman: If it's just to fix the error, initialize @@name before attempting to use it. https://gist.github.com/adam12/4e93b95d91706eac0612c1c23538c651
[17:39:58] adam12: comet23: What kind of file?
[17:41:20] adam12: thadtheman: There's better ways to do it tho. I'd suggest avoiding the class variables in favour of class instance variables (single @). They're more commonly used in Ruby and I act a bit more similar to what you might be used to (imho).
[19:53:00] adam12: O_O nice try Illuminati

2019-04-26

[15:17:52] adam12: Momentum: not me.
[15:27:49] adam12: Momentum: Hard to say. What's your situation? Can you describe a little bit about how you're using Ruby?