<phaul>
in that description they make the distinction that this returns a value (they might be imlying not like if-else) that's not really a difference in ruby. ternary is just a one liner if-else
<phaul>
..and it can be used to execute code, they are making the wrong points. ah, that site is rubish.
reber has quit [Remote host closed the connection]
Mike11 has joined #ruby
blackmesa1 has quit [Ping timeout: 250 seconds]
conta1 has joined #ruby
blackmesa1 has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
blackmesa1 has quit [Ping timeout: 252 seconds]
clemens3 has quit [Remote host closed the connection]
conta1 has quit [Quit: conta1]
conta1 has joined #ruby
conta1 has quit [Read error: Connection reset by peer]
davidw has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Read error: Connection reset by peer]
chouhoulis has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cthulchu_ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 272 seconds]
AJA4351 is now known as AJA4350
ravenousmoose has joined #ruby
ravenousmoose is now known as ravenousmoose[aw
ravenousmoose[aw is now known as ravenousmoose
ravenousmoose is now known as ravenousmoose[aw
renich has joined #ruby
ravenousmoose[aw has quit [Client Quit]
blackmesa1 has joined #ruby
cd has quit [Quit: cd]
mikecmpbll has quit [Quit: inabit. zz.]
brandoncc has joined #ruby
\void has joined #ruby
blackmesa1 has quit [Ping timeout: 250 seconds]
ravenousmoose[aw has joined #ruby
ravenousmoose[aw has quit [Client Quit]
ivanskie has joined #ruby
conta1 has joined #ruby
chouhoulis has quit [Remote host closed the connection]
keanny479 has joined #ruby
<keanny479>
hi
<keanny479>
i wish to backup a list of daemons for example ['cron', 'apmd'] into a file
<keanny479>
so an array to file
<keanny479>
but which type of file is best in this case ? JSON or YAML ?
RougeR has joined #ruby
AJA4351 has joined #ruby
<leftylink>
maybe a file w/ one element per line is good
renich has quit [Remote host closed the connection]
<elomatreb>
You have both choices available by default in Ruby, YAML can serialize complex types unlike JSON but fewer languages have YAML parsers in their standard library
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
renich has joined #ruby
renich has quit [Remote host closed the connection]
Dbugger has joined #ruby
renich has joined #ruby
tdy has joined #ruby
<keanny479>
so i could simply use a std file ?
<keanny479>
in fact i need to backup an output command line to a file
mauro_oto has quit [Ping timeout: 256 seconds]
tankf33der has joined #ruby
ravenousmoose has joined #ruby
ravenousmoose is now known as ravenousmoose[aw
ravenousmoose[aw has quit [Client Quit]
<havenwood>
keanny479: PStore and YAML::Store are both in the stdlib for serializing to disk transactionally.
<keanny479>
havenwood: what do you advice me ?
<havenwood>
keanny479: It depends. Tell us more! When you say backup a list of daemons, do you mean alway replacing the entire list at once? Is it a single process and single thread doing the replacing?
[Butch] has joined #ruby
<keanny479>
i just need to backup running daemons, i have a shell script for that named 'listd.sh'
<keanny479>
output is just for example => cron\npostfix\nnginx\n
<keanny479>
need to send an error if file (backup list) exists
nowhere_man has joined #ruby
<havenwood>
keanny479: do you alway replacing the entire list of daemons at once from a single thread?
<havenwood>
replace*
tdy has quit [Ping timeout: 245 seconds]
<keanny479>
i need each time a new file, if a file already exist, raise
Guest16678 has quit [Ping timeout: 250 seconds]
<keanny479>
and regarding the reading, i will need to move the file to an array
<baweaver>
`File.exist?`
Mike11 has quit [Quit: Leaving.]
Guest16678 has joined #ruby
<keanny479>
yep
Guest16678 has quit [Ping timeout: 240 seconds]
ravenousmoose has joined #ruby
ravenousmoose is now known as ravenousmoose[aw
<havenwood>
keanny479: Unless there's more going on, you can just serialize then write to file, deserialize and read.
<havenwood>
keanny479: or as leftylink suggested, just do a daemon per line.
<mustmodify_>
In the back of my brain, I remember reading about some kind of crazy syntax that would allow you to append data to the end of a Ruby file, which you could read as though it were a separate file or something...
<mustmodify_>
though honestly that could have been in another language and I just got it confused. But does that ring any bells for anyone?
rikkipitt has joined #ruby
AJA4350 has joined #ruby
<havenwood>
mustmodify_: DATA __END__
<mustmodify_>
Hunh.
tdy has joined #ruby
<mustmodify_>
my brain DOES work sometimes. Nice. Thanks.
<havenwood>
mustmodify_: de nada!
patrickpv has joined #ruby
<keanny479>
thank you so much havenwood
<havenwood>
keanny479: you're welcome!
lytol_ has joined #ruby
<patrickpv>
I'm trying to pass a binding to a wrapped proc. Here is the context: I'm running a sinatra app, so for example in get '/blah' { xxx }, the code in xxx gets contextual variables like request, etc. I created a self.api_endpoint(uri, perms, &block) that does some special perm processing, then creates and passes a sub-proc, like this: send(:get, uri) {|*args| somestuff(perms) ; block.call(*args) }. The problem is that there are some conte
<patrickpv>
proc knows about sutch as request, but the block called by block.call doesn't know about them... is there a way to "pass" the binding of the wrapping proc to the subproc?
conta1 has quit [Quit: conta1]
Aqo has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
RougeR has quit [Ping timeout: 245 seconds]
<havenwood>
patrickpv: You can pass a proc that captures the context you want as a block: send(:get, uri, &proc_here)
agent_white has joined #ruby
keanny479 has quit [Ping timeout: 256 seconds]
<patrickpv>
Yes that works but I'm doing some wrapping of the proc
<patrickpv>
Doing some special permission processing, then actually running the block as normal
<patrickpv>
If I pass it as-is I'm not doing that and wrapping it would be not useful, if that makes sense
<patrickpv>
basically I'd like to do some kind of block.binding = current_binding, before calling it (except that's not a valid syntax)
r29v has joined #ruby
blackmesa1 has quit [Ping timeout: 240 seconds]
mustmodify_ has left #ruby [#ruby]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
r29v has quit [Quit: r29v]
d^sh_ has joined #ruby
d^sh has quit [Ping timeout: 245 seconds]
rikkipitt has quit [Remote host closed the connection]
<ivanskie>
hi, any of you use prometheus_exporter gem ?
rikkipitt has joined #ruby
<ivanskie>
I dont understand how to configure it, how does it know where to send the metrics!?