<baweaver>
For a small application it probably won't kill you.
<baweaver>
For a larger one, a Hash is going to be a nightmare down the road
<baweaver>
Primarily around documentation, interface contracts, deprecations, and other such things. A class would be used when you need structure, and structure that you can communicate
<baweaver>
Sure, one can use `keys` on a hash, but how do you know what the intent of each of those keys is? If it's just a few, it's probably not a big deal, but as it grows it's easy to lose track of them.
<baweaver>
Though it's a notably good idea to question standard practice once in a while, as some things are just cargo culted from days and languages long past
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<baweaver>
Visceral reactions to questions should force an amount of introspection as to _why_ we make certain decisions
<baweaver>
A few other fun topics which start that type of fire real quick: goto, global variables, shorthand globals, english operators, etc etc
<baweaver>
That said, it'd be impolite to drop those types of grenades without yourself doing some sort of pre-reading on the topic
<baweaver>
Even moreso to assume that the lack of response or improper level of it confirms that they're not a big deal
* baweaver
wrote a small blog post again
tdy has quit [Ping timeout: 244 seconds]
<phaul>
I can't help but wonder if you meant my response by your last remark. I'm happy to go on with a debate as I stand by my views. I don't really see what was improper about them
blackmesa1 has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 250 seconds]
<phaul>
I would say we don't know if an encapsulated Hash that you delegate to is or is not the right internal representation, that would depend on whats stored there, and usage patterns. If you can get away with a bunch of instance vars instead ofc you should do that
planigan_ has joined #ruby
<phaul>
but I agree with all your points that you made on having a class & dedicated interface
themsay has quit [Ping timeout: 244 seconds]
themsay has joined #ruby
planigan has quit [Ping timeout: 240 seconds]
mat_bug has quit [Ping timeout: 252 seconds]
themsay has quit [Ping timeout: 246 seconds]
themsay has joined #ruby
AJA4350 has joined #ruby
mat_bug has joined #ruby
<baweaver>
phaul: Wasn't meant as an indictment
<baweaver>
Just as an "It's ok to ask questions"
duderonomy has joined #ruby
<baweaver>
I wouldn't characterize any responses here as visceral by any measure
<baweaver>
But I have certainly seen them in the past.
sonofentropy has quit [Quit: sonofentropy]
lxsameer has quit [Ping timeout: 250 seconds]
mat_bug has quit [Ping timeout: 252 seconds]
matchaw has quit [Quit: Leaving]
sonofentropy has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
GodFather has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
AJA4351 is now known as AJA4350
W33DS has joined #ruby
ramfjord has quit [Ping timeout: 246 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
W33DS has quit []
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
stryek has quit [Quit: Connection closed for inactivity]
tris has joined #ruby
code_zombie_ has joined #ruby
code_zombie has quit [Ping timeout: 268 seconds]
tdy has joined #ruby
ansraliant has joined #ruby
AJA4351 has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
AJA4350 has quit [Quit: AJA4350]
SeepingN has quit [Ping timeout: 250 seconds]
Cthulu201 has quit [Ping timeout: 240 seconds]
Cthulu201 has joined #ruby
houhoulis has joined #ruby
haxx0r has joined #ruby
_whitelogger has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ntt>
I need to use a variable to save the regex because the regex is variable
<ellcs>
isn't the second solution from ntt the thing you are looking for? :)
<TheBrayn>
ntt: do you know how variables in ruby work?
ravenousmoose has joined #ruby
<jammanbo>
It sounds like ntt wants to dynamically construct their regex, right?
<ntt>
yes
<jammanbo>
You can interpolate in Regexs, which may or may not be sufficient.
<jammanbo>
e.g. /aaa#{my_var}bbb/
<jammanbo>
There are obvious potential issues with that though
<ntt>
ok. so I can do rx="a" and then x.match(/#{a}/)
<ntt>
?
<jammanbo>
Try it
<ntt>
yes. it works
<ntt>
thank you
<jammanbo>
Also, is there any chance that you are just trying to see if a string ends with another, variable and possibly user supplied, string?
<jammanbo>
cos we have the technoology for taht
<jammanbo>
Em, can anyone recommend a brilliant XML to Hash/JSON converter? XML is coming from Savon and its/Nori's #to_hash is nearly great, except for it's inconsistent handling of attributes.
<ntt>
jammanbo: here is the complete line in my code: myarray.select{|x| x.match(/#{rx}$/)}
<ntt>
so basically I'm trying to see if a string ends with another, because each element of the array is a string
cnsvc has quit [Ping timeout: 256 seconds]
<jammanbo>
ntt: Will x.end_with?(rx) suffice, or is rx actually a regex (as opposed to a simple string)
<phaul>
maybe I misunderstood the question. Example input / output?
<leni1>
Hi. Quick question: is this the right place to ask about `bundler` or does `bundler` fall under Ruby on Rails?
<leni1>
Never mind. A quick Google says that it is for Ruby.
<leni1>
So my question is: I have a system version of bundler installed but the Gemfile.lock was created with a newer version of Ruby. I tried to install a newer version in the folder I was in and it seemed to succeed.
<leni1>
However when I run `bundle install`, it seems that the installer is still using the system wide `bundler`. Is there a way to specify which version of `bundler` I'd like to use or specify that the locally installed bundler (local to my project folder) is the one to be used for installing dependencies?
<jammanbo>
phaul: Yeah, it's the actual format strings that are the problem. An external source is providing date strings and associated format strings, for the format strings are not compatible with strptime etc., so they would need to be translated into something that strptime could use to parse the date.
<jammanbo>
It's not a hug issue, #to_date will probably work 99% of the time.
<jammanbo>
leni1: It's not a direct answer, but using something like rbenv would probably help you now and in the future. I like to supplement that with rbenv-gemset for finer grained control.
<naltun>
Hey guys. I hope everyone's doing well! I'm getting this error: You don't have write permissions for the /usr/lib/ruby/gems/2.6.0
<naltun>
I'm using Arch Linux, and my recent upgrade to 2.6 has apparently broken my gems
<naltun>
I can't install gems without SU privileges and then, of course, when running PATHS/privileges/etc. come into effect and I can't run any ruby projects properly
<naltun>
I'm trying to use Ruby's FFI for writing Rust + Ruby projects :( Super excited but pretty stumped here
<naltun>
Gem home (via bundler env): Gem Home /usr/lib/ruby/gems/2.6.0. Gem Path: /home/naltun/.gem/ruby/2.6.0:/usr/lib/ruby/gems/2.6.0. User Path: /home/naltun/.gem/ruby/2.6.0
conta has quit [Remote host closed the connection]
conta has joined #ruby
aufi has joined #ruby
conta has quit [Ping timeout: 246 seconds]
rippa has joined #ruby
bruce_lee has joined #ruby
Inline has joined #ruby
keden has quit [Ping timeout: 240 seconds]
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
<bruce_lee>
josh_newbie: looks nice to me, but I'm really not an experienced "programmer"
<josh_newbie>
Bruce, i'm a fan of you!
cubillosxy_py has joined #ruby
houhoulis has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
<cubillosxy_py>
hi there, i need to decode a jwt encrypted with a public_key, how to do that? pd: i am beginner in ruby
<al2o3-cr>
cubillosxy_py: ask havenwood
<bruce_lee>
what is "jwt"?
<mozzarella>
josh_newbie: what do you mean by "good way"?
<josh_newbie>
i mean best practice
<josh_newbie>
perhaps theres already a gem for this kind of operation ... ?
<mozzarella>
you can put your closing paren on the same line as the opnening one, but I'm not sure that's considered better
<al2o3-cr>
josh_newbie: i think there is a gem for this
<havenwood>
bruce_lee: It's a little standard for representing signed/encrypted/plain text content over the wire as base64 encoded JSON: https://jwt.io/
<al2o3-cr>
polymorphism, encapulation ... is not as easy one thinks.
polishdub has quit [Quit: leaving]
<al2o3-cr>
encapsulation in ruby is never encapsulation.
<al2o3-cr>
i generally hide it in a namespace.
<al2o3-cr>
well, that's just not to populate the namespace tbh.
<al2o3-cr>
but you get my point.
ellcs has joined #ruby
nchambers has quit [Ping timeout: 246 seconds]
AJA4350 has joined #ruby
<al2o3-cr>
build it up from there.
cats has quit [Read error: Connection reset by peer]
nchambers has joined #ruby
houhoulis has joined #ruby
houhoulis has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 268 seconds]
BH23 has quit [Ping timeout: 268 seconds]
cd has quit [Quit: cd]
dinfuehr has quit [Ping timeout: 272 seconds]
dinfuehr has joined #ruby
yorickpeterse has joined #ruby
moei has joined #ruby
bruce_lee has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zEphiRo has quit [Quit: zEphiRo]
icy` has joined #ruby
zEphiRo has joined #ruby
<icy`>
hi, having an issue with server recognizing a file attachment when i do an HTTP Post. Aren't you just supposed to be able to give the file handle as part of the request body? Looks something like this atm https://pastebin.com/VC4Xw5h0 Response i get back is that no file was uploaded. If I add a .read then an error is rescued with something about ASCII to UTF-8 conversion. I can't get rest-client gem
<icy`>
cause my ruby is 2.6 and that's too new for unf_ext dependency
raulp has joined #ruby
<icy`>
thinking my core issue is just malformed "form data" body. I'll try to follow https://yukimotopress.github.io/http , the section "File Upload - HTML Style" later tonight
<icy`>
rest-client probably just adds those missing headers that I needed around the file itself. It does indeed look like the file needs to be read, as in that example and file handle is not enough
yorickpeterse has quit [Quit: WeeChat 2.3]
AJA4350 has quit [Ping timeout: 250 seconds]
akem__ has quit [Read error: Connection reset by peer]