__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SuperLag_ has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
impermanence has joined #ruby
<impermanence>
Is there triple quoting in Ruby or not? Zed Shaw's book has an exercise covering it, but the internet seems to suggest that this is not actual Ruby syntax.
SuperLag_ has quit [Client Quit]
hutch34 has joined #ruby
SteenJobs has joined #ruby
cseder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd>
impermanence: Nope
<impermanence>
Some parts of the internet would disagree.
<cerulean>
meaning """?
<cerulean>
i think that it starts a multi-line string
<cerulean>
""" makes it obvious you're doing a multiline
<impermanence>
cerulean: k. Why?
<cerulean>
makes it obvious to your eyes whats going on
<impermanence>
ah
<matthewd>
Do not do that.
PresidentBiscuit has joined #ruby
<matthewd>
It makes it obvious it's been written by a python programmer who doesn't understand ruby syntax
<impermanence>
oh fuck.
<cerulean>
yeah fair enough
<cerulean>
you can do <<---HEREDOC or something as well
<cerulean>
just google ruby multiline strings for the correct syntax
<matthewd>
Yeah, if you want a really multi-line string, use a heredoc
<cerulean>
i agree with matthewd and i never see """ in 7 years of ruby coding
<impermanence>
maybe I shouldn't use his book then. Fuck.
<matthewd>
For a simple case, just use ordinary quotes
<cerulean>
yeah isnt zed shaw from python?
<cerulean>
his python book is huge in the python community or something
Lord_of_Life has quit [Excess Flood]
<impermanence>
Well he apparently wrote Mongrel...
esObe_ has joined #ruby
<impermanence>
not apparently, he did.
<cerulean>
yeah i know he wrote mongrel, its a foundational piece of ruby architecture
<impermanence>
sarcasm?
<cerulean>
nope
<cerulean>
look how all the modern ruby webservers are based on it
<cerulean>
i remember when i first got monrel
<cerulean>
from webrick
<cerulean>
huge speed difference
<impermanence>
Well...his book is probably okay for a Ruby quickstart then...
<cerulean>
probably fine
<cerulean>
""" will work for multiline string. ultimately its up to you. there's no one true way of coding
<cerulean>
i dont agree with this string tho """""""""hi""""""""
<impermanence>
helicopter
<cerulean>
yea
<matthewd>
(Part of) the point of triple-quoted strings in python is that they can contain quotes -- because they're not a real thing in ruby, and more just a quirk of the parse rules, that doesn't apply
<cerulean>
oh i c
<cerulean>
depends on what you need
<cerulean>
code at your own risk
<cerulean>
no life guard
PresidentBiscuit has quit [Ping timeout: 255 seconds]
<matthewd>
So, """x""" is effectively "" + "x" + ""
<impermanence>
okay. got it.
<impermanence>
thanks for the insight as usual :)
Lord_of_Life has joined #ruby
mim1k has joined #ruby
esObe_ has quit [Ping timeout: 240 seconds]
* flips
just started reading the Eloquent Ruby book. Seems helpful for getting good habits and better understanding
<impermanence>
is it true that while loops are rare in ruby?
<volty>
as it is true that goto's are rare
<impermanence>
what's a goto?
<volty>
is your a quiz ?
<matthewd>
impermanence: Yes; most loops will generally be using Enumerable methods
<cerulean>
yeah you dont use while much
<cerulean>
... ever?
<cerulean>
instead of while i == 1 do you can do (0...x).each do
<impermanence>
matthewd: eh, I don't know what Enumberable methods are yet so I'll have to come back to that. But okay. no while loops.
<cerulean>
.each is an enumarable method. .map is one too
<cerulean>
they are methods which iterate an array (an enumerable) and run a function, passing your block
<cerulean>
for each item
<cerulean>
yes it is a a cool and good syntax for you to use :)
mim1k has quit [Ping timeout: 245 seconds]
<cerulean>
check out #each #map #reject #collect
<cerulean>
and #sort
<matthewd>
134 'while', 1416 '.each', 846 '.map'
<matthewd>
So yeah.. rare
<cerulean>
where'd you get that statistic?
<matthewd>
(and that's without trying to exclude mentions of 'while' from comments/strings, for example)
<matthewd>
rails/rails
<cerulean>
i see i see
<cerulean>
they probably SAID while and not used it
<cerulean>
i doubt they used while
<cerulean>
at all
<matthewd>
We do use it a reasonable amount
hahuang61 has joined #ruby
<cerulean>
you're on rails team?
<cerulean>
nice 8-)
<cerulean>
i love rails 5
<matthewd>
Yes, I am
<cerulean>
nice
cschneid_ has joined #ruby
<cerulean>
what could be the reason to use while?
<matthewd>
Some crude exclusions suggest it could be in the 40-50 range
<cerulean>
40 lines using while?
<cerulean>
i'm suspicious of zed's titles of books. "the hard way". obviously it is the hard way if he's gonna teach you to use """ lol
<matthewd>
Yes, 40 lines contain 'while' and don't contain '#' or '"'
PresidentBiscuit has joined #ruby
<matthewd>
Sometimes it just fits what we're doing, and sometimes we're in enough of a hotspot that it's worth writing the ugly fast thing
hahuang61 has quit [Ping timeout: 255 seconds]
<matthewd>
And in one case, I use `while true` to avoid the stack frames from #loop
milardovich has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
marr has quit [Ping timeout: 240 seconds]
<volty>
stack frames? what goes on the stack ?
PresidentBiscuit has quit [Ping timeout: 255 seconds]
<cerulean>
i get to that point matthewd too and go the fast way as well
<cerulean>
i think he means #each requires more frames than a simple white true
<cerulean>
because it uses a #loop which is more complicated than while true
<matthewd>
>> loop { explode! }
<ruby[bot]>
matthewd: # => undefined method `explode!' for main:Object (NoMethodError) ...check link for more (https://eval.in/771523)
<matthewd>
>> while true; explode!; end
<ruby[bot]>
matthewd: # => undefined method `explode!' for main:Object (NoMethodError) ...check link for more (https://eval.in/771524)
<cerulean>
>> `ls /`
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cerulean>
heeh
Lord_of_Life has quit [Excess Flood]
<cerulean>
>> puts rand(256)
<matthewd>
Ugly backtrace, nice backtrace
<cerulean>
oh, im not authorized
<cerulean>
i believe you
nowhere_man has quit [Remote host closed the connection]
skweek has quit [Remote host closed the connection]
<matthewd>
I was answering volty
<volty>
yes, thanks
b3l914n has joined #ruby
<volty>
but that's only one extra call per loop
<impermanence>
is there a name for just a basic .rb file? rube, gemmy, something? Like in python it's module, in java it's class file, in puppet it's manifest, etc...
<cerulean>
"dot rb file" is what i call it?
skweek has joined #ruby
<matthewd>
volty: In this case, it was literally about preventing the lines in the backtrace
def_jam has joined #ruby
Lord_of_Life has joined #ruby
<impermanence>
k. regarding gets...what part of the language is this of?
<volty>
I see
<cerulean>
impermanence: i/o
<impermanence>
I assume there are a ton of methods associated with it?
<impermanence>
So is gets like a package or a gem or a module...or what would I call that?
<impermanence>
class?
eb0t has quit [Ping timeout: 246 seconds]
<matthewd>
impermanence: It's a method ^
<cerulean>
it's a method
<cerulean>
inside module Kernel
<cerulean>
# means it's a method in the sense of <class/module>#<method>
eblip has quit [Ping timeout: 268 seconds]
<impermanence>
oh, it's a method. I assume class: gets ; method: chomp => gets.chomp
<impermanence>
assumed.
<matthewd>
Being defined in Kernel, which every object contains, it's effectively global
<impermanence>
kernel of MRI?
<matthewd>
Yeah.. no. Method #gets returns a string, which has a #chomp method.
esObe_ has joined #ruby
<matthewd>
Kernel, yes. Kernel is a module.
jgt1 has quit [Ping timeout: 240 seconds]
<impermanence>
So in Ruby a module is a bunch of classes...?
<matthewd>
No.
skweek has quit [Ping timeout: 240 seconds]
<cerulean>
module is where you put methods that dont need to have an object
<cerulean>
classes are for when you need an object
<impermanence>
module is a bunch of functions.
<matthewd>
A module is a collection of methods that can be included into a class
<impermanence>
interface.
<matthewd>
(and also a namespace that can contain nested constants)
<matthewd>
No; methods with implementations
<impermanence>
ah. But these methods are static...?
<volty>
nothing static here
<cerulean>
not necessarily
<matthewd>
>> module X; def hello; "hello from #{self}"; end; end; class String; include X; end; class Integer; include X; end; ["world".hello, 17.hello]
<impermanence>
Is the concept of Ruby module equal to concept of Python module? Because in Python methods that don't require an object are called functions...
<matthewd>
loop is intended to be used in places where it will loop ~infinitely
astrobunny has joined #ruby
<matthewd>
.. which means it would count high enough to get into bignums, at which point every iteration is an allocation. That would be bad.
ebbflowgo has joined #ruby
<volty>
yes, but that is a limit of ruby trying to mimic the true functional languages
impermanence has joined #ruby
esObe_ has quit [Ping timeout: 252 seconds]
soppe has joined #ruby
<impermanence>
In Learn Ruby the Hard Way it is suggested that to take an integer from STDIN to use gets.chomp.to_i? but is this bad practice? because can't I just use gets.to_i? Or I suppose that the latter takes in the integer and then converts it to a string?
br0d1n has quit [Remote host closed the connection]
<volty>
Hard Way brings hard questions. How can a newbie doubt the words of the 'hard way'?
br0d1n has joined #ruby
<matthewd>
impermanence: bad practice how?
<impermanence>
matthewd: After the triple quote thing when I ran into that I wanted to just check if there was anything strange with that because I've had a couple of doubts about continuing with hard way and starting with something else. But it sounds like that's normal use.
br0d1n has quit [Read error: Connection reset by peer]
<volty>
our expert probably meant 'redundant' - since the chars removed by chomp do not change the result ? but his instinct tells him that we should always chomp, because chomp could change the result.
libastral has quit [Ping timeout: 255 seconds]
ddffg has quit [Ping timeout: 240 seconds]
<volty>
>> $/ = "3"; s = "33"; [s.to_i, s.chomp.to_i]
<impermanence>
volty: I guess I don't understand the difference between gets.to_i and gets.chomp.to_i ... I think chomp removes \r\n but is there any other difference?
<matthewd>
impermanence: No; that is indeed what chomp does.
<volty>
impermanence: I wanted so say the same you are asking about — how can a novice imagine there could be "other difference"
minimalism has quit [Quit: minimalism]
<impermanence>
matthewd: okay.
<volty>
chomp removes whatever $/ 's value is
<impermanence>
ah. I see.
<volty>
seen :)
claudevandort has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
soppe has joined #ruby
soppe has quit [Client Quit]
acalycine has joined #ruby
_djbkd has quit [Remote host closed the connection]
acalycine has quit [Client Quit]
armyriad has quit [Read error: Connection reset by peer]
<nofxxx>
volty, actually nice is that it's kinda of beginning of /^\d regex... so "123-rocknroll".to_i -> 123
PresidentBiscuit has quit [Ping timeout: 240 seconds]
yaewa has quit [Remote host closed the connection]
yaewa has joined #ruby
maum has joined #ruby
yaewa has quit [Remote host closed the connection]
moei has quit [Ping timeout: 240 seconds]
<maum>
hello
<PorcoRex>
Hey.
<maum>
how can I get author value from {:author=>"Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr.", :date=>"1988.", :title=>"Climatological observations and predicted sublimation rates at La ke Hoare, Antarctica.", :journal=>"Journal of Climate", :volume=>"1:", :pages=>"715-728."} ?
<maum>
This is hash
xall has quit [Ping timeout: 255 seconds]
<Radar>
maum: So what have you tried?
<maum>
h[:author]
moei has joined #ruby
<Radar>
maum: Did that not work?
<maum>
yes
<Radar>
How did that not work?
<Radar>
>> {:author=>"Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr."}[:author]
<ruby[bot]>
Radar: # => "Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr." (https://eval.in/771571)
<maum>
anystyle.rb:21:in `[]': can't convert Symbol into Integer (TypeError)
_djbkd has joined #ruby
<Radar>
maum: looks like you're calling [] on an array instead. Show us the rest of the code please.
<Radar>
Example here shows it does indeed return an array
<maum>
the output of h is {:author=>"Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr.", :date=>"1988.", :title=>"Climatological observations and predicted sublimation rates at La ke Hoare, Antarctica.", :journal=>"Journal of Climate", :volume=>"1:", :pages=>"715-728."}
<Radar>
maum: I would suggest experimenting with how to get the first element of an array.
<Radar>
maum: Did you use puts or p?
<Radar>
maum: to get that output: did you use puts or p?
<maum>
puts
<PorcoRex>
There's also something, in the original input, there isn't an "author" key. Where should that be coming from?
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
__Yiota has joined #ruby
<Radar>
maum: puts takes an array and iterates through it all, outputting each element
<Radar>
maum: use `p` to get the actual object's representation.
<Radar>
maum: It's an array. You'll need to find the first element of that array and then call [:author] on that element.
<Radar>
bbl
hutch34 has quit [Ping timeout: 245 seconds]
<maum>
Radar: how? would you show me an example?
<Radar>
maum: ?g ruby first element on array
<PorcoRex>
h[0]
<Radar>
?g ruby first element on array
<ruby[bot]>
Radar: I don't see no ruby, whom should I tell about g?
<Radar>
one day I will figure out ruby[bot]
<Radar>
maum: experiment in irb. Create an array and then try to get the _first_ element from that array. I'm sure you can figure it out.
<Radar>
*gone*
<maum>
h[0] shows {:author=>"Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr.", :date=>"1988.", :title=>"Climatological observations and predicted sublimation rates at La ke Hoare, Antarctica.", :journal=>"Journal of Climate", :volume=>"1:", :pages=>"715-728."}
<PorcoRex>
maum, interesting... How about h[0][:author] ?
<maum>
PorcoRex: you are very nice commentor
<PorcoRex>
Did that work or are you just stroking my ego?
<maum>
it shows Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr.
<PorcoRex>
That's pretty close I think.
<maum>
but why 0?
<maum>
the output of h and h[0] are same
<PorcoRex>
How about h.first[:author] ?
<maum>
also same
<maum>
it prints the authors
<PorcoRex>
How about h.class ?
<maum>
array
<PorcoRex>
Ah, you should always print arrays with "p", not "puts".
<PorcoRex>
Try now p h .
<maum>
anystyle.rb:23:in `<main>': private method `puts' called for #<Array:0x00000002808610> (NoMethodError)
<PorcoRex>
Uh oh.
<PorcoRex>
Why are you using anystyle?
<maum>
to parse references
<PorcoRex>
How about puts h.inspect ?
<maum>
it prints [{:author=>"Clow GD, McKay CP, Simmons Jr. GM, and Wharton RA, Jr.", :date=>"1988.", :title=>"Climatological observations and predicted sublimation rates at L ake Hoare, Antarctica.", :journal=>"Journal of Climate", :volume=>"1:", :pages=>"715-728."}]
jokester has quit [Ping timeout: 252 seconds]
<PorcoRex>
Ah, there's the array.
cschneid_ has quit [Remote host closed the connection]
<PorcoRex>
You'll notice it's different from puts h.first.inspect .
<maum>
anystyle.rb:22:in `<main>': private method `puts' called for #<String:0x00000003548140> (NoMethodError)
<PorcoRex>
Well, that's different, alright.
<PorcoRex>
That gem doesn't seem to be too flexible, but to answer you question, it seems to parse several records. So, you want to get the first record (using h[0] or h.first) and then query the :author from that record.
Pumukel has quit [Remote host closed the connection]
_tk421_ has quit [Ping timeout: 240 seconds]
cschneid_ has joined #ruby
impermanence has joined #ruby
impermanence has quit [Client Quit]
esObe_ has joined #ruby
msafi has joined #ruby
cschneid_ has quit [Ping timeout: 255 seconds]
b3l914n has quit [Ping timeout: 240 seconds]
impermanence has joined #ruby
impermanence has quit [Client Quit]
<msafi>
Hey folks, I don't know much about Ruby, but Travis CI is telling me I need to use their gem to encrypt values for the CI. Thing is, I tried `gem install travis` but got a permission error. So I tried `gem install travis --user-install` and it worked.
astrobunny has quit [Remote host closed the connection]
impermanence has joined #ruby
impermanence has quit [Client Quit]
_tk421_ has joined #ruby
esObe_ has quit [Ping timeout: 245 seconds]
<PorcoRex>
Looks like it's not finding the gem where it expects it to. Also, are encripted values used for integration with code climate or something like that? I don't remember you needing to generate a key for Travis only use.
SHyx0rmZ has joined #ruby
_djbkd has quit [Remote host closed the connection]
knight33 has joined #ruby
<msafi>
PorcoRex: I need to use Travis CI for an unrelated project on GitHub
_djbkd has joined #ruby
<PorcoRex>
msafi, do you have a .travis.yml file in your project?
<msafi>
Yes
<PorcoRex>
Did you configure the travis dashboard to login through Github?
jusa has joined #ruby
<msafi>
Hmmm, I found a fix. I needed to remove `export GEM_HOME` and `export GEM_PATH` which were = `~/.gem` from my environment
<PorcoRex>
Good deal.
nankyokusei has joined #ruby
_djbkd has quit [Ping timeout: 255 seconds]
hutch34 has joined #ruby
nankyokusei has quit [Ping timeout: 255 seconds]
solocshaw has joined #ruby
claw has quit [Ping timeout: 264 seconds]
xall has joined #ruby
<cerulean>
i let some designers from twitter connect to my secret app without an NDA
<cerulean>
am i a fucking idiot?
<msafi>
Nah, you'll be fine
<cerulean>
alright cool
<msafi>
👍
<cerulean>
thanks :)
HoierM has quit [Ping timeout: 252 seconds]
jdm has joined #ruby
impermanence has joined #ruby
_djbkd has joined #ruby
claw has joined #ruby
jgt2 has joined #ruby
Channel6 has quit [Quit: Leaving]
jgt2 has quit [Ping timeout: 240 seconds]
esObe_ has joined #ruby
acalycine has joined #ruby
msafi has quit [Remote host closed the connection]
_tk421_ has quit [Ping timeout: 240 seconds]
grh has joined #ruby
esObe_ has quit [Ping timeout: 240 seconds]
PorcoRex has quit [Quit: Leaving]
Ropeney has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
tristanp has joined #ruby
babykosh has joined #ruby
govg has quit [Quit: leaving]
<babykosh>
greetings ruby makers…..noob question….is an easy to understand comparison chart between ruby 2.1.2 and 2.4? Trying to understand what differences exist. Thank you in advance.
mim1k has joined #ruby
iamayam has quit [Ping timeout: 255 seconds]
impermanence has quit [Ping timeout: 252 seconds]
<Radar>
babykosh: You could always look at the changelogs for 2.2, 2.3 and 2.4
enterprisey has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dminuoso>
babykosh: Personally I would go for the announcements at ruby-lang.org -> they have summaries of the most notable features. The changelog from the git repository will usually contain a lot of technical things that are less relevant just to get an impression of the differences.
griff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<halogenandtoast>
herwin: that's subclassing though, I meant reopening the class and adding `my_random_method` to that class.
<tobiasvl>
monkey patching
<halogenandtoast>
or duck punching, whatever your flavor is.
<matthewd>
halogenandtoast: That comes down to "there might be name conflicts"
boz__ is now known as boz_
<matthewd>
That makes it rather rude for a random library to be doing... but doesn't really affect the application author, or a library whose whole purpose is to make such extensions
<halogenandtoast>
matthewd: right, I'm trying to find a good way to discourage my students from doing this arbitrarily
<halogenandtoast>
I mentioned name conflicts.
<matthewd>
In their end application? I'm not sure I necessarily see anything wrong with that.
fivmo has joined #ruby
<matthewd>
It's then an API design question: "does this method make sense on every String, or does it only really work for this particular one?", etc
<halogenandtoast>
matthewd: It opens the door for unexpected errors. And these students will be contributing to our companies code base at some point
<halogenandtoast>
*company's
<matthewd>
i.e., exactly the same "is this the right class for that method" questions you'd ask about any other class
jottr has quit [Quit: WeeChat 1.7]
fivmo has quit [Client Quit]
<halogenandtoast>
Sure in this case they've monkey-patched Integer to have a digits method, to return the number of digits a number has.
<halogenandtoast>
Seems like its not an ideal example then...
<halogenandtoast>
as this will conflict
<halogenandtoast>
actually it depends on what you meant by example
<matthewd>
I mean it's an ideal example for your "don't do this" argument
<matthewd>
But, that conflict with the future notwithstanding, I'd personally be fine with the addition of such a method
<matthewd>
Again, within the application -- not a library.
ebbflowgo has joined #ruby
ebbflowgo has quit [Client Quit]
moei has quit [Read error: Connection reset by peer]
moei has joined #ruby
blackwind_123 has quit [Ping timeout: 255 seconds]
<halogenandtoast>
matthewd: thanks for the insight.
<halogenandtoast>
I generally have a "no extending core classes" mentality, only because I've been bitten by it every single time I've done it.
blackwind_123 has joined #ruby
<halogenandtoast>
but that's the result of library authors extending core classes (I'm looking at you rails)
<matthewd>
*gulp*
raspado has quit [Remote host closed the connection]
raspado has joined #ruby
raspado has quit [Read error: Connection reset by peer]
<matthewd>
My counter-argument is that Rails is primarily a framework, so we play by different rules: we're generally present from the start, to adjust the base environment... not pulled in as some arbitrary dependency to stomp on your namespace unexpectedly
raspado has joined #ruby
<halogenandtoast>
matthewd: yeah still not sure why rails needed to add Numeric#bytes
<matthewd>
Admittedly, that doesn't work so well when you think about using activerecord in isolation, or similar
<halogenandtoast>
seems like "not the frameworks responsibility"
<halogenandtoast>
and of course that meant they added gigabytes, exabytes, and friends...
<halogenandtoast>
</rant> heading home now, thanks again.
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Burgestrand has quit [Quit: Closing time!]
raspado has quit [Ping timeout: 245 seconds]
halogenandtoast has quit [Quit: leaving]
zun has quit [Quit: Connection closed for inactivity]
nadir has quit [Quit: Connection closed for inactivity]
kent\n has quit [Quit: No Ping reply in 180 seconds.]
jenrzzz has quit [Ping timeout: 255 seconds]
kent\n has joined #ruby
pwnd_nsfw` has joined #ruby
hahuang61 has joined #ruby
pwnd_nsfw has quit [Ping timeout: 255 seconds]
PresidentBiscuit has joined #ruby
GodFather has joined #ruby
Guest96 has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 255 seconds]
Guest96 has joined #ruby
PresidentBiscuit has quit [Ping timeout: 240 seconds]
jusa has joined #ruby
boz_ has quit [Quit: This computer has gone to sleep]
postmodern has quit [Quit: Leaving]
boz_ has joined #ruby
cschneid_ has joined #ruby
xall has quit [Ping timeout: 240 seconds]
Lord_of_Life has quit [Excess Flood]
cschneid_ has quit [Ping timeout: 240 seconds]
Lord_of_Life has joined #ruby
mazeinmaze_ has quit [Ping timeout: 260 seconds]
mim1k_ has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
User458764 has joined #ruby
rgtk has quit [Ping timeout: 240 seconds]
impermanence has joined #ruby
impermanence has quit [Client Quit]
impermanence has joined #ruby
impermanence has quit [Client Quit]
jeyraof^mbpr has joined #ruby
astrobunny has quit [Remote host closed the connection]
mim1k_ is now known as mim1k
jgt2 has quit [Ping timeout: 240 seconds]
ebbflowgo has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jwheare has quit []
jwheare has joined #ruby
kent\n has quit [Quit: No Ping reply in 180 seconds.]
kent\n has joined #ruby
impermanence has joined #ruby
impermanence has quit [Client Quit]
jeyraof^mbpr has quit [Quit: Leaving]
jgt2 has joined #ruby
boz_ has quit [Quit: Leaving]
nankyokusei has joined #ruby
nankyokusei has quit [Ping timeout: 245 seconds]
Burgestrand has joined #ruby
valkyrka has joined #ruby
<valkyrka>
hi guys, a little bit of an odd one, I wrote a script which doesn’t behave as I would expect it
<Siyfion>
*I've got all the gems installed that I need, but for some reason it comes up with this...
psychicist__ has joined #ruby
<baweaver>
!gist
<baweaver>
?gist
<ruby[bot]>
https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<baweaver>
much easier to use than imgur
<Siyfion>
baweaver true, but it's a bit of a mess with word-wrap
<impermanence>
morning. Do I need to require anything in order for Dir.chdir("/tmp") to work? I'm calling it but my current shell does not change directory...
<baweaver>
If you're only using the one version though it may not be worth the effort
<Siyfion>
Yeah, I generally only use latest
<Siyfion>
I only do a *very* small app in Ruby, everything else is Node.js/React/etc.
bounb is now known as mearnsh
<Siyfion>
To create PDFs weirdly
<Siyfion>
But it works well... so hey, why not!?
<baweaver>
Wicked was it?
<Siyfion>
No, PrawnPDF actually ;)
* baweaver
wishes pdf would die
dionysus69 has joined #ruby
<Siyfion>
Haha... well for very accurate printing, it's quite useful.. ie. labelling.
dionysus69 has quit [Remote host closed the connection]
<baweaver>
Never said it wasn't, but the caveats leave some things to be desired :)
<Siyfion>
But it's not generated from HTML, due to the simple fact that I don't think I'd be able to position things as accurately as I'd like..
nankyokusei has quit [Ping timeout: 240 seconds]
<baweaver>
namely playing chicken with Java for most exploits on record
<Siyfion>
Oh there's a hell of a LOT to be desired from PDFs
<dminuoso>
Siyfion: Such as?
<dminuoso>
PDFs are actually one of the better formats out there.
<baweaver>
uh oh
<baweaver>
you summoned dminuoso
* Siyfion
runs away and hides
* dminuoso
growls
<baweaver>
'mornin
<Siyfion>
Hey I like them... *for my use case
<Siyfion>
But there are places where they are used that I'd prefer they weren't!
gregf_ has joined #ruby
andikr has quit [Remote host closed the connection]
<dminuoso>
Siyfion: The thing that really triggers me about them if when companies start abusing cmap to make them un-copy-pastable, and then do positional tricks to ruin OCR attempts.
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Siyfion>
dminuoso: Couldn't agree more
rgtk has quit [Ping timeout: 255 seconds]
<Siyfion>
For creating a document that you want printed in a *very* specific way... I love them, I don't think there's much else I could use...
ketan has joined #ruby
<dminuoso>
Siyfion: They are at least truly portable.
<Siyfion>
Yup, and fairly printer-friendly
TomyLobo has joined #ruby
rakm has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
preyalone has joined #ruby
amargherio has joined #ruby
[Butch] has joined #ruby
amclain has joined #ruby
levifig has quit [Ping timeout: 260 seconds]
levifig has joined #ruby
Slinky_Pete has joined #ruby
jusa has joined #ruby
Dry_Lips has joined #ruby
Dry_Lips has joined #ruby
Dry_Lips has quit [Changing host]
patarr_ has joined #ruby
chouhoulis has quit [Remote host closed the connection]
cloaked1 has quit [Quit: reboot]
patarr has quit [Ping timeout: 240 seconds]
Beams has quit [Quit: .]
Beams has joined #ruby
jsrn_ has quit [Quit: Leaving]
amargherio has quit [Quit: amargherio]
knight33 has joined #ruby
bodgix has joined #ruby
bodgix1 has quit [Read error: Connection reset by peer]
jgt2 has quit [Ping timeout: 252 seconds]
mephistophocles has joined #ruby
Sweetlie has joined #ruby
amargherio has joined #ruby
mark_66 has quit [Quit: Leaving.]
cloaked1 has joined #ruby
cloaked1 has joined #ruby
cloaked1 has quit [Changing host]
patarr_ has quit [Quit: leaving]
cschneid_ has quit [Remote host closed the connection]
outreachdan has joined #ruby
cschneid_ has joined #ruby
Slinky_Pete has quit []
solocshaw has quit [Remote host closed the connection]
esObe_ has quit [Remote host closed the connection]
esObe_ has joined #ruby
skweek has joined #ruby
minimalism has quit [Quit: minimalism]
<Pierreb|home>
system('perl /opt/ruby/sms.pl' "#{phone}") is there a way to add space between when sent to cmdline? it's sent as perl /opt/ruby/sms.pl11111111111
<apeiros>
system('perl', '/opt…', phone)
<apeiros>
(assuming phone already contains a string, then "#{phone}" is being pointlessly verbose)
bodgix has quit [Quit: Leaving.]
<Pierreb|home>
just phone didnt work
<Pierreb|home>
ill try that, thanks apeiros
<apeiros>
"didn't work" doesn't work as a problem description
<apeiros>
and it probably didn't work because you passed the arguments wrongly to system
jusa has quit [Ping timeout: 245 seconds]
<apeiros>
if phone truly is not a string, phone.to_s is IMO still cleaner than "#{phone}" (and that's just what that construct does anyway)
lel has joined #ruby
<Pierreb|home>
ok ill play around a bit
<lagweezle>
I'm also noting that your call, apeiros, has commas, where as Pierreb|home just has strings following each other.
AndBobsYourUncle has joined #ruby
<apeiros>
lagweezle: yes, that's the main part
<Pierreb|home>
i tried the commas between perl /opt/script, variable
<Pierreb|home>
not sure why i didnt do it that time
_tk421_ has joined #ruby
<lagweezle>
Not just that, but breaking up 'perl /opt/...' into 'perl', '/opt/...'
<apeiros>
you have to either put everything into a single string (creates a subshell) or use separate arguments for each (bypasses subshell)
dlitvak has quit [Quit: Connection closed for inactivity]
jane_booty_doe has joined #ruby
toretore has joined #ruby
jdm has quit [Remote host closed the connection]
cam27 has quit [Quit: cam27]
lxsameer has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ryan_notabot has joined #ruby
gusrub has joined #ruby
electrostat has quit [Quit: uwotm8]
electrostat has joined #ruby
cisco has joined #ruby
cisco has quit [Max SendQ exceeded]
cisco has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
narval has quit [Ping timeout: 240 seconds]
toretore has quit [Ping timeout: 255 seconds]
rakm has joined #ruby
psychici1t__ has quit [Quit: Lost terminal]
<hays>
what's the best way to compatibly integrate a ruby script into a logging facility like syslog? I know about Syslog::Logger
<hays>
but it seems like maybe some Linux distros for example are shipping without syslog these days
* lagweezle
lights systemd on fire.
cek has left #ruby [#ruby]
<matthewd>
hays: You want the best way to integrate with syslog without using syslog? :/
<hays>
i don't particulrly care about using syslog or whatever else, just looking for something as platform independent as practicable
<hays>
something that would hopefully end up in syslog for a system running syslog, but end up wherever else is appropriate for a system running something else
<matthewd>
AFAIK, the "whatever else is appropriate" is still syslog
war_pigs has quit [Quit: later... computer is sleeping]
_tk421_ has quit [Ping timeout: 252 seconds]
<eam>
syslog(3) is a posix defined libc call. It's not going anywhere
<eam>
the daemon that services the /dev/log socket is more or less irrelevant
<hays>
ok. well that is helpful actually
<hays>
so Syslog::Ruby is tying to a POSIX call
<eam>
most likely
<eam>
the posix call is, in turn, very simple and probably amounts to a particular string format and sendto() to /dev/log
<hays>
erm Syslog::Logger
maattdd has quit [Ping timeout: 240 seconds]
<hays>
I started down this rabbit hole because my Syslog::Logger messages look crappy in console.log (MacOS)
<hays>
just trying to get a flavor at this point that its working..
narval has joined #ruby
<hays>
all my messages show up with the name 'ruby' instead of what I pass into the Syslog::Logger constructor
<hays>
and levels don't seem to be coming through
NightMonkey has quit [Ping timeout: 240 seconds]
<hays>
yeah, just verified that Syslog::Logger works with a Syslog module, that is an interface for syslog(3) which I think means POSIX
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eam>
hays: because /dev/log is just a regular old socket it's pretty easy to debug. Try attaching strace and looking at the format of the string being sent to the socket