rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nOwz has joined #ruby
Snickers has quit [Quit: Snickers]
d3d1rty has quit [Ping timeout: 264 seconds]
nOwz has quit [Ping timeout: 240 seconds]
Channel6 has joined #ruby
patarr has quit [Ping timeout: 246 seconds]
patarr has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
__Yiota has joined #ruby
dlitvak has joined #ruby
CloCkWeRX has quit [Ping timeout: 246 seconds]
al2o3-cr has quit [Quit: WeeChat 1.7]
mim1k has joined #ruby
<Disavowed>
Afternoon all. What is the idiomatic way to have optional arguments in Ruby? In Python my function signature would look like this: def test(a, b, c=None) - is the Ruby equivalent the way to go or is there a neater way?
meshsmith has joined #ruby
lupine has quit [Ping timeout: 256 seconds]
<nofxxxx>
Disavowed, same.... but I guess None is nil
JeanCarloMachado has quit [Ping timeout: 260 seconds]
<Disavowed>
This is exactly what I've been googling for! Don't know how I didn't hit upon it. Thank you so much
patarr has joined #ruby
<nofxxxx>
Disavowed, some call 'named parameters', first time I've seen 'keyword arguments' I believe hehe
<Disavowed>
keyword arguments seems more familiar to me but maybe whoever wrote this also came from a Python background
username1 has quit [Ping timeout: 240 seconds]
<Disavowed>
(optional named arguments would be this in Python: `def test (a, b, **kwargs):` but kwargs is just a convention.
TPug has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gnufied has quit [Ping timeout: 246 seconds]
montanonic has quit [Ping timeout: 246 seconds]
<nofxxxx>
Disavowed, in ruby -> def test(a, b, *opts) or def test(a, b, opts = {})
<nofxxxx>
opts also convention
acrux09 has joined #ruby
<Disavowed>
Oh neat - I wouldn't have known that were it not for you. Thank you.
<nofxxxx>
believe ** and * same... we call it 'splat'
<Disavowed>
Same I think :)
<nofxxxx>
cool, no prob
bocaneri has joined #ruby
patarr has quit [Ping timeout: 260 seconds]
cow[baby] has joined #ruby
<Disavowed>
I think I might take influence from your IRC handle and break out a little NOFX to get me through the rest of my Friday afternoon... it's been a while!
<adam12>
Jeez. Haven't heard that name in a while
<Disavowed>
Oh I have another remedial question: how can I ensure at least one value in a list is truthy? Like Python's any() builtin
<Disavowed>
adam12: Same
<adam12>
Disavowed: I'm having flashbacks to IRC circa 98/99?
postmodern has quit [Quit: Leaving]
<nofxxxx>
hehe download mIRC for that
<nofxxxx>
Disavowed, foo.any?
Guest80652 has quit [Ping timeout: 240 seconds]
<nofxxxx>
know the interrogation thing right? always returns bool Disavowed
<nofxxxx>
so if you're looking for bool, you're looking for a question hehe
benlieb has quit [Quit: benlieb]
<Disavowed>
nofxxxx: that was so obvious - I can't believe I didn't think of it
CloCkWeRX has joined #ruby
<nofxxxx>
Disavowed, ops..wait, I always confuse if it's a rails thing... if it doesn't work you need to: !foo.empty?
<Disavowed>
interogration thing is anything suffixed with a '?' ?
<nofxxxx>
yup
<Disavowed>
nice
<adam12>
any? is a thing
<adam12>
but you might need an arg for it?
<nofxxxx>
Disavowed, but I believe it's been added to ruby in 2.3 or 2.4 Disavowed
<nofxxxx>
adaedra, nope, it's just empty? negation
<adam12>
Guess not.
<Disavowed>
adam12: I didn't discover IRC until about 6 years ago so I can't reminisce with you there I'm afraid. I did listen to it on my own around that time though!
<nofxxxx>
actually very handy for readability
<nofxxxx>
!foo.empty? looks like ill written spanish
<Disavowed>
nofxxxx: you're a saint. Thank you. That behaves exactly as I expected it
TPug has joined #ruby
<adam12>
Disavowed: I was in a HUGE irc channel back in the mid-late 90s for the area I lived in. It was impressive to see 1000's of people chatting, over dialup mostly, in the afternoons/evenings. I bet I met (IRL) a few hundred people over the time I spent on IRC.
<Disavowed>
From an English guy who doesn't know much about Spanish, it absolutely does!
Roa_ is now known as Roa
Nicmavr has joined #ruby
Roa has quit [Changing host]
Roa has joined #ruby
<Disavowed>
adam12: See, that's the internet I miss
<adam12>
Disavowed: Anyways, I think NOFX was a thing back then, and someone had a nick to that regard.
Nicmavr is now known as Guest37211
<Disavowed>
adam12: I'm with you. It ties in well. I think NOFX are still going as a band!
<adam12>
Had no idea.
<adam12>
Thew me back just seeing it mentioned - like I was running BitchX on Slackware.
<nofxxxx>
adam12, also, you make contact with ppl different than you.. that's a win win, social networks insanely tries to "match" friends for you
<adam12>
Anyways, probably more suitable for ruby-offtopic :P
patarr has joined #ruby
<Disavowed>
The thing I like about this channel is that it's much more accomodating of these particular slides. This would never fly in Python.
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb>
adam12, Disavowed, y'all welcome in #ruby-offtopic no one's even hangman-ing in there right now!
<adam12>
:O
<Disavowed>
Papierkorb: I'm lurking!
<Disavowed>
It's much quieter than python-offtopic
LuckyABA has joined #ruby
duckpupp1 has joined #ruby
milardovich has quit [Remote host closed the connection]
Verity has joined #ruby
milardovich has joined #ruby
nitric has quit [Ping timeout: 260 seconds]
patarr has quit [Ping timeout: 268 seconds]
Rodya_ has joined #ruby
<Verity>
refers to packet more than self, maybe move it to a class? what is this reek error all abhout
duckpupp1 has quit [Ping timeout: 256 seconds]
<matthewd>
Verity: It's accusing your method of feature envy
<Disavowed>
Could anyone point me in the direction of the smart way of handling hashes in rspec? I am mutating unintentionally.
<Disavowed>
Oh is it let binding?
milardovich has quit [Ping timeout: 260 seconds]
meshsmith has quit [Remote host closed the connection]
benlieb has joined #ruby
patarr has joined #ruby
benlieb has quit [Client Quit]
Rodya_ has quit [Ping timeout: 246 seconds]
houhoulis has quit [Remote host closed the connection]
patarr has quit [Ping timeout: 264 seconds]
patarr has joined #ruby
gregf_ has quit [Ping timeout: 260 seconds]
alibby has joined #ruby
postmodern has joined #ruby
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
patarr has quit [Ping timeout: 256 seconds]
bkxd has joined #ruby
patarr has joined #ruby
juggler has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
<Verity>
matthewd, I dont know what that is
<Verity>
should I be moving to a class now?
<Verity>
I'm still loving ruby, btw
<Verity>
even if its made this assignment more difficult in the short term
hndk has joined #ruby
sepp2k has quit [Ping timeout: 240 seconds]
<agent_white>
Disavowed: How are you mutating them?
<agent_white>
!code
<allisio>
!postcode
<Verity>
!showcode
<agent_white>
!helloweneedthecode
<allisio>
!allyourcodearebelongtous
cfec0b8d has quit [Remote host closed the connection]
TPug has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Verity>
forget the fact that sendpacket doesnt actually SEND them correctly yet, it does print them though
harfangk has joined #ruby
JeanCarloMachado has joined #ruby
patarr has quit [Ping timeout: 268 seconds]
<adam12>
I'd say you definitely have at least a Packet class, and probably some sort of Packet collection
Beverage1 has quit [Quit: Leaving]
patarr has joined #ruby
<matthewd>
I'd start with the packet-building duplication in build_packet_array
<agent_white>
Hehe line 84. I like how it looks
houhoulis has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
<agent_white>
Verity: 63 just for debugging? Wonder why you didn't nest.
<agent_white>
I like your code doe. Nice and neat. Like fresh shower neat.
JeanCarloMachado has quit [Ping timeout: 258 seconds]
<Verity>
let me go over the suggestions
JeanCarloMachado has joined #ruby
juggler has quit [Quit: Leaving]
DTZUZO has joined #ruby
majuscul1 is now known as majuscule
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
patarr has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JeanCarloMachado has quit [Ping timeout: 246 seconds]
patarr has joined #ruby
JeanCarloMachado has joined #ruby
d^sh has quit [Ping timeout: 260 seconds]
Vile` has joined #ruby
d^sh has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
raspado has quit [Remote host closed the connection]
nowhere_man has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
libastral has quit [Ping timeout: 256 seconds]
alibby has quit [Quit: Leaving.]
nOwz has joined #ruby
retozon has joined #ruby
patarr has quit [Ping timeout: 264 seconds]
ozcanesen has joined #ruby
<retozon>
hello
edgr has quit [Ping timeout: 260 seconds]
libastral has joined #ruby
znz_jp has quit [Remote host closed the connection]
nOwz has quit [Ping timeout: 260 seconds]
_aeris_ has quit [Ping timeout: 240 seconds]
edgr has joined #ruby
znz_jp has joined #ruby
<havenwood>
retozon: hi
jameser has joined #ruby
JeanCarloMachado has quit [Ping timeout: 256 seconds]
baweaver is now known as baweaver_away
JeanCarloMachado has joined #ruby
_aeris_ has joined #ruby
astrobunny has joined #ruby
bmurt has joined #ruby
mim1k has joined #ruby
AndrewIsHere has quit []
mim1k has quit [Ping timeout: 260 seconds]
Rodya_ has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
Vile` has quit [Ping timeout: 256 seconds]
gnufied has joined #ruby
CloCkWeRX has quit [Ping timeout: 240 seconds]
gusrub has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
JeanCarloMachado has joined #ruby
acrux09 has quit [Quit: ChatZilla 0.9.93 [Firefox 52.0.2/20170323105023]]
<Verity>
there is a differentce though, matthewd
<Verity>
-t
jeyraof^mbpr has joined #ruby
<matthewd>
I see the difference in the padding, if that's what you mean.. but that just sounds wrong to me
JeanCarloMachado has quit [Ping timeout: 260 seconds]
<Verity>
its for the case where the last packet has a message the full size
JeanCarloMachado has joined #ruby
<Verity>
then eot cant fit, so a final packet must be crafted consisting of SOHEOTPADPADPADPADCRC
skweek has quit [Read error: Connection reset by peer]
skweek has joined #ruby
gnufied has quit [Ping timeout: 246 seconds]
gnufied has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
t-recx has quit [Quit: t-recx]
<matthewd>
Verity: I know what it's doing, and I know what I said.. can you clarify what you heard?
howdoi has quit [Quit: Connection closed for inactivity]
JeanCarloMachado has joined #ruby
CloCkWeRX has joined #ruby
duckpupp1 has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
JeanCarloMachado has joined #ruby
houhoulis has quit [Remote host closed the connection]
duckpupp1 has quit [Ping timeout: 256 seconds]
JoshS has joined #ruby
HoierM has quit [Ping timeout: 240 seconds]
Channel6 has quit [Quit: Leaving]
knight33 has joined #ruby
<allisio>
Verity: May I offer a potentially brutal piece of constructive criticism?
charliesome has joined #ruby
bkxd has joined #ruby
<Verity>
allisio, sure
<allisio>
Verity: Line 84 strikes me as plainly indicative of the fact that you simply don't pay close enough attention to what you're doing while programming. That's going to be a continual source of frustration and disappointment for you if you don't nip it in the bud.
<Verity>
I'll consider that
Rodya_ has quit [Remote host closed the connection]
<allisio>
Thank you.
bkxd has quit [Ping timeout: 246 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JeanCarloMachado has quit [Ping timeout: 268 seconds]
<shad0>
anybody got much experience mixing bundler with docker?
shad0 is now known as randomluser
claw has quit [Ping timeout: 260 seconds]
claw has joined #ruby
Joufflu has quit [Quit: Leaving]
TPug has joined #ruby
agent_white has quit [Quit: agent_white]
agent_white has joined #ruby
<retozon>
what everone doing this evening
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<retozon>
i have this app idea I have been working on... just not sure where to put it.... I am certified in ruby but unsure of how to put it in layout format
<retozon>
also been working with python i am so confused right now
<retozon>
any ideas
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
raspado has joined #ruby
Rodya_ has joined #ruby
randomluser has quit [Quit: Leaving]
charliesome has joined #ruby
xall has joined #ruby
amclain has quit [Quit: Leaving]
nOwz has joined #ruby
raspado has quit [Ping timeout: 246 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
nOwz has quit [Ping timeout: 240 seconds]
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
_djbkd has joined #ruby
djbkd has quit [Ping timeout: 268 seconds]
milardovich has joined #ruby
mim1k has joined #ruby
herbmillerjr has joined #ruby
benlieb has joined #ruby
milardovich has quit [Ping timeout: 246 seconds]
mim1k has quit [Ping timeout: 260 seconds]
bkxd has joined #ruby
_djbkd has quit [Quit: My people need me...]
bkxd has quit [Ping timeout: 240 seconds]
meinside has joined #ruby
renchan has joined #ruby
retozon has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
KnownSyntax has quit [Quit: No Ping reply in 180 seconds.]
HoierM has joined #ruby
xall has joined #ruby
bkxd has joined #ruby
Burgestrand has joined #ruby
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
xall_ has quit [Ping timeout: 260 seconds]
KnownSyntax has joined #ruby
KnownSyntax has joined #ruby
KnownSyntax has quit [Changing host]
Rodya_ has joined #ruby
ssinghi has joined #ruby
ssinghi has quit [Client Quit]
j3ll3 has joined #ruby
bkxd has quit [Ping timeout: 246 seconds]
jgnagy has joined #ruby
j3ll3 has left #ruby ["WeeChat 1.7"]
TomyWork has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
username_ has joined #ruby
jgnagy has quit [Ping timeout: 256 seconds]
<TomyWork>
i want to write a little script that keeps track of when /tmp files are created or deleted. in order to query that from within another script, i need a lightweight (local?) key-value storage, preferably one that i dont need to install. I can only think of sqlite, but is there a more fitting choice maybe?
<TomyWork>
only has to work with ruby
username_ has quit [Ping timeout: 260 seconds]
<darix>
TomyWork: sqlite seems fine... but you can also just store it in memory.
<kke>
i have a thing with a kind of interactive console thing that goes like "while buf = Readline.readline(..) { run_command(buf) }" .. now i'm thinking that it needs to work with input like "((command1 || command2) && command3) && command4; command5". i'm guessing my best choice is to split(';'), regex replace the commands with "run_command('${command}')" and eval the whole thing
<adaedra>
are you trying to write a shell?
<kke>
yes
<kke>
kind of
Lord_of_Life has joined #ruby
<adaedra>
I suggest you write a real parser for your commands then
<adaedra>
eval()ing user-provided data is not a good idea
<kke>
that's what i'm thinking too
<adaedra>
and regexp'ing what you wrote above looks like a nightmare
t-recx has joined #ruby
<kke>
but if i escape it, i don't see how you could "break out"
<kke>
yes it does
<darix>
kke: you will find a lot of fun with different quoting things and such
stoffus has quit [Quit: leaving]
<TomyWork>
darix yes my plan was to use inotify. but you know what, i figured out that what i want to implement is essentially already done by the FS in the mtime field :)
nowhere_man has joined #ruby
<kke>
i think i only need to escape any single quotes
<kke>
the run_command thing itself doesn't do anything dangerous
<kke>
so as long as the user input remains inside that, it should be safe
ldnunes has joined #ruby
xall has quit [Ping timeout: 240 seconds]
<darix>
kke: if you call your commands via a shell
<matthewd>
If you're just turning it into a static string, what's the point of the eval?
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
Pumukel has quit [Remote host closed the connection]
jusa has quit [Ping timeout: 260 seconds]
Pumukel has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
Pumukel has quit [Ping timeout: 240 seconds]
<kke>
thinking about turning something like "(foo || bar) && baz" into eval("(perform('foo') || perform('bar')) && perform('baz')")
mim1k has quit [Ping timeout: 240 seconds]
<kke>
unless you can come up with a way to break out of the '..'
esObe_ has quit [Ping timeout: 240 seconds]
esObe_ has joined #ruby
Pumukel has joined #ruby
patarr has joined #ruby
vondruch has quit [Quit: vondruch]
loechel has joined #ruby
Pumukel has quit [Remote host closed the connection]
loechel has quit [Remote host closed the connection]
Pumukel has joined #ruby
charliesome has joined #ruby
vondruch has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
charliesome has quit [Ping timeout: 256 seconds]
vuoto has joined #ruby
charliesome has joined #ruby
<ikopico>
Hey peep-chaps, can someone suggest which is preffered, $stderr/STDERR ($stdout/STDOUT)?
<kke>
ikopico: $
<Verity>
allisio, I don't see the issue with line 84 unless you just mean the fact thats its rather poor checking of proper usage
<ikopico>
Thanks kke, can you please explain why?
<Verity>
as in, I only check if the proper # of args have been entered, but nothing beyond that
<Verity>
matthewd, are you suggesting that I rewrite that function such that it takes two variables
<kke>
ikopico: $ you can change. for example in tests or something you might want to do something like output = StringIO.new; $stdout = output; run_command(); $stdout.rewind; expect($stdout.read).to match(/foofoo/)
<Verity>
one the packet list to return, and another to either build a data packet or final eot packet
<ytti>
$stderr/STDERR is tricky one
<ikopico>
Awesome kke, thanks a lot.
<ytti>
on principle i hate all global variables
<matthewd>
ikopico: Kernel#puts, #warn, etc use $stdout/$stderr
<Verity>
then I just run my eot sent test using global var and call the func with true or false for 2nd arg
<ytti>
but then again, you can change $stderr
<Verity>
but that doesnts eem much better, maybe if it were inside a class and had state
<ytti>
but i'm s till gonna go with STDERR and STDOUT
<ytti>
i don't think ruby code should have single global variable in them
<Verity>
and finally, adam12 could you give me a couple tips about how I might structure such a class? I'm not quite sure how to tell when I need a class, and how to structure and use one when i do
<ikopico>
ytti: yes, but you can say also that having STDERR as const it's unnatural
<matthewd>
Verity: I think you want a function that takes a <= 5 character string and returns a built packet
<ikopico>
matthewd: thanks
<matthewd>
Verity: You're doing that twice at the moment.
<canton7>
ytti, the normal approach (irrc) is to use the globals, since you can e.g. fiddle them for testing, and the constants are to be used as "backups" to reset the globals
<kke>
$stderr and $stdout are going to point to STDERR and STDOUT unless something deliberately wants to redirect ouput.
<kke>
in that case, i suppose it's annoying that your thing didn't respect $stdout/err but insisted on using the real STDOUT/ERR
<ytti>
i disagree
<ytti>
if i want code where i intend err/out to be changable
<ytti>
i'll create my own outputter, which can be instansiated with arbitrary outputs
arquebus has joined #ruby
CloCkWeRX has joined #ruby
<ytti>
if i strictly mean STDOUT/STDERR, i'll use those
<ytti>
$stderr, $stdout are ambiguous
<ytti>
does the developer mean strictly those
<ytti>
or just use them as well known, pre-assigned variables?
<ikopico>
ytti: I think that it's more of changable for testing, not for usage
<ytti>
but of course this is higly opinionated stuff
<matthewd>
ytti: How are the constants truly different from the globals for that? Someone could equally change those.
<ytti>
yes
<ytti>
it's just style issue, no one expects STDOUT/STDERR to be changed
<ytti>
the code communicates by haivng those 'these are static'
<ytti>
which may or may not be true
<ytti>
but that is the implicit promise
cgibsonmm has joined #ruby
<kke>
do you expect $stdout/$stderr to contain something that is not intentional?
synthroid has joined #ruby
<kke>
since the kernel methods use those too, if you're messing with $stdout/err you will break kernel stuff too.
noem has joined #ruby
tolerablyjake has quit [Ping timeout: 246 seconds]
<ytti>
i don't know what developer means when they use those
<ytti>
did they choose them, because they fully intend to change them
<ytti>
or did they choose then, but fully intend to use them verbatim
vifino- is now known as vifino
zapata has quit [Ping timeout: 258 seconds]
x0f has quit [Ping timeout: 240 seconds]
noem has quit [Quit: noem]
jrafanie has joined #ruby
vuoto has quit [Remote host closed the connection]
x0f has joined #ruby
<ikopico>
Can we settle on IO.new(1)/IO.new(2)? :)
knight33 has joined #ruby
cow[baby] has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
last_staff has quit [Quit: last_staff]
zapata has joined #ruby
cats has quit [Quit: BURN HIS HOUSE DOWN]
cats has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
SimpleIRC_VLBcT has quit [Remote host closed the connection]
CloCkWeRX has joined #ruby
boz_ has joined #ruby
mim1k has joined #ruby
patarr has joined #ruby
aupadhye has joined #ruby
patarr has quit [Ping timeout: 260 seconds]
<Verity>
I'll think this over
<Verity>
I think the most important suggestion of all is that its likely time for a class
<Verity>
migrating to that without breaking my program will be the key
<Verity>
I've never designed or used my own classes, only others
<Verity>
well, once or twice a while back in C++
<Verity>
I did make a linked list class
<Verity>
so I want to create a class that represents a serial connection? and contains the packet array and functions that operate on it?
<Verity>
and the constructor will open the serial port
<Verity>
and take the com port as arg
<canton7>
constructors shouldn't normally do things that make take a long time or randomly fail
<canton7>
you'd normally see an 'open' method to open the port
<Verity>
hmm, ok. Lots to consider here
s2013 has joined #ruby
jrafanie has joined #ruby
boz_ has quit []
jrafanie has quit [Client Quit]
bmurt has joined #ruby
gnufied has joined #ruby
yurikoles has joined #ruby
vali has quit [Quit: vali]
banisterfiend has joined #ruby
aupadhye has quit [Remote host closed the connection]
jrafanie has joined #ruby
aupadhye has joined #ruby
s2013 has quit [Read error: No route to host]
harfangk has joined #ruby
Deviation has joined #ruby
jrafanie has quit [Client Quit]
<Verity>
I also need to consider that this will be changed to TCP from serial later
<Verity>
it would be nice if through classes that was an easy switch (thats one of the main points of the lab)
millerti has quit [Read error: Connection reset by peer]
millerti has joined #ruby
uncertainty has joined #ruby
renchan has quit [Quit: Leaving...]
flying has quit []
<Verity>
so in C++//C# we would have made a base class port with abstract methods and then derived two new classes from it, serialport and tcpport class
<Verity>
then I would set them up so they take the same args, connection string to determine type of conn. then methods the same like read and write
<Verity>
but in ruby, I read you wouldn't do it the same way
s2013 has joined #ruby
Deviation has quit [Ping timeout: 240 seconds]
<Verity>
the goal being a universal interface between the two classes
<Verity>
so they are interchangeable
<Verity>
at least this is my understanding of it all
<Verity>
I'm going to work on ASM lab for a while, back later hopefully someone has some advice for me
enterprisey has joined #ruby
fuzzyhorns has joined #ruby
aupadhye is now known as aupadhye|brb
sepp2k has joined #ruby
enterprisey has quit [Remote host closed the connection]
<manveru>
no idea, but it sounds like logs for aws
<Bish>
THAT SOUNDS LIKE NO WORK
<Bish>
AWS CloudWatch logs for Humans™
<Bish>
haha, that fitting name
<Bish>
so workflow would be: print to stdout, let amazon log everything, until the bill gets too high
<manveru>
"AWS Free Tier includes 10 Metrics, 10 Alarms, and 1,000,000 API requests with Amazon CloudWatch."
ResidentBiscuit has joined #ruby
<manveru>
should be enough to get started and locked in a bit more to AWS ;)
<Bish>
well, would i be able to select a type of log that way?
<Bish>
my logs would be tied to the docker container.. which could throw all sorts of errors
<Bish>
i imagine logging to be like [auth] user tried to login
<Bish>
[hw] my core is at 10%
<Bish>
i dunno
<manveru>
yeah
<manveru>
usually you can filter those lines
<Bish>
ah.. so i do the filtering on the lines
<Bish>
yeah that'd be clever.
<manveru>
then set alerts for things like "Segfault"
<Bish>
okay cool thanks alot manveru
<Bish>
ruby doesn't segfault right
<manveru>
right...
Rodya_ has joined #ruby
<manveru>
never
<manveru>
ever
<Bish>
it's like macbooks
<Bish>
they dont break
<manveru>
exactly :D
<Bish>
how do you know im sarcastic :D i've heard people saying that
<manveru>
well, i've seen enough broken ones
<manveru>
the case though, that probably won't break
<Bish>
when i was studying it, there was a tv channel visiting my uni (where i worked)
<Bish>
and a guy, that had windows on his macbook
<Bish>
the cameraman asked him "why do you have windows on your macbook"
ResidentBiscuit has quit [Client Quit]
<Bish>
$itdude "my macbook just reset itself, due to a hardware issue, yadda yadda, not using osx since then"
Guest18348 is now known as rprimus
<Bish>
cameraman "no, thats your fault, you must've done something wrong, macbooks dont break"
<manveru>
lol
<Bish>
he said to the guy, nearly finished with his phd in cs
<manveru>
well, about ruby, it'll of course segfault sometimes, especially if you use gems with C extensions
tau has joined #ruby
tvw has quit [Read error: Connection reset by peer]
tvw has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
flying has quit []
mim1k has joined #ruby
GreySunshine has left #ruby [#ruby]
<Bish>
i think i saw one segfault in ruby
<Bish>
and many in rubinius
haylon_ has joined #ruby
cfec0b8d has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
jrafanie has joined #ruby
armando has quit [Remote host closed the connection]
LuckyABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
DLSteve has joined #ruby
enterprisey has quit [Remote host closed the connection]
aganov has quit [Remote host closed the connection]
armando has joined #ruby
JeanCarloMachado has quit [Quit: Lost terminal]
itsdaflash has joined #ruby
Mon_Ouie has joined #ruby
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
haylon_ has quit [Quit: Leaving]
benlieb has joined #ruby
jeanlinux has joined #ruby
Lord_of_Life has quit [Excess Flood]
xall has joined #ruby
enterprisey has joined #ruby
<itsdaflash>
Hi, I was curious if anyone may be able to offer some insight. I am trying to complete two things. I'd like to search an array called rmq_federation_nodes which contains the following elements ["rabbitmq1.devops.local", "rabbitmq2.devops.local", "rabbitmq3.devops.local"] and grab out an element matching the first part of the regex pattern (as the environment in this case devops could change).
<itsdaflash>
Example, the element matching rabbit1, I assign to a variable rabbit1, and rabbit2, to variable rabbit2...etc. Second, id like to pull out the element matching that same regex pattern and convert it to a string and assign to a separate variable. I completed the below:
<itsdaflash>
puts nodeB
<itsdaflash>
puts nodeA
<itsdaflash>
puts nodeC
<itsdaflash>
rabbitmq1.arxdevops.local
<itsdaflash>
rabbitmq2.arxdevops.local
<itsdaflash>
rabbitmq3.arxdevops.local
<itsdaflash>
The above gives me the string, from what I can tell, but is there a way to get select the actual element also?
jgnagy has joined #ruby
Lord_of_Life has joined #ruby
renchan has joined #ruby
<Mon_Ouie>
What do you mean by "the actual element"?
<Bish>
i think he wants the match, too, maybe?
renchan has quit [Remote host closed the connection]
<Mon_Ouie>
Also, please use gist when pasting three lines of code or more
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renchan has joined #ruby
<itsdaflash>
Sorry, by element I just mean that I would like to obtain ["rabbitmq1.arxdevops.local"] if it matches rabbitmq1*
<Mon_Ouie>
That's what select is returning here
<Bish>
but you get the elements that match in an array
<itsdaflash>
ideally, i'd like one to remain a single element array and the other a string
<Bish>
well, it's not given that only one string matches your rule, and all of those are strings
fmartingr has quit [Quit: Connection closed for inactivity]
<Bish>
but find is actually returning the first it finds, it doesn't make sure there is only one
<itsdaflash>
sorry, maybe I am confusing element. I just mean i'd like to search the array and find a match for rabbit1*, if it matches then id like to store that attribute. I'd then also like to complete the same search but strip the [" "] part and store as a string
grh has joined #ruby
<Bish>
store? where, what is an attribute :D
jusa has joined #ruby
<Bish>
and what [" "] part
<itsdaflash>
My array being rmq_federation_nodes = ["rabbitmq1.arxdevops.local", "rabbitmq2.arxdevops.local", "rabbitmq3.arxdevops.local"]. Pull out this from the array ["rabbitmq1.arxdevops.local"] based on a regex match and store as a single element array, then also search the same array and store as rabbitmq1.arxdevops.local
s2013 has joined #ruby
<Bish>
>My array being rmq_federation_nodes = ["rabbitmq1.arxdevops.local", "rabbitmq2.arxdevops.local", "rabbitmq3.arxdevops.local"]. Pull out this from
<Bish>
the array ["rabbitmq1.arxdevops.local"] based on a regex match and store as a single element array
<Bish>
thats what your code does already
<Bish>
the second part of that question i still dont get
<Bish>
store as "rabbitmq1.arxdevops.local"
polishdub has joined #ruby
<Mon_Ouie>
You can just use #first to get the first/only element of the array
<itsdaflash>
Yeah, I was pulling it out as rmq_federation_nodes[0], but in chef sometimes not all the nodes will registered, so I was having an issue where the position could change, even with a sort
<itsdaflash>
So, I was recoding it to instead search the array for the fqdn
jrafanie has joined #ruby
<itsdaflash>
and assign that as a variable for later use in my recipe. Problem is, my recipe needs that fqdn as an actual attribute in one section to determine what to actually apply and in another it requires it as a string
jrafanie has quit [Client Quit]
antgel has joined #ruby
grillon has joined #ruby
jrafanie has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
enterprisey has quit [Remote host closed the connection]
vcavallo has quit [Quit: leaving]
vcavallo has joined #ruby
Snickers has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
DLSteve has joined #ruby
aufi has quit [Quit: Leaving]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ResidentBiscuit has joined #ruby
Lord_of_Life has quit [Excess Flood]
enterprisey has joined #ruby
Deviation has joined #ruby
jrafanie has joined #ruby
Lord_of_Life has joined #ruby
jrafanie has quit [Client Quit]
loveablelobster has joined #ruby
[Butch] has joined #ruby
bmurt has joined #ruby
loveablelobster has quit [Client Quit]
rakm has joined #ruby
ozcanesen has joined #ruby
Pumukel has quit []
Deviation has quit [Ping timeout: 268 seconds]
djbkd has joined #ruby
conta has quit [Ping timeout: 240 seconds]
grh has quit [Ping timeout: 246 seconds]
vuoto has joined #ruby
synbit has joined #ruby
vuoto has quit [Client Quit]
vuoto has joined #ruby
destructure has quit [Changing host]
destructure has joined #ruby
username_ has joined #ruby
igeaod has joined #ruby
djbkd has quit [Ping timeout: 268 seconds]
igeaod has quit [Remote host closed the connection]
synbit has quit [Client Quit]
visudo has joined #ruby
visudo has quit [Client Quit]
cgibsonmm has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
Anybody have a preferred option parser outside of `OptionParser` in stdlib? Something that can change the options depending on ARGV[0] (or equiv)
nadir has joined #ruby
<adam12>
(git style subcommands)
hxegon is now known as hxegon_afk
raspado has joined #ruby
grh has joined #ruby
<manveru>
adam12: i think people usually use thor for that
cgibsonm_ has joined #ruby
<adam12>
You might be right - I don't care for Thor tho. I just want to parse ARGV. I think Thor wants me to structure commands a lot differently.
<adam12>
Maybe trollop?
mikecmpbll has quit [Quit: inabit. zz.]
skweek has joined #ruby
armyriad has quit [Ping timeout: 240 seconds]
<adam12>
or commander? Lots of options I guess.
armyriad has joined #ruby
raspado has quit [Ping timeout: 246 seconds]
cgibsonmm has quit [Ping timeout: 246 seconds]
rwb has joined #ruby
bmurt has joined #ruby
cgibsonm_ has quit [Remote host closed the connection]
enterprisey has joined #ruby
<havenwood>
adam12: Slop for simple options. Thor for more complex, git-like options.
aryaching has joined #ruby
marcdel has joined #ruby
Yzguy has joined #ruby
<adam12>
I'll re-look at Thor - thanks for feedback.
xall has quit [Ping timeout: 260 seconds]
mim1k has quit [Ping timeout: 256 seconds]
millerti has joined #ruby
millerti has quit [Client Quit]
gusrub has joined #ruby
xall has joined #ruby
cgibsonmm has joined #ruby
nitric has joined #ruby
jusa has quit [Ping timeout: 260 seconds]
mustmodify has joined #ruby
millerti has joined #ruby
<mustmodify>
ARRRGGHHHH
muelleme_ has joined #ruby
cow[baby] has quit [Quit: cow[baby]]
<mustmodify>
What method on hash gives you a hash with just the named keys? {a: 1, b: 2, c: 3}.some(:a, :b) => {a: 1, b: 2}
<Vadi>
and I'm just looking at the total_size key and it keeps coming out wrong in Ruby
<Vadi>
it will randomly change to be the right value (and that's how I confirm it's the right data) but I have not found a pattern as to when
<Vadi>
At this point I am attempting to just stuff the json response as-is into ruby instead of having it download
benlieb has quit [Client Quit]
<KevinMGranger>
Hmm, it comes out differently when I curl it versus in the browser. You should try setting your user-agent or simply say it's their fault and not yours :P
<Vadi>
Yeah I need it for a migration script
benlieb has joined #ruby
<elomatreb>
If it's like KevinMGranger describes there's little you can do about it, besides setting your useragent to something resembling a desktop browser
<elomatreb>
And I don't know if open-uri supports that
yqt has quit [Ping timeout: 240 seconds]
<Verity>
oh
<Verity>
allisio, never replied, what is wrong with line 84 other than being a poor test of proper input args
<Vadi>
I'll just a random param at the end. That seemed to work on the first try
pupsicle has quit [Remote host closed the connection]
<Vadi>
Thanks
Vadi has quit [Quit: Page closed]
pupsicle has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
pifon has joined #ruby
JoshS has quit [Ping timeout: 240 seconds]
<_sfiguser>
guys if i want to do a text editor... and want to implement the "undo" operation... should i use the memento pattern ?
DTZUZO has quit [Ping timeout: 260 seconds]
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Verity>
_sfiguser, you doing code audits
jusa has joined #ruby
DTZUZO has joined #ruby
rwb has joined #ruby
JoshS has joined #ruby
JoshS has quit [Read error: Connection reset by peer]
JoshS has joined #ruby
JoshS has quit [Read error: Connection reset by peer]
jusa has quit [Ping timeout: 260 seconds]
JoshS has joined #ruby
JoshS has quit [Read error: Connection reset by peer]
zipace has joined #ruby
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
oliv_____ has quit [Remote host closed the connection]
tvw has joined #ruby
pifon is now known as nomad101
ldnunes has quit [Quit: Leaving]
mim1k has joined #ruby
nomad101 is now known as pifon
<Papierkorb>
_sfiguser: That's a complex name for a stack structure ;) but yes, that's basically what I'd do too
gusrub has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 260 seconds]
rgtk has joined #ruby
itsdaflash has left #ruby [#ruby]
aupadhye has quit [Quit: Leaving]
chichou has joined #ruby
Yzguy has quit [Quit: Zzz...]
Emmanuel_Chanel has joined #ruby
aglorei1 has quit [Ping timeout: 240 seconds]
ozcanesen has joined #ruby
chichou has quit [Ping timeout: 240 seconds]
aglorei1 has joined #ruby
Yzguy has joined #ruby
ozcanesen has quit [Ping timeout: 240 seconds]
cdg has joined #ruby
lxsameer has joined #ruby
t-recx has joined #ruby
chichou has joined #ruby
ltem has quit [Quit: Leaving]
Deviation has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pilne has joined #ruby
thistle has quit [Remote host closed the connection]
thistle has joined #ruby
thistle has quit [Remote host closed the connection]
thistle has joined #ruby
<adam12>
Anybody using a service for private gems? (outside of geminabox)
houhoulis has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
thistle has quit [Remote host closed the connection]
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
marsjaninzmarsa has quit [Quit: ZNC 1.7.x-git-487-cbf5c38 - http://znc.in]
chichou has quit [Quit: WeeChat 1.7]
kirun has quit [Quit: Konversation terminated!]
cdg has quit [Ping timeout: 246 seconds]
MarcWeber has quit [Remote host closed the connection]
pupsicle has quit [Quit: pupsicle]
<Verity>
adam12, are you saying I won't need to do anything special for the method, like define outside of class or special keywords
chouhoulis has joined #ruby
<Verity>
and then I will just be able to create derived class + use normally?
<Verity>
(this is all new to me, even in c++)
<adam12>
I'm not sure to be honest with you. I'm not a C++ developer.
<adam12>
The description said a method with no definition - that seemed close enough.
jenrzzz has quit [Read error: Connection reset by peer]
blackwind_123 has quit [Ping timeout: 260 seconds]
<elomatreb>
You can still instantiate that class without a definition though, and the method will just silently return nil if called unless you put like a raise in it
chouhoulis has quit [Remote host closed the connection]
tvw has quit [Remote host closed the connection]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claw has quit [Ping timeout: 264 seconds]
blackwind_123 has joined #ruby
banisterfiend has joined #ruby
Azure has quit [Read error: Connection reset by peer]
arthurl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure has joined #ruby
claw has joined #ruby
jenrzzz has joined #ruby
minimalism has quit [Quit: minimalism]
hahuang61 has quit [Ping timeout: 260 seconds]
lxsameer has quit [Quit: WeeChat 1.7]
mikecmpbll has quit [Quit: inabit. zz.]
polishdub has quit [Quit: Leaving]
dionysus69 has quit [Ping timeout: 240 seconds]
Rodya_ has quit [Remote host closed the connection]
rgtk has quit [Ping timeout: 240 seconds]
Yzguy has quit [Quit: Bye]
mikecmpbll has joined #ruby
pytuger has joined #ruby
enterprisey has joined #ruby
patarr has quit [Ping timeout: 260 seconds]
FoX_77 has joined #ruby
duckpupp1 has quit [Ping timeout: 240 seconds]
djbkd has joined #ruby
rgtk has joined #ruby
djbkd has quit [Client Quit]
DTZUZO has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<adam12>
and puts apparently returns the value passed to it.
<adam12>
Which is the value you get back :)
<Verity>
yes
<Verity>
read ruby in 20 minutes =)
<Verity>
it cover this
enterprisey has quit [Remote host closed the connection]
<snappy_>
adam12: but the variable returned ought to be different than the argument, no?
<adam12>
snappy_: Oh. You are re-using `n`
<adam12>
snappy_: Is that what you're getting at?
rgtk has quit [Ping timeout: 264 seconds]
<adam12>
I'd stop shadowing local variables by your block variable
* Verity
goes to run the code
<snappy_>
adam12: Here's what the method is supposed to do: flip a coin. heads = double the amount, tails = halve it. repeat 5000 iterations and return number.
<Verity>
is the problem the algorithm itself
<Verity>
wait
<adam12>
snappy_: Maybe just leave the argument to the times block off? 5000.times do - do you need 1..5000?
<Verity>
the n outside the 5000.times
<Verity>
that n is different, isnt it?
<Verity>
after the 5000 times loop ends isnt n just the original amount
<Verity>
due to scope
gbaptista has joined #ruby
<Verity>
one n is on line 2 and 10, the other is inside the loop
<Verity>
thats my theory
<Verity>
let me know if I'm wrong :)
<snappy_>
Ah, okay. Removing n as a block argument fixed it.
<snappy_>
It's not needed.
gbaptista has quit [Client Quit]
gbaptista has joined #ruby
snappy_ has quit [Quit: Page closed]
<Verity>
wow
devp__ has joined #ruby
<devp__>
hi
<havenwood>
devp__: hi
<devp__>
anyone here
<havenwood>
devp__: yes
<Verity>
welcome to #ruby, devp__
<devp__>
installed from ruby from source and comipiled successfully and run succesfully
cgibsonmm has joined #ruby
<devp__>
then transferred comipiled coit to remote machine and but gem still pointing to ruby install of previous machine on which ruby is comipiled
<devp__>
how to point gem to search ruby in new location
<devp__>
giving some error like -bash /home/bs/.localpacks/bin/gem: /home/user/.localpacks/bin/ruby: bad interpreter: No such file or directory
cyphase has joined #ruby
<devp__>
here you can see gem still finding ruby in /home/user, and ruby is now available in /home/bs
tercenya has quit [Remote host closed the connection]
<devp__>
so how to point gem to search ruby in /hom/bs/.localpacks/bin
<havenwood>
devp__: You can build a gem with --env-shebang flag and the gem binary will use `#!/usr/bin/env ruby` instead of hardcoding the route.
tercenya has joined #ruby
<devp__>
not root install
houhoulis has quit [Remote host closed the connection]
<havenwood>
devp__: No matter how Ruby is installed, the gem bin files need to point to the Ruby interpreter. You can use --env-shebang so that it points to the current Ruby rather than hardcoding.
<devp__>
"bs" user is on vps where ruby is not comipiling due to constratint resource
kristofferR has joined #ruby
<havenwood>
devp__: you can also compile Ruby to be moveable (so it doesn't care about its own relative directory)
<Verity>
snapp_'s problem was not knowing how to use ruby?
grillon has quit [Quit: Connection closed for inactivity]
<SeepingN>
...whhhhhhy don't you just call the vps provider and ask them to install ruby
<SeepingN>
"properly"
<Verity>
isnt there a package for your distro?
<devp__>
no
<devp__>
i do things on my own
<devp__>
clear
<Verity>
time for a new distro
<havenwood>
devp__: You can also use `bundle package` to package the gems in the repo yourself.
<Verity>
<devp__> i do things on my own
<Verity>
then why are you in here asking for help =P
<Verity>
(joking)
<devp__>
the ruby guys
<havenwood>
devp__: or you can build the gem yourself on the server, there are many options
<devp__>
gem -env-shebang gives same error
jusa has joined #ruby
<devp__>
giving some error like -bash /home/bs/.localpacks/bin/gem: /home/user/.localpacks/bin/ruby: bad interpreter: No such file or directory
hahuang61 has joined #ruby
cgibsonmm has quit [Remote host closed the connection]
<devp__>
just want to know gem config file location
<havenwood>
devp__: Compare the output of: gem install bundler --env-shebang && head -n1 $(command -v bundle)
<devp__>
then tar cf .localpacks ruby-packs-bin.tar.gx
<havenwood>
devp__: This looks like a ruby-install-esque script. You can configure with --enable-shared
<devp__>
then tar cf .localpacks ruby-packs-bin.tar.gz
jusa has quit [Ping timeout: 240 seconds]
<devp__>
its a script i created to install ruby from source
<Verity>
you do it all yourself, I like that
<havenwood>
devp__: I read the script. You still need to configure with --enable-shared if you want to move Ruby and gems with --env-shebang if you want their binaries to point at that moved Ruby.
<devp__>
ok recomipling
<devp__>
hang on
<devp__>
enjoy
<Verity>
should the hard coded urls be variables for best practices? or no
<devp__>
yes
<devp__>
configured on fly
<devp__>
or used from .bashrc
nchambers has joined #ruby
nchambers is now known as Guest21588
username_ has joined #ruby
Guest21588 has quit [Remote host closed the connection]