havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
tdy has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
code_zombie has quit [Quit: Leaving]
blackmesa1 has quit [Ping timeout: 252 seconds]
AJA4350 has quit [Ping timeout: 246 seconds]
cnsvc has quit [Remote host closed the connection]
nowhere_man has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 268 seconds]
Swyper has joined #ruby
cnsvc has joined #ruby
catphish has joined #ruby
jottr has quit [Ping timeout: 268 seconds]
jottr has joined #ruby
Swyper has quit [Remote host closed the connection]
keden has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
keden has quit [Ping timeout: 268 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LadyElusive has quit [Quit: leaving]
<catphish> no it doesn't
<catphish> hm, actually it's an array, so i guess it does
akem has quit [Remote host closed the connection]
akem has joined #ruby
perique has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
jottr has joined #ruby
bruce_lee has quit [Ping timeout: 245 seconds]
nowhere_man has joined #ruby
sonofentropy has quit [Quit: sonofentropy]
jottr has quit [Ping timeout: 245 seconds]
bmurt has joined #ruby
nowhere_man has quit [Remote host closed the connection]
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
perique has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
apparition has joined #ruby
brandoncc has joined #ruby
catphish has left #ruby ["Leaving"]
renich has quit [Quit: renich]
sonofentropy has joined #ruby
ansraliant has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
duderonomy has joined #ruby
nowhere_man has joined #ruby
maryo has joined #ruby
maryo has quit [Client Quit]
mikecmpbll has joined #ruby
limezzz has joined #ruby
tdy has joined #ruby
DTZUZO_ has quit [Ping timeout: 245 seconds]
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has quit [Ping timeout: 250 seconds]
tdy has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
dviola has quit [Quit: WeeChat 2.3]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has quit [Remote host closed the connection]
apparition has quit [Ping timeout: 250 seconds]
paranoic_ has joined #ruby
ocampa has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
<ocampa> Using Manjaro linux, ruby install verified with "ruby -v" command {ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]} - "irb" command not working ("command not found") - am I so daft that I can't get it to run?
ocampa2 has joined #ruby
brandoncc has joined #ruby
lytol_ has quit [Remote host closed the connection]
\void has joined #ruby
arescorpio has joined #ruby
cschneid has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 240 seconds]
hurricanehrndz has quit [Quit: Goodbye]
orbyt_ has joined #ruby
braincrash has quit [Quit: bye bye]
arescorpio has quit [Quit: Leaving.]
braincrash has joined #ruby
[void] has joined #ruby
r29v has joined #ruby
\void has quit [Read error: Connection reset by peer]
[void] is now known as \void
tdy has joined #ruby
r29v has quit [Quit: r29v]
esrse has joined #ruby
<leftylink> ocampa: if manjaro is using arch's package for that, then https://www.archlinux.org/packages/community/any/ruby-irb/ may be necessary
<al2o3-cr> ocampa: whereis irb
<leftylink> whoa, I never knew such a command existed
<al2o3-cr> most likely haven't got it in your PATH
<al2o3-cr> ;) yep.
\void has quit [Quit: So long, and thanks for all the fish.]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
kapil____ has joined #ruby
BTRE has joined #ruby
<ocampa> it's showing blank "irb: "
<ocampa> i have something to go off now, at least. thanks for the link
<al2o3-cr> ocampa: yeah, seems that irb is now a separate package now.
RiPuk has quit [Quit: ZNC 1.7.1 - https://znc.in]
RiPuk has joined #ruby
paranoic_ is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
ocampa has quit [Quit: Konversation terminated!]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
jottr has joined #ruby
ocampa2 has left #ruby ["saa-recovery.org"]
laaron has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
jottr has quit [Ping timeout: 246 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
cnsvc has quit [Remote host closed the connection]
cnsvc has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
segy has joined #ruby
Leifr has joined #ruby
davidw_ has quit [Ping timeout: 244 seconds]
akem has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
dinfuehr has joined #ruby
tdy has quit [Ping timeout: 250 seconds]
conta has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
cgfbee has quit [Remote host closed the connection]
limezzz has quit [Remote host closed the connection]
Inline has quit [Quit: Leaving]
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
dellavg_ has joined #ruby
Furai has quit [Quit: WeeChat 2.3]
aupadhye has joined #ruby
Furai has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
dinfuehr has joined #ruby
solocshaw has joined #ruby
clemens3 has joined #ruby
solocshaw has quit [Quit: solocshaw]
reber has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has quit [Ping timeout: 252 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
_whitelogger has joined #ruby
FastJack has joined #ruby
za1b1tsu has joined #ruby
Swyper has joined #ruby
Tuor has joined #ruby
sauvin has joined #ruby
Mortomes|Work has joined #ruby
themsay has joined #ruby
ItsAVortex has joined #ruby
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BH23 has joined #ruby
Swyper has quit [Remote host closed the connection]
BH23 has quit [Ping timeout: 250 seconds]
Leifr has quit [Ping timeout: 245 seconds]
dviola has quit [Quit: WeeChat 2.3]
ansraliant has quit [Quit: My planet needs me]
jcarl43 has quit [Quit: WeeChat 2.3]
BH23 has joined #ruby
conta has quit [Ping timeout: 250 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has joined #ruby
paranoicsan has joined #ruby
hahuang6- has quit [Ping timeout: 268 seconds]
blackmesa1 has joined #ruby
blackmesa has joined #ruby
lightstalker has quit [Ping timeout: 246 seconds]
blackmesa1 has quit [Ping timeout: 252 seconds]
lightstalker has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
Tuor has quit [Ping timeout: 246 seconds]
mikecmpbll has joined #ruby
reber has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
nfk has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
themsay has quit [Ping timeout: 250 seconds]
conta has joined #ruby
BH23 has quit [Ping timeout: 244 seconds]
cnsvc has quit [Ping timeout: 256 seconds]
paranoicsan is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
priodev has quit [Quit: out.]
priodev has joined #ruby
aufi has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
Nicmavr has joined #ruby
jottr has joined #ruby
themsay has joined #ruby
Swyper has quit [Ping timeout: 272 seconds]
ItsAVortex has quit [Quit: Leaving]
paranoicsan has joined #ruby
snuz has joined #ruby
noboruma has quit [Quit: leaving]
snuz has quit [Client Quit]
snuz has joined #ruby
snuz has quit [Client Quit]
snuz has joined #ruby
ellcs has joined #ruby
agent_white has quit [Quit: bbl]
BH23 has joined #ruby
kapil____ has joined #ruby
noboruma has joined #ruby
themsay has quit [Ping timeout: 272 seconds]
snuz has quit [Quit: WeeChat 2.3]
Mortomes|Work_ has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
Mortomes|Work has quit [Ping timeout: 256 seconds]
paranoicsan is now known as paranoicsan[Away
ntt has joined #ruby
<ntt> Hello, I'm trying to initialize a new model in a rails application and I'd like to insert a lot of default values. Can I create an hash like default_params = {...} and using it to initialize the model? Furthermore, I need to merge default_params with params I pass through the constructor. Please, someone can help me?
paranoicsan[Away is now known as paranoicsan
<tbuehlmann> ntt: you can certainly do that. if these defaults are always the same, you could also use after_initialize in your model to set default value
<tbuehlmann> values*
<ntt> tbuehlmann: thank you. Sure, they are always the same. Furthermore, I need to merge my default_params with some params I need to pass as arguments in the new() method. How can I merge in order to have only one hash?
<tbuehlmann> https://gist.github.com/tbuehlmann/0c36c0ac0e81de8b20f54879d3e42227 this will set some_attribute to 'default value' unless it's there
<tbuehlmann> with this, you can simply pass your params into the initializer
<ntt> ok. But the problem is that I have an Hash as default_params and searching on google I found that I can use the method "instance_variable_set". Is this correct?
<tbuehlmann> if the defaults are always the same, you'd just put them into after_initialize, or am I missing something?
<tbuehlmann> (a different option is to have these defaults as database table defaults, btw)
<ntt> yes. I have a looong hash like default_params = {....}. I need to initialize my model with this default_params and others that I'm going to add as params in the new() method
Guest16678 has joined #ruby
<tbuehlmann> sure, something like this then: https://gist.github.com/tbuehlmann/0c36c0ac0e81de8b20f54879d3e42227
<tbuehlmann> you could replace that hash in line 4 with whatever you have
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
<ntt> what is "public_send" ?
<tbuehlmann> some_object.public_send(:foo) is like calling some_object.foo
<tbuehlmann> it let's you dynamically call methods on an object using a symbol
<ntt> NoMethodError: undefined method `range' for #<VExtension:0x0000000005b7b808>
aqd has joined #ruby
snuz has joined #ruby
snuz has quit [Client Quit]
keden has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.3]
esrse has quit [Ping timeout: 268 seconds]
al2o3-cr has joined #ruby
minacat has joined #ruby
paranoicsan has quit [Quit: paranoicsan]
minacat has quit [Remote host closed the connection]
za1b1tsu has quit [Ping timeout: 250 seconds]
foxxx0 has quit [Ping timeout: 246 seconds]
donofrio_ has joined #ruby
donofrio has quit [Ping timeout: 268 seconds]
donofrio_ has quit [Read error: Connection reset by peer]
donofrio has joined #ruby
paranoicsan has joined #ruby
foxxx0 has joined #ruby
laaron- has joined #ruby
minacat has joined #ruby
<minacat> join #elm
minacat has left #ruby [#ruby]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
yasumi2136 has joined #ruby
BH23 has quit [Ping timeout: 250 seconds]
yasumi2136 has quit [Quit: Konversation terminated!]
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
nowhere_man has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
BH23 has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
govg has joined #ruby
lucasb has joined #ruby
dviola has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
Mortomes|Work_ has quit [Ping timeout: 256 seconds]
cgfbee has joined #ruby
omegaxis has joined #ruby
s2013 has joined #ruby
cgfbee has quit [Remote host closed the connection]
omegaxis has quit [Quit: leaving]
omegaxis has joined #ruby
omegaxis has quit [Client Quit]
cd has quit [Quit: cd]
omegaxis has joined #ruby
Leifr has joined #ruby
AJA4350 has joined #ruby
duderonomy has joined #ruby
bmurt has joined #ruby
<ntt> hello, is there a way to make mandatory an attribute in a class? I cannot use ActiveRecord validation because I inherit table structure from an existend db and I cannot write directly on the database (through save() method).
<ntt> I'd like to return an error if I don't pass some params to the new() method and not create the istance of the object
paranoicsan has quit [Quit: paranoicsan]
omegaxis has quit [Ping timeout: 250 seconds]
Tuor has joined #ruby
stryek has joined #ruby
dviola has quit [Ping timeout: 252 seconds]
jgpawletko has joined #ruby
clemens3 has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has joined #ruby
za1b1tsu has joined #ruby
cranq has quit [Ping timeout: 272 seconds]
Dbugger has joined #ruby
conta has quit [Ping timeout: 246 seconds]
<phaul> ntt: try #RubyOnRails. I can conjure up generic ruby solutions for an arbitrary class, that you controll initialize of, and where attributes are just class attributes. but activerecord/model is slightly different
KeyJoo has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
davidw_ has joined #ruby
Bish has joined #ruby
<Bish> does somebody here know a good trick to ignore tests when using the github search
Rapture has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jottr has quit [Quit: WeeChat 2.3]
polishdub has joined #ruby
Inline has joined #ruby
rippa has joined #ruby
bmurt has quit [Quit: Textual IRC Client: www.textualapp.com]
DTZUZO_ has joined #ruby
keden has quit [Ping timeout: 244 seconds]
bak1an has joined #ruby
keden has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
s2013 has joined #ruby
aupadhye has quit [Quit: Leaving]
bak1an has quit [Quit: Textual IRC Client: www.textualapp.com]
omegaxis has joined #ruby
omegaxis has left #ruby [#ruby]
Bish has quit [Ping timeout: 246 seconds]
cranq has joined #ruby
brandoncc has joined #ruby
brandoncc has quit [Client Quit]
sonofentropy has quit [Quit: sonofentropy]
brandoncc has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
liya has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
BH23 has quit [Ping timeout: 240 seconds]
snuz has joined #ruby
snuz has quit [Client Quit]
conta has quit [Ping timeout: 240 seconds]
lucasb has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
maryo has joined #ruby
dellavg_ has quit [Ping timeout: 250 seconds]
<maryo> canton7, if you have a moment can you look at this modification -> https://dpaste.de/sgyk#L24 and tell me whether the File closure is happening properly? Or I am missing something there?
\void has joined #ruby
bruce_lee has joined #ruby
<canton7> maryo, you call File.open on line 22, and assign that to 'f'. Then you try and open *another* file on line 24, but you don't say that filename to open...
<canton7> maryo, https://dpaste.de/CV6R#L24,26
TomyLobo has joined #ruby
<canton7> (which is what I sent you yesterday)
s2013 has joined #ruby
<maryo> canton7, thanks a lot o/
orbyt_ has joined #ruby
vertz has joined #ruby
vertz has left #ruby [#ruby]
SyedAsif has joined #ruby
Cavallari has joined #ruby
dellavg_ has joined #ruby
matchaw_ is now known as matchaw
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maryo has quit [Quit: Leaving]
sonofentropy has joined #ruby
Cavallari has quit [Quit: Cavallari]
omegaxis has joined #ruby
<omegaxis> hi, how can i use osmesa in ruby?
aufi has quit [Remote host closed the connection]
orbyt_ has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
\void has joined #ruby
maryo has joined #ruby
code_zombie has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brandoncc has joined #ruby
omegaxis has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
maryo has quit [Quit: Leaving]
al2o3-cr has quit [Quit: WeeChat 2.3]
maryo has joined #ruby
al2o3-cr has joined #ruby
nowhere_man has joined #ruby
orbyt_ has joined #ruby
Tuor has quit [Quit: Konversation terminated!]
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
lxsameer has joined #ruby
nowhere_man has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
ixti has joined #ruby
<ixti> Hi all!
<phaul> hi ixti
<ixti> Is there any nice way to unescape string (not #dump'ed) lie this one: `'[\x22foo\x22,\x22bar\\u1234\x22]'`
<ixti> Easiest way I found is `eval %("#{string}")`
<ixti> but that's not good (due to some obvious reasons).
gix has joined #ruby
<ixti> I guess the only way is to actually replace all `/\\x\h{2}` sequences manually.
<ixti> and `\\\\` with `\\`
maryo_ has joined #ruby
keden has quit [Ping timeout: 245 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
maryo has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
s2013 has joined #ruby
s2013 has quit [Client Quit]
mikecmpbll has joined #ruby
Blaguvest has quit [Remote host closed the connection]
conta has joined #ruby
<ixti> Ended up by using `gsub!`
<al2o3-cr> ixti: %("#{str.sub("\\u1234", '')}").undump
nfk has joined #ruby
<ixti> Hm... Gonna try that
<al2o3-cr> for this particular string.
<ixti> Yeah. but that was just a very dummy and stupid example
<ixti> real one is a JSON escaped for JS
<ixti> I guess I had to start from that :D
<al2o3-cr> you can undump if hex and unicode aren't mixed, hence the sub otherwise good to go.
<ixti> and if i'm on ruby 2.5 ;))
<al2o3-cr> ixti: what ruby you using?
<ixti> where I need this - 2.4.4
<ixti> I can use a shim for that (backports gem has it)
<al2o3-cr> i thought undump was way before that.
<al2o3-cr> apparently not.
tdy has quit [Ping timeout: 268 seconds]
<ixti> :D
<ixti> Thank you for the tip
<al2o3-cr> ;) np.
<ixti> Tried `undump` (on ruby 2.6) for the real string I had - works like a charm
<ixti> So I'm gonna add a note for myself to switch to undump once ruby is upgraded
kapil____ has joined #ruby
ramfjord has quit [Ping timeout: 245 seconds]
<al2o3-cr> ixti: is it possible to show the real escaped json?
<al2o3-cr> there might be a better way.
<ixti> Sure. one sec.
<al2o3-cr> ok.
<al2o3-cr> checking.
bijan_ has joined #ruby
bijan_ has quit [Client Quit]
<al2o3-cr> computer says no :P
<ixti> :D
<ixti> Thanks! :D
AJA4351 has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
nowhere_man has quit [Ping timeout: 252 seconds]
keden has joined #ruby
tdy has joined #ruby
conta has quit [Quit: conta]
jinie_ has joined #ruby
Guest16678 has quit [Ping timeout: 250 seconds]
rupam123456 has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
cranq has quit [Ping timeout: 246 seconds]
ellcs has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
cranq has joined #ruby
conta has joined #ruby
AJA4350 has joined #ruby
reber has joined #ruby
conta has quit [Ping timeout: 246 seconds]
ravenousmoose has joined #ruby
tdy has quit [Read error: Connection reset by peer]
troulouliou_div2 has joined #ruby
nowhere_man has joined #ruby
ivanskie has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
Sembei has quit [Ping timeout: 240 seconds]
ivanskie has quit [Client Quit]
cnsvc has joined #ruby
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
conta has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
roshanavand has joined #ruby
conta has quit [Ping timeout: 250 seconds]
reber has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<Nirvash> When using splat to accept variable parameters in a method, is there any reason why *args.inject(0){|sum,x| sum+x} would fail?
<Nirvash> I'm getting "unexpected \n" but it makes no sense
<phaul> inject works in an array. args is an array of numbers? then don't splat
<phaul> on*
<phaul> &>> [1,2,3].inject(0, :+) # Nirvash
<rubydoc> # => 6 (https://carc.in/#/r/649m)
cubillosxy_py has joined #ruby
<phaul> when you pass *args as argument, then args is an array in your method no splat needed.. If you want to fill a method call with arguments from an array you do method_call(*ary)
<phaul> btw in recent enough rubies there is also sum
<phaul> &>> [1,2,3].sum
<rubydoc> # => 6 (https://carc.in/#/r/649s)
jtdowney has quit [Quit: jtdowney]
jtdowney has joined #ruby
ellcs has joined #ruby
<Nirvash> I see, thank you for that explanation! What I'm trying to do is get a method to accept multiple inputs that may change
AJA4351 has joined #ruby
Rapture has joined #ruby
<phaul> &>> def f(*args); args.sum; end; f(1,2,3)
<rubydoc> # => 6 (https://carc.in/#/r/649v)
<Nirvash> For instance add(1,2) and add(1,2,3) would both work
<Nirvash> "should" both work...
akem has joined #ruby
<phaul> Nirvash: the method signature still does *args, but in the body args is the array
<phaul> see my latest example
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
drale2k_ has joined #ruby
<baweaver> Ohai phaul
<phaul> hi baweaver , how's it hangin?
<phaul> :)
<baweaver> Good good, made some progress on s-expressions and code transformations.
<baweaver> Rubocop has an entire regex-style syntax language for it
drale2k_ has quit [Remote host closed the connection]
<phaul> cool stuff.. sounds interesting.
<baweaver> Ultimate goal is to get a clean upgrade of Rails automated
<baweaver> I think it's possible, just hard.
<phaul> uh, that's a project that actually would be useful. I think I can envisage how one might put it together. Are you open for contributions?
<phaul> I've just seen a post on reddit btw about matching rules on sexps. was that also you?
<phaul> let me try finding it...
<Nirvash> Thank you phaul! I'm just trying to get .sum working now for fun :)
<baweaver> Recently no, but my next stream is on basically this exact subject.
<baweaver> Speaking of, I need to get that event made later.
<Nirvash> Just had to require the correct libraries — thank you all! :)
<cubillosxy_py> hi there someone knows a standar crypt and decrypt that works also in other languages, (python)
Dbugger has quit [Ping timeout: 250 seconds]
<phaul> baweaver: sorry, I can't find it
<phaul> rot13 :) works everywhere
* phaul apologises
<baweaver> Technically all of them
<baweaver> ciphers are language agnostic
blackmesa has quit [Ping timeout: 264 seconds]
<havenwood> cubillosxy_py: I'd suggest looking at Ed25519 JWTs for the strong encryption and standard format.
<havenwood> cubillosxy_py: Here's an example of an Ed25519 algo JWT in Ruby: https://gist.github.com/havenwood/b0191cb6749c9c8dc4fb3685961a6916
kapil____ has quit [Quit: Connection closed for inactivity]
govg has quit [Ping timeout: 268 seconds]
<cubillosxy_py> havenwood, thanks i gonna check
blackmesa has joined #ruby
themsay has joined #ruby
AJA4351 has joined #ruby
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
SeepingN has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
blackmesa1 has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
sonofentropy has quit [Quit: sonofentropy]
lytol_ has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
sonofentropy has joined #ruby
roshanavand has quit [Ping timeout: 268 seconds]
segy has joined #ruby
nowhere_man has quit [Ping timeout: 252 seconds]
dellavg_ has quit [Ping timeout: 268 seconds]
roshanavand has joined #ruby
Fernando-Basso has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4351 is now known as AJA4350
segy has quit [Ping timeout: 268 seconds]
KeyJoo has quit [Quit: KeyJoo]
cd has joined #ruby
duderonomy has joined #ruby
segy has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
houhoulis has joined #ruby
kapil____ has joined #ruby
ramfjord has joined #ruby
DTZUZO_ has quit [Quit: WeeChat 2.0]
DTZUZO has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
moei has quit [Quit: Leaving...]
keden has quit [Ping timeout: 272 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
galaxie has joined #ruby
<galaxie> I'm trying to figure out what alternatives I have to using a global variable in a medium-sized project of mine.
<galaxie> Basically I want it global because there's a lot of classes that need to access, say, the database connection instance or some config stuff or temporary data.
<phaul> first idea singleton container class?
AJA4350 has joined #ruby
Leifr has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<galaxie> I've read a little on that, but I'm not sure why it would be better. $global_var versus Global.instance doesn't seem like much a difference
<phaul> as opposed to everybody freely modifying it, the modification of the value still channeled through the class interface
<galaxie> It's just one big hash?
<phaul> not necesarilly. Representation is completely up to what it stores.
<elomatreb> The pattern also has more benefits when testing, since you can start to use things like mock objects
<galaxie> How would that be different than using a different hash?
<phaul> the modifications are all through your predefined class interface
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<phaul> you can mock, log, stop it from happening, whatever you need
<galaxie> Again, why couldn't I do that with a Hash or special class?
<phaul> ah. that's not a good idea in general. Inheriting or modifying built in Hash
<galaxie> Didn't think so. But making a class with getters and setters is, well, there's not much difference.
<elomatreb> At a certain point you are right, they are technically very similar and the difference is at least partially aesthetic
<elomatreb> But using a singleton class with a method-based interface is definitely the preferred pattern in the larger ruby community, instead of exposing global "primitive" objects
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
cubillosxy_py has quit [Ping timeout: 250 seconds]
keden has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
ur5us has joined #ruby
ramfjord has quit [Ping timeout: 244 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
<phaul> just thinking aloud... modifying Hash is obvious why not a good idea. inheriting from Hash is Ok as sonlg as you are creating a general purpose key value store container that works and behaves as such everywhere. But having a hash inside and delegate certain stuff to hash liberates you from all that..
<phaul> if it's hash like data you want to store globally ofc
ravenousmoose[aw has joined #ruby
ravenousmoose[aw has quit [Client Quit]
themsay has quit [Ping timeout: 246 seconds]
themsay has joined #ruby
polishdub has quit [Remote host closed the connection]
gix has quit [Disconnected by services]
tdy has joined #ruby
<galaxie> I decided I'd use i18n for internationalization, but I'm not sure what feature I'm looking for. Basically my locale files include strings that are formatted like in C's printf, so that calls to localize pass those variables and they are substituted in. What am I looking for here?
mat_bug has joined #ruby
nowhere_man has joined #ruby
mat_bug has quit [Ping timeout: 252 seconds]
<galaxie> Or do I need to override something somewhere?
houhoulis has quit [Remote host closed the connection]
planigan has quit [Ping timeout: 250 seconds]
troulouliou_div2 has quit [Read error: Connection reset by peer]
roshanavand has quit [Remote host closed the connection]
ramfjord has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
maryo_ has quit [Ping timeout: 245 seconds]
s2013 has joined #ruby
FernandoBasso has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
Fernando-Basso has quit [Ping timeout: 252 seconds]
ur5us has quit [Read error: Connection reset by peer]
planigan has joined #ruby
FernandoBasso has quit [Remote host closed the connection]
mat_bug has joined #ruby
* baweaver reads backlog
<baweaver> The reason I'd avoid using a Hash directly is that you can't control what consumers have access to galaxie. In general you want to give the least amount of power and control possible to consumers of code.
<baweaver> As to _why_ you want to do that, if you ever have to refactor it's a mess to clean up a loose interface that's propagated for a few years.
<baweaver> It also lets you define methods and your own API on top of it for accessing things, rather than just a KV store. Your downstream code should not know how to connect to a database, that's none of its business.
<galaxie> I'm sorry, consumers of code?
<baweaver> It should only know that if it sends these values to this other class it has a way to update the database.
<baweaver> Otherwise you end up with your database configuration plastered everywhere in your code.
<baweaver> Every place you perform a db connection using something like that is a consumer
<baweaver> A consumer of a class is something that uses it
bruce_lee has quit [Remote host closed the connection]
<galaxie> No, the DB connection is stored in the hash.
<baweaver> What if the connection fails?
<baweaver> How does the client retry? How does it handle load balancing?
<baweaver> By wrapping that in a class you have more control over these things than just passing a value.
<baweaver> Granted you don't always need that level of granularity
<baweaver> Typically I use classes to define the API I want any code that calls it to see. Giving too much information means implementation details leak
<galaxie> The DB connection would probably be a class that handles everything and the consumer just gives it a query.
<baweaver> ( brb )