<soosfarm>
hey, just so I understand this correctly, custom_spec = { 'customization_spec' => Hash.new } declares a new hash inside a hash, right?
<baweaver>
yes, but really just use {}
<baweaver>
no need to use the object syntax unless you need something specific from the initializer.
pengin has quit [Ping timeout: 245 seconds]
<soosfarm>
thanks
Caelum has quit [Remote host closed the connection]
<baweaver>
like default key / value bits
deol has joined #ruby
<baweaver>
also, tend towards symbol keys
<baweaver>
{customization_spec: {}}
<baweaver>
v2.2 adds a nifty bit though: {'customization_spec': {}}
GaryOak_ has joined #ruby
psyprus has joined #ruby
quazimodo has joined #ruby
skj3gg has joined #ruby
mistermocha has joined #ruby
bklane has joined #ruby
Takle has quit [Remote host closed the connection]
lkba_ has joined #ruby
TDJACR has joined #ruby
zachrab has joined #ruby
thiagovsk has quit [Quit: Connection closed for inactivity]
CpuID2 has quit [Quit: This computer has gone to sleep]
Sawbones has joined #ruby
smathieu has joined #ruby
lkba has quit [Ping timeout: 245 seconds]
Aova has quit [Read error: Connection reset by peer]
swgillespie has quit [Ping timeout: 246 seconds]
Sawbones has quit [Remote host closed the connection]
davispuh has quit [Read error: Connection reset by peer]
Sawbones has joined #ruby
Hijiri has joined #ruby
Rollabunna has quit [Remote host closed the connection]
pwnz0r has joined #ruby
lzx has joined #ruby
Rollabunna has joined #ruby
jonr22 has quit [Ping timeout: 245 seconds]
bronson has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
jonr22 has joined #ruby
Aova has joined #ruby
culturelabs has joined #ruby
amitchellbullard has joined #ruby
livinded has joined #ruby
p3ery has joined #ruby
mikecmpbll has quit [Quit: ciao.]
pkrzywicki has quit [Ping timeout: 252 seconds]
koding123 has joined #ruby
<koding123>
#j #python
multi_io_ has joined #ruby
zrl has joined #ruby
adamjleonard has joined #ruby
<koding123>
heck
<livinded>
I'm building rack middleware that intercepts requests and does some transformations to GET and POST data. For multipart data I can read the request, modify it, but how do I turn into back into raw multipart data with the boundaries. Rack::Multipart.build_multipart returns me a hash?
bronson has quit [Ping timeout: 252 seconds]
<DogHackit>
If I want to change variable value to a string if that variable is nil, how do I run that check? I know I am missing something because "if variable.nil?" always runs the following line
fryguy9 has quit [Read error: Connection reset by peer]
rakm has joined #ruby
fryguy9 has joined #ruby
<crome>
DogHackit: it should work
jrunning_ has joined #ruby
pwnz0r has quit [Remote host closed the connection]
Mon_Ouie has quit [Remote host closed the connection]
jimms has quit [Remote host closed the connection]
<DogHackit>
crome: what I am doing is changing nil to "--". That will work, but then I can not alter the value after in the object. it stays "--". If I remove the if check I can update the value
<DogHackit>
crome, if I add the if to "to_s" it has the functionality I just described
p3ery has joined #ruby
p3ery has quit [Remote host closed the connection]
graydot has quit [Quit: graydot]
startupality has quit [Quit: startupality]
p3ery has joined #ruby
einarj has quit [Remote host closed the connection]
lzx has quit []
bonhoeffer has joined #ruby
wallerdev has joined #ruby
spastorino has joined #ruby
crueber has quit [Quit: Leaving.]
addisaden has quit [Client Quit]
tunaCanBruh has quit [Ping timeout: 250 seconds]
graydot has joined #ruby
<crome>
you still have a weird way of concatenating the result string
pwnz0r has quit [Remote host closed the connection]
<DogHackit>
yeah, I know. It was the only way I could wrap my head around it
<DogHackit>
It is gross and PHP like.
<Timgauthier>
mmm php
<DogHackit>
was waiting for that...
<DogHackit>
;)
baweaver has quit [Remote host closed the connection]
<crome>
DogHackit: find an easy way in a comment in the gist
<crome>
if I understood your problem correctly
<crome>
this way you can updated @points_received any time and to_s will give you an updated string
<crome>
update*
jerematic has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
Timgauthier has quit [Quit: sleeeeeeep]
yfeldblum has quit [Remote host closed the connection]
<DogHackit>
Thanks! Let me work with that for a bit
yfeldblum has joined #ruby
smathieu has quit [Remote host closed the connection]
smathieu has joined #ruby
j4d has joined #ruby
ghr has quit [Ping timeout: 244 seconds]
j4d_ has joined #ruby
dkphenom has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<DogHackit>
the or work. why not the if?
fryguy9 has quit [Quit: Leaving.]
ramblinpeck_ has joined #ruby
smathieu has quit [Remote host closed the connection]
smathieu has joined #ruby
dkphenom has joined #ruby
j4d_ has quit [Client Quit]
j4d has quit [Client Quit]
<crome>
I have no idea without knowing what code you were trying to run exactly
jfarmer has joined #ruby
blackmesa has quit [Quit: WeeChat 1.1]
troter___ has joined #ruby
<jfarmer>
I'm writing a gem and want to include static data files in the gem that will be read from (but never modified) at run-time. After reading through the docs, it appears that using the gem's "datadir" is the right way to go. Once I include a gem (e.g., require "waffles"), Gem.datadir("waffles") will return the full path to the gem's datadir (as I expect).
mistermocha has quit [Ping timeout: 255 seconds]
<jfarmer>
My question is this: how do you use Gem.datadir _inside_ the gem code itself?
<jfarmer>
Even if I say 'require "my_gem"' inside my gem, Gem.datadir("my_gem") is returning nil.
lioninawhat has joined #ruby
marr has quit [Ping timeout: 264 seconds]
tmtwd has quit [Remote host closed the connection]
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
shazaum has quit [Quit: This computer has gone to sleep]
Kricir has quit [Remote host closed the connection]
Troy^ has quit [Client Quit]
Kricir has joined #ruby
dfinninger has joined #ruby
krz has joined #ruby
Troy^ has joined #ruby
bruno- has joined #ruby
yfeldblum has quit [Ping timeout: 245 seconds]
Kricir has quit [Ping timeout: 252 seconds]
commmmodo has joined #ruby
commmmodo has quit [Client Quit]
apeiros has joined #ruby
krz has quit [Ping timeout: 244 seconds]
F__i__L has quit [Ping timeout: 265 seconds]
cajone has joined #ruby
joufflu has joined #ruby
jonr22 has quit [Ping timeout: 265 seconds]
ghr has joined #ruby
DEA7TH has quit [Changing host]
DEA7TH has joined #ruby
commmmodo has joined #ruby
fryguy9 has joined #ruby
giuseppesolinas has quit [Quit: Leaving]
charliesome has quit [Quit: zzz]
BigRonnieRon has joined #ruby
charliesome has joined #ruby
lele has quit [Ping timeout: 252 seconds]
baroquebobcat has quit [Quit: baroquebobcat]
tvw has quit []
tjohnson has joined #ruby
ghr has quit [Ping timeout: 246 seconds]
adamjleonard has quit [Quit: Leaving...]
Aova has quit [Read error: Connection reset by peer]
bruno- has quit [Quit: leaving]
_mtr has joined #ruby
hmsimha has joined #ruby
lele has joined #ruby
kaspertidemann has quit []
kobain has joined #ruby
Aova has joined #ruby
puppetmonkey has joined #ruby
tokik has joined #ruby
CpuID2 has joined #ruby
_mtr has quit [Ping timeout: 246 seconds]
fabrice31 has joined #ruby
selaruvich has joined #ruby
DarthGandalf has quit [Ping timeout: 246 seconds]
jsaak has quit [Ping timeout: 246 seconds]
jsaak has joined #ruby
tunaCanBruh has joined #ruby
<crome>
hey
<crome>
oh.
Sawbones has quit [Remote host closed the connection]
DarthGandalf has joined #ruby
fabrice31 has quit [Ping timeout: 245 seconds]
<koding123>
O.o
einarj has joined #ruby
hmsimha has quit [Ping timeout: 252 seconds]
lioninawhat has quit [Remote host closed the connection]
GaryOak_ has quit [Remote host closed the connection]
tunaCanBruh has quit [Ping timeout: 246 seconds]
avelldiroll has quit [Ping timeout: 265 seconds]
Sawbones has joined #ruby
Kricir has joined #ruby
wldcordeiro_ has quit [Ping timeout: 265 seconds]
baweaver has joined #ruby
Sawbones has quit [Remote host closed the connection]
avelldiroll has joined #ruby
wldcordeiro_ has joined #ruby
IrishGringo has quit [Ping timeout: 265 seconds]
einarj has quit [Ping timeout: 252 seconds]
bricker has quit [Quit: leaving]
icbm has joined #ruby
<DogHackit>
How would I initialize a class object from the line of a file?
<DogHackit>
I need each line to be 2 arguments, not 1.
shum has quit [Quit: WeeChat 1.1.1]
shum has joined #ruby
yfeldblum has joined #ruby
havenwood has joined #ruby
shum has quit [Client Quit]
shum has joined #ruby
hvxgr has quit [Ping timeout: 256 seconds]
TheNet has joined #ruby
atomi has joined #ruby
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
axl_ has quit [Quit: axl_]
DadoCe has joined #ruby
hvxgr has joined #ruby
orangerobot has joined #ruby
omosoj has joined #ruby
zachrab has quit [Remote host closed the connection]
fryguy9 has quit [Quit: Leaving.]
adriancb has joined #ruby
cjim has joined #ruby
ForkingPaths has joined #ruby
g-nom3 has joined #ruby
g-nom3 has quit [Max SendQ exceeded]
riotjones has joined #ruby
<orangerobot>
hi there. is there any reason why I can't call a method that expects a single argument and a block without parentheses?? please look sat this pastie: http://pastie.org/9933347
Choclo has joined #ruby
smathieu has quit []
tkuchiki has joined #ruby
riotjones has quit [Ping timeout: 250 seconds]
Choclo is now known as Choclo[Away]
silkfox has quit [Ping timeout: 252 seconds]
Choclo[Away] is now known as Choclo
bklane has quit [Remote host closed the connection]
bronson has joined #ruby
uptownhr has quit [Quit: uptownhr]
nii236|irssi is now known as nii236
Rollabunna has quit [Remote host closed the connection]
Rollabunna has joined #ruby
Vile` has quit [Ping timeout: 255 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
djbkd has quit [Remote host closed the connection]
JDiPierro has joined #ruby
vdamewood has joined #ruby
djbkd has joined #ruby
bronson has quit [Ping timeout: 246 seconds]
tier has quit [Remote host closed the connection]
ForkingPaths has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<TheNet>
hey is it ok to ask for refactoring help here?
shum has quit [Quit: WeeChat 1.1.1]
checkit has quit [Ping timeout: 255 seconds]
shum has joined #ruby
beneggett has joined #ruby
JDiPierro has quit [Remote host closed the connection]
rubytor has quit [Remote host closed the connection]
Asher has quit [Read error: Connection reset by peer]
<epitron>
orangerobot: yeah, that's a parsing issue. you can do this instead --
<wallerdev>
see the first item has no comma, its just the item
<DogHackit>
gotcha
<wallerdev>
if you wanted to use gsub you could replace the commas with spaces, then split on spaces, but thatd be kinda pointless
<wallerdev>
lol
<work_op>
just gotta say, I've been using the seeing_is_believing plugin for atom these past few days, its changed the way i write ruby. i'll never go back
triple_b has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<TheNet>
havenwood: that gives you where the method is defined, right? I want to get the line and file where the method was _called_ while inside the method
bronson has quit [Ping timeout: 264 seconds]
uptownhr has quit [Quit: uptownhr]
wookiehangover has joined #ruby
IrishGringo has quit [Read error: Connection reset by peer]
ajaiswal has joined #ruby
Troy^ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ponga has quit [Remote host closed the connection]
mistermocha has quit [Remote host closed the connection]
lzx has quit [Remote host closed the connection]
badhatter has joined #ruby
mistermocha has joined #ruby
markfletcher has left #ruby [#ruby]
g-nom3 has joined #ruby
g-nom3 has quit [Max SendQ exceeded]
lzx has joined #ruby
piotrj has joined #ruby
himsin has joined #ruby
mistermocha has quit [Remote host closed the connection]
Lemur has joined #ruby
AlexRussia has quit [Ping timeout: 250 seconds]
icarus has joined #ruby
yfeldblu_ has joined #ruby
<ellisTAA>
can someone explain why some methods include an &block in the parameters. e.g. def duplicate(&block)
lioninawhat has joined #ruby
<ellisTAA>
what does the &block do
oo_ has quit [Remote host closed the connection]
kt2 has quit [Quit: ...]
Channel6 has joined #ruby
<sevenseacat>
nothing, until you call it
iliketurtles has quit [Quit: zzzzz…..]
kt2 has joined #ruby
yfeldblum has quit [Ping timeout: 245 seconds]
<ellisTAA>
what does that mean call it? i didnt read about calling in my ruby book
C1V0 has quit []
chenillen has joined #ruby
lzx has quit [Remote host closed the connection]
maximski has quit []
Musashi007 has joined #ruby
alderamin has joined #ruby
harfangk has joined #ruby
uptownhr has joined #ruby
silkfox has joined #ruby
<ellisTAA>
why do we yield to blocks? either way the block is getting executed?
tunaCanBruh has joined #ruby
Megtastique has quit []
<alderamin>
If I have a class Engine and a class Car, the Car class will have an attribute for an Engine object, but it seems inappropriate to call that attribute 'engine'. What's a good naming convention for the attribute?
Sid05 has quit [Quit: Sid05]
lioninawhat has quit [Remote host closed the connection]
<Radar>
alderamin: Why is it inappropriate?
Lemur has quit [Read error: Connection reset by peer]
ellisTAA has quit [Quit: ellisTAA]
chenillen has quit [Quit: chenillen]
deol has joined #ruby
Lemur has joined #ruby
<alderamin>
Radar: Doesn't that seem confusing?
postmodern has joined #ruby
<Radar>
alderamin: Why?
<Radar>
Confusing with what?
uptownhr has quit [Client Quit]
<sevenseacat>
seems appropriate to me that an engine attribute would give you an Engine object.
krz has quit [Ping timeout: 246 seconds]
tmtwd has quit [Remote host closed the connection]
quazimodo has quit [Ping timeout: 264 seconds]
silkfox has quit [Ping timeout: 250 seconds]
<alderamin>
Maybe it's just late. Is the Ruby Style Guide generally accepted?
orangerobot has quit [Quit: Page closed]
<Radar>
Which Ruby Style Guide?
jenrzzz has joined #ruby
tunaCanBruh has quit [Ping timeout: 250 seconds]
chenillen has joined #ruby
<sevenseacat>
asking the hard-hitting questions
oo_ has joined #ruby
bronson has joined #ruby
<Radar>
alderamin: Do you have a link to this style guide?
<Radar>
Ok, now let's get back to why you think it's confusing.
toothe has joined #ruby
M-Technic has joined #ruby
<Radar>
From a quick skim of the guide it looks like how I woudl code.
tjohnson has quit [Quit: Connection closed for inactivity]
<toothe>
I am trying to run this step (https://www.railstutorial.org/book/toy_app#sec-a_user_tour) but am getting this error "Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE
M-Technic has quit [Client Quit]
<sevenseacat>
most of it is pretty straightforward and common practice.
<TheNet>
alderamin: could just be me but for the most part I've found that "ruby style guides" tend to all agree with eachother
<toothe>
I downloaded what I thought was the Java Cryptographic Extension, but it didn't seem to fix the bug.
M-Technic has joined #ruby
<TheNet>
ruby seems to have pretty hard set conventions
<alderamin>
Radar: If I'm defining class behavior in my Engine class file, then defining methods to be performed on an engine attribute in the Car class file, that seems to be a big difference separated only by a capital letter.
redblue2 has joined #ruby
<Radar>
alderamin: !code
<helpa>
alderamin: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
<toothe>
yeah, brand new to ruby and this guide is failing me
<redblue2>
How does ruby know when it is blocked on io and to let another thread run?
<toothe>
I'm getting some kind of Java error.
<toothe>
"Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE
<redblue2>
Specifically - MRI
<redblue2>
toothe: Are you trying to run JRuby?
<toothe>
redblue2: I think so, I"m totally new to this.
<toothe>
I'm not even 100% certain I installed ruby correctly.
<Radar>
toothe: What does "ruby -v" show you?
bronson has quit [Ping timeout: 244 seconds]
mistermocha has joined #ruby
<toothe>
well first off, I keep having to do `source ~/.profile` to get it in my path, but its: jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13 +jit [linux-amd64]
<Radar>
toothe: Why are you using jruby?
<toothe>
because that's what Google said.
<Radar>
Usually people choose to use that version of Ruby because they want interop with Java.
<toothe>
no...
<Radar>
toothe: What does `which ruby` tell you?
kyb3r_ has joined #ruby
<toothe>
its in my /home/farhan/.rvm/rubies/jruby-1.7.19/bin/ruby
<Radar>
Ok, RVM.
<toothe>
i have to end up fixing the $PATH variable by doing `source ~/.profile`
<Radar>
rvm uninstall jruby
Sawbones has joined #ruby
kenneth has joined #ruby
<kenneth>
hey all
<Radar>
"rvm install ruby-2.2" I think is the command you're after.
<Radar>
I've not used RVM in a while.
<TheNet>
actually what's the reason for indenting case and when on the same level?
<toothe>
done.
<toothe>
see, that's the thing
<Radar>
toothe: What OS?
<toothe>
one person says "use rvm" one person says "no, use the source"
<Radar>
That's my blog post that people follow to set it up.
<Radar>
RVM can be a pain in the ass, as you're finding out now.
<kenneth>
i'm trying to run `bundle install` in a docker container running under a new user. it fails building a custom extension and it seems to be because it generates a runs `"DESTDIR=" make install-so`
<kenneth>
where is that DESTDIR coming from? i can't seem to debug it
<toothe>
lasjdflajsflkajsdf
lzx has joined #ruby
<TheNet>
Radar: hey do you have a similar blog post on deployment?
<Radar>
TheNet: Nope.
quazimodo has joined #ruby
fabrice31 has joined #ruby
poguez_ has quit [Quit: Connection closed for inactivity]
<Radar>
toothe: Yeah, it's pretty frustrating. What I'd recommend you do is "rvm implode" and then install Ruby using the guide that I just linked you to. A ton of people use it and install Ruby just fine with it.
<Radar>
Then it should be smooth sailing after that.
<toothe>
Radar: What's the latest version of ruby that ruby-install will DL?
<toothe>
i believe your guide says to install 2.2.0, but I'm not certain that's the latest version
Choclo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<alderamin>
TheNet, Radar: Thanks. I'll just go with 'Engine' class and 'engine' attribute. If it doesn't work, I can always refactor this small project.
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davedev24_ has quit [Ping timeout: 245 seconds]
fabrice31 has joined #ruby
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
uptownhr has quit [Quit: uptownhr]
ponga has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
blasius has quit []
fabrice31 has quit [Ping timeout: 245 seconds]
sigurding has joined #ruby
work__op is now known as work_op
work_op has quit [Changing host]
work_op has joined #ruby
towski_ has joined #ruby
jack_rabbit has joined #ruby
towski_ has quit [Remote host closed the connection]
slawrence00 has joined #ruby
marcdel has joined #ruby
<certainty>
moin
ptrrr has joined #ruby
swgillespie has joined #ruby
riotjones has joined #ruby
<arup_r>
certainty: moin
<certainty>
o/
<fawefeawfewa>
Does anyone know a relatively simple algorithm to predict the future values of a function with 1 value per second? If it was going up, it'll continue going up at the same rate... If it's going up in a senoidal way it'll continue doing the same... etc...? Bonus point if I can get a open source free for commercial use library that implements that thing...
<arup_r>
I know how to create Ruby object lazily by the way :-) I taught myself last night
DonOtreply has joined #ruby
readacted has joined #ruby
_mtr has joined #ruby
codecop has joined #ruby
JBlazeCoder21 has quit []
Akagi201 has quit [Remote host closed the connection]
last_staff has joined #ruby
apeiros_ has quit [Remote host closed the connection]
Akagi201 has joined #ruby
apeiros_ has joined #ruby
lyuben_ has quit [Quit: This computer has gone to sleep]
hmsimha has quit [Ping timeout: 252 seconds]
_mtr has quit [Ping timeout: 264 seconds]
iliketurtles has quit [Quit: zzzzz…..]
Rollabunna has quit [Ping timeout: 246 seconds]
kenneth__ has joined #ruby
apeiros_ has quit [Ping timeout: 245 seconds]
lkba_ has quit [Read error: Connection reset by peer]
lkba has joined #ruby
athan has quit [Ping timeout: 255 seconds]
andikr has joined #ruby
kenneth has quit [Ping timeout: 240 seconds]
lidaaa has quit [Ping timeout: 244 seconds]
kenneth has joined #ruby
fenzil has quit [Read error: Connection reset by peer]
<certainty>
arup_r: ah ok i see. did you have a usecase for that?
Aova has quit [Read error: Connection reset by peer]
<arup_r>
yes... I do
<arup_r>
that's why I was wondering
<certainty>
arup_r: well i could see a typical case where you'd have some object that you want to map over collection where one argument is fixed. that way you can partially apply the first argument and get the second from the collection
CpuID2 has joined #ruby
CpuID2 has joined #ruby
hvxgr has joined #ruby
<certainty>
pretty common in other languages. sometimes i wish i could do that easily in ruby too, but i usually resort to a custom class-level constructor
<arup_r>
My class need 3 pennies to give a instance of it.. But I can't give it that many in one place.. So I took that strategy to meet my need..
<arup_r>
This is a nice experience through a situation I had yesterday...
<arup_r>
Nice learning too
LetErikTry has quit [Quit: sleep]
<certainty>
i can imagine
pietr0 has quit [Quit: pietr0]
Sawbones has quit [Remote host closed the connection]
bal has joined #ruby
regnartim has quit [Ping timeout: 245 seconds]
<arup_r>
certainty: I can delay the Ruby object creation...
DonOtreply has quit [Quit: DonOtreply]
<arup_r>
Its awesome...
Aova has joined #ruby
<arup_r>
But it is only possible 2.2.0 as far as I can see
<agent_white>
Ooo...
<certainty>
arup_r: yes. afair there was only Proc#curry before
puppetmonkey has quit [Read error: Connection reset by peer]
puppetmonkey has joined #ruby
<certainty>
latest ruby5 podcast links to an article about new methods in ruby 2.2. I'm glad about Kernel#itself
thebastl_ has quit [Read error: Connection reset by peer]
thebastl has joined #ruby
tkuchiki has joined #ruby
<jnoob22>
nm ... looks like require 'archive' is correct but something is munged up... Could not open library 'libarchive.so': libarchive.so: cannot open shared object file: No such file or directory
iMe has quit [Ping timeout: 245 seconds]
centrx has joined #ruby
DouweM has quit [Read error: Connection reset by peer]
kappy has joined #ruby
pasv_ has quit [Ping timeout: 256 seconds]
greenarrow has joined #ruby
iMe has joined #ruby
porfa has joined #ruby
Stalkr_ has joined #ruby
livingstn has joined #ruby
agent_white has quit [Read error: Connection reset by peer]
agent_white has joined #ruby
mengu has joined #ruby
mengu has joined #ruby
paulfm has joined #ruby
pandaant has joined #ruby
Ivision_ has joined #ruby
Ivision has quit [Read error: Connection reset by peer]
IrishGringo has quit [Read error: Connection reset by peer]
astrobunny has quit [Remote host closed the connection]
IrishGringo has joined #ruby
agent_white has quit [Read error: Connection reset by peer]
Originerd has joined #ruby
agent_white has joined #ruby
phutchins has joined #ruby
<Originerd>
Hi, guys
<Originerd>
I have a question about guard
Choclo is now known as Choclo[Away]
AlexRussia has joined #ruby
<Originerd>
I’m using Mac OS X 10.10 Yosemite
Choclo[Away] is now known as Choclo
<Originerd>
I tried to use ‘terminal-notifier-guard’
jcromartie has joined #ruby
piotrj has joined #ruby
<Originerd>
So I added it to Gemfile and I executed guard, but it doesn’t work.
dumdedum has quit [Quit: foo]
<Originerd>
How do I set it? Could anyone help me?
dblessing has joined #ruby
nickjj_ is now known as nickjj
<centrx>
"doesn't work"
mdw has joined #ruby
triple_b has joined #ruby
<Originerd>
doesn’t work on Yosemite?
iMe has quit [Ping timeout: 264 seconds]
triple_b has quit [Client Quit]
jerematic has joined #ruby
<Originerd>
Is there any alternative?
triple_b has joined #ruby
<centrx>
Originerd, How does it not work? That's very vague
railsForDaiz has joined #ruby
<centrx>
Originerd, Your computer calls the FBI and shuts down?
rylev_ has quit [Read error: Connection reset by peer]
jerius has joined #ruby
rylev has joined #ruby
fabrice31_ has joined #ruby
atomical has joined #ruby
<ddv>
greenarrow: call #sort on it? or am I missing something?
djbkd has joined #ruby
<thatslifeson>
sort won't work there, it just has to be manually sorted
<ddv>
oh
Jackneill has joined #ruby
<greenarrow>
manually?
enebo has joined #ruby
yeticry has quit [Ping timeout: 244 seconds]
<centrx>
Why are you using a computer at all then
<thatslifeson>
not sure if joke or serious
fabrice31 has quit [Ping timeout: 245 seconds]
iMe has joined #ruby
<thatslifeson>
and yes, you have to write the sort method manually
gccostabr has quit [Quit: ZZZzzz…]
yeticry has joined #ruby
djbkd has quit [Ping timeout: 240 seconds]
freerobby has joined #ruby
freerobby has quit [Client Quit]
greenarr_ has joined #ruby
<centrx>
oh I see
<centrx>
I take it greenarrow knows thatslifeson ?
<thatslifeson>
how to write the method? i'm not sure
aclearman037 has joined #ruby
rubytor has quit [Ping timeout: 252 seconds]
DouweM has joined #ruby
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<workmad3>
that ordering isn't something most sort algorithms can deal with, seeing as it can't have strict ordering applied... NewsArticle > Event > Tweet > NewsArticle...
<jnoob22>
Hmm. I try: rvm use 2.2.0 but I get: RVM is not a function, selecting rubies with 'rvm use ...' will not work.
krz has quit [Quit: WeeChat 1.0.1]
avahey has joined #ruby
wottam has joined #ruby
paolooo has quit [Quit: Page closed]
<thatslifeson>
just use the <=> operator, compare both elements on its sides
<thatslifeson>
and then sort as is
greenarrow has quit [Ping timeout: 252 seconds]
Guest15 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
IrishGringo has quit [Read error: Connection reset by peer]
<greenarr_>
hmm
greenarr_ is now known as greenarrow
devdazed has joined #ruby
<centrx>
What is the actual rule for the sort
IrishGringo has joined #ruby
<jnoob22>
nm .... had to do /bin/bash --login .. weird.
Deele has joined #ruby
agent_white has quit [Read error: Connection reset by peer]
<workmad3>
thatslifeson: <=> doesn't seem possible there, as NewsArticle <=> Event could be 1 or -1... NewsArticle <=> NewsArticle could be 0 or -1...
agent_white has joined #ruby
jcromartie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<workmad3>
more likely what you need to do is duplicate the source array, then construct the sorted array by looking for the next NewsArticle, then the next Event, then the next Tweet, popping each used item out until the source is empty
<workmad3>
thatslifeson: heh :) yeah, a queue is a better answer ;)
<thatslifeson>
being lazy today
rbennacer has quit [Remote host closed the connection]
zacstewart has joined #ruby
<workmad3>
TheNet: how to safely share mutable data between threads is probably one of the most discussed topics around threads btw
<workmad3>
TheNet: lots of discussions about different mechanisms out there on googles
Timgauthier has quit [Read error: Connection reset by peer]
<TheNet>
workmad3: I tried the googles but it rejected me :(
<TheNet>
workmad3: I actually honestly didn't find that much myself
Timgauthier has joined #ruby
<workmad3>
TheNet: if you want something socket-like though, thatslifeson's suggestion of a queue is probably the way to go
amundj has quit [Ping timeout: 255 seconds]
<workmad3>
push data in one end of the queue, it pops out the other next time that thread can check it
bronson has joined #ruby
<TheNet>
alright I'll give it a shot
<TheNet>
thatslifeson, workmad3: thanks!
<workmad3>
and you can usually do sensible things, like make the .push block if the queue is full, and the .pop block if the queue is empty (which handles client starvation and server over-production aspects in a lot of cases)
tubbo has joined #ruby
tubbo has left #ruby ["WeeChat 1.1.1"]
Aova has quit [Read error: Connection reset by peer]
kapil__ has quit [Quit: Connection closed for inactivity]
momomomomo has quit [Quit: momomomomo]
Jetchisel has quit [Quit: "Unfortunately time is always against us" -- *Morpheus*]
railsForDaiz has joined #ruby
amundj has joined #ruby
fabrice31_ has quit [Remote host closed the connection]
deuterium has joined #ruby
gsd has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
odin22 has joined #ruby
redsoup has joined #ruby
gsd has joined #ruby
psyprus has quit [Changing host]
psyprus has joined #ruby
bronson has quit [Ping timeout: 264 seconds]
Takle has joined #ruby
<YamakasY>
canton7: yeah true, sorry was away
<YamakasY>
be back in 20 min aain
Aova has joined #ruby
danzilio has joined #ruby
hamakn has joined #ruby
mistermocha has joined #ruby
x77686d has joined #ruby
abuzze has joined #ruby
sent1nel has joined #ruby
xjiujiu has joined #ruby
totimkopf has joined #ruby
zenith_ has joined #ruby
pglombardo has joined #ruby
snath has joined #ruby
timonv has joined #ruby
mistermocha has quit [Client Quit]
sent1nel has quit [Remote host closed the connection]
hamakn has quit [Ping timeout: 252 seconds]
olivier_bK has quit [Read error: Connection reset by peer]
nfk has joined #ruby
blackmesa has quit [Quit: WeeChat 1.1]
pu22l3r has joined #ruby
Zai00_ has joined #ruby
fedalto has joined #ruby
Zai00 has quit [Ping timeout: 245 seconds]
Zai00_ is now known as Zai00
redsoup has quit [Read error: No route to host]
redsoup has joined #ruby
davidhq has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nepgear has joined #ruby
nepgear has quit [Client Quit]
sent1nel has joined #ruby
zyxelthrone has joined #ruby
davidhq has joined #ruby
Timgauthier has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
dblessing has joined #ruby
<alderamin>
Is there a common implementation of a bag/multiset in ruby? I can't find one in stdlib docs.
davidhq has quit [Client Quit]
Timgauthier has joined #ruby
karmatr0n has joined #ruby
<alderamin>
Oh, nevermind.
towski_ has joined #ruby
towski_ has quit [Remote host closed the connection]
chrishough has joined #ruby
momomomomo has joined #ruby
shredding has joined #ruby
iMe has quit [Ping timeout: 244 seconds]
railsForDaiz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
riotjone_ has quit [Remote host closed the connection]
livathinos has quit [Remote host closed the connection]
_maes_ has joined #ruby
<TheNet>
is it possible to overwrite more than just the last line in ruby/delete lines?
<ellisTAA>
can someone explain this: <=>; to me, e.g. a = [1,2,3] a.sort {|a,b| a<=>b}
<balazs>
heya. Is there a safe way to use backticks where no shell interpolation happens ?
tjohnson has joined #ruby
jaequery has joined #ruby
gccostab_ has joined #ruby
<apeiros>
ellisTAA: <=> is a normal method.
mleung has joined #ruby
<centrx>
ellisTAA, It's called the spaceship operator
<apeiros>
it compares two values and returns whether it's smaller, equal or bigger.
livathinos has joined #ruby
x77686d has quit [Ping timeout: 245 seconds]
<ellisTAA>
apeiros, but it doesn’t return the words smaller, bigger it returns the value so how does that work? how does it know what order to return them to me?
livathin_ has joined #ruby
RasKhadafi has joined #ruby
sent1nel has joined #ruby
DEA7TH has quit [Ping timeout: 252 seconds]
knutmithut has joined #ruby
<eam>
ellisTAA: it returns 1, 0 or -1
druznek has quit [Ping timeout: 245 seconds]
<ellisTAA>
apeiros: in the case with sort it returns the array but in an order determined by <=>
gccostabr has quit [Ping timeout: 265 seconds]
Grumelo has quit [Read error: Connection reset by peer]
<apeiros>
ellisTAA: which is what sort would use by default anyway
<YamakasY>
ok, replacing *.foo into .*.\foo where foo also can be blabla.foo
<apeiros>
ellisTAA: also methods have method documentation
chrishough has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<eam>
the sort() method calls its block repeatedly to compare two individual elements
<ellisTAA>
apeiros: ty
jimms has quit [Remote host closed the connection]
<knutmithut>
hey guys, i'm having trouble with SerialPort. I use it to send and receive binary data, but after some time it stops working. Even though the opend port does not get closed, it stops sending. And ideas about what's happening? Here is my code and some basic usage/output:
<eam>
knutmithut: I mean, can you describe the problem? What is occuring and what do you think shouldn't be occuring?
<ellisTAA>
havenwood: ty
iMe has joined #ruby
hmsimha has joined #ruby
adamjleonard has joined #ruby
mitchellhenke has quit [Ping timeout: 255 seconds]
rubytor has joined #ruby
peasoup has joined #ruby
ptrrr has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
tunaCanBruh has joined #ruby
pengin has quit [Ping timeout: 240 seconds]
agent_white has quit [Quit: bbl]
maximski has joined #ruby
<YamakasY>
erm anyone ? do I need to chain ?
<knutmithut>
eam: i'm sending these commands to a board which will set relays and another one that has an amplifier for a scale. both send 4 bytes in return, if the command was accepted. it works fine, until i start playing around with the scale, so the return value of the amplifier gets altered. then i receive once just 7 bytes (1 from the amplifier gets lost) and in the next iteration the serialport does not send anymore (checked with an
<knutmithut>
oszilloscope).
maximski has quit [Max SendQ exceeded]
dorei has joined #ruby
chrishough has joined #ruby
<knutmithut>
and it just works again, if i create a new SerialPort object (or restart the console)
maximski has joined #ruby
maximski has quit [Max SendQ exceeded]
Aova has quit [Read error: Connection reset by peer]
lolmaus has quit [Quit: Konversation terminated!]
<knutmithut>
is there maybe one byte of the 255 that influences the serialport in any way?
abuzze has joined #ruby
rippa has joined #ruby
maximski has joined #ruby
maximski has quit [Max SendQ exceeded]
<eam>
knutmithut: yes, serial ports have a line protocol
tunaCanBruh has quit [Ping timeout: 250 seconds]
<knutmithut>
even if an error occurs and a byte cannot be read, the next time the loop runs it should work again
<eam>
it's been a long time since I've fooled with this but you could absolutely be setting a state
maximski has joined #ruby
arup_r has joined #ruby
maximski has quit [Max SendQ exceeded]
<eam>
knutmithut: for example (sorry, somewhat unrelated) I uncovered a bug with syslog once where logging would hang when attempting to print to the console
maximski has joined #ruby
<knutmithut>
do you know how? because i need to be able to send and read all 256 bytes
shredding has joined #ruby
* YamakasY
is lost
<eam>
because a buggy DRAC would unset CLOCAL and block open() on DCD
ismael_ has quit [Remote host closed the connection]
<eam>
knutmithut: read up on how serial ports work, I'm happy to help however I can but I'd have to RTFM for a bit myself
sent1nel has joined #ruby
<eam>
knutmithut: you might look at what the gem is doing under the hood
abuzze has quit [Ping timeout: 252 seconds]
apurcell has joined #ruby
<eam>
there may be some ioctls involved
mikecmpbll has joined #ruby
<knutmithut>
yeah i'm currently trying to figure that out, hoped someone knew an answer somewhat faster than reading a lot of code :)
Aova has joined #ruby
<knutmithut>
i can't even figure out which byte is problematic
shum1 has quit [Ping timeout: 250 seconds]
<eam>
knutmithut: what serial device are you working on? try stty -F /dev/whatever
wottam has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zachrab has joined #ruby
<eam>
knutmithut: or use strace to pull out any interaction with the serial device and see what actually is going on
JoshGlzBrk has joined #ruby
jefus_ is now known as jefus
himsin has quit [Ping timeout: 240 seconds]
<eam>
this reminds me, I should get my pi running
<knutmithut>
ttySAC0, it's a odroid U3
rubytor has quit [Quit: No Ping reply in 180 seconds.]
<YamakasY>
anyone good at regex ?
blackoperat has joined #ruby
<eam>
knutmithut: well, inspect its state while working / not working
rubytor has joined #ruby
<eam>
YamakasY: don't ask to ask, just ask
<knutmithut>
ok, I'll do it :)
<YamakasY>
eam: I did
<YamakasY>
ok, replacing *.foo into .*.\foo where foo also can be blabla.foo
IrishGringo has joined #ruby
chinmay_dd has joined #ruby
himsin has joined #ruby
<YamakasY>
so I need to escape the dot and place a dot in front of a * when it's there
shredding has quit [Quit: shredding]
<eam>
I don't understand the problem, sorry. Could you restate it with more detail?
dmolina has quit [Ping timeout: 264 seconds]
livathin_ has quit []
<YamakasY>
ok, I can have foo.domain.tld where I need to escape all the dots, but I can also have *.domain.tld where I need to escape the dots and place a dot in front of the *
zachrab has quit [Ping timeout: 256 seconds]
iMe has quit [Ping timeout: 250 seconds]
ki0 has quit [Ping timeout: 250 seconds]
LouisRoR has quit [Ping timeout: 246 seconds]
<eam>
do you want the dot in front of the * escaped?
colli5ion has quit []
IrishGringo has quit [Ping timeout: 245 seconds]
jgt has quit [Ping timeout: 256 seconds]
iMe has joined #ruby
gsd has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<YamakasY>
eam: that is OK
<YamakasY>
escaping is never a problem
<YamakasY>
sorry I made a mess in the kitchen :D
alderamin has quit [Ping timeout: 252 seconds]
puppetmonkey has quit [Quit: puppetmonkey]
m8 has joined #ruby
<YamakasY>
eam: do I need some | ?
ponga has quit [Quit: Leaving...]
zacstewart has quit [Remote host closed the connection]
jgt has joined #ruby
<ellisTAA>
when i run this and pass “aabbb” into it it returns [‘a’, 2]; instead of [‘b’, 3] … anyone know why
<livinded>
Is there a way to use Rack::Multipart to parse multipart payloads and actually load files into a Rack::Multipart::UploadedFile rather than just returning the params hash so I can use Rack::Multipart.build_multipart with it?
<YamakasY>
eam: ping ?
fantazo has quit [Ping timeout: 246 seconds]
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JoshGlzBrk has joined #ruby
maximski has quit []
EvanFree_ has quit [Remote host closed the connection]
fantazo has joined #ruby
shredding has joined #ruby
iMe has quit [Ping timeout: 265 seconds]
triple_b_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<knutmithut>
eam: seems to work when i set the tty to raw mode with 'sudo stty raw -F /dev/ttySAC0'
bklane has quit [Remote host closed the connection]
JoshGlzBrk has quit [Client Quit]
Xeago has joined #ruby
zacstewart has joined #ruby
russt has joined #ruby
OrbitalKitten has joined #ruby
triple_b has joined #ruby
c_nick has joined #ruby
iMe has joined #ruby
<c_nick>
what is the difference of green threads and normal threads
momomomomo has joined #ruby
bklane has joined #ruby
adamjleonard has quit [Quit: Leaving...]
segv has quit [Ping timeout: 255 seconds]
lidaaa has joined #ruby
adamjleonard has joined #ruby
<havenwood>
c_nick: Green threads are made by the green team, of course!
rdark_ has quit [Read error: Connection reset by peer]
<eam>
YamakasY: you can print it out in between
segv has joined #ruby
bronson_ has joined #ruby
graydot has joined #ruby
yago has joined #ruby
bronson has quit [Read error: Connection reset by peer]
<YamakasY>
eam: ah that is indeed an idea, but where todo an each ?
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yfeldblum has quit [Remote host closed the connection]
sambao21 has quit [Quit: Computer has gone to sleep.]
<c_nick>
havenwood, so when i do a green thread and access I/O it will block all the other threads too in that process
dc_ has quit [Remote host closed the connection]
<c_nick>
or implement a synchronization / mutex etc
Choclo has joined #ruby
Ivision_ has quit [Ping timeout: 265 seconds]
raphaelss has quit [Ping timeout: 252 seconds]
pipework has joined #ruby
yago_ has joined #ruby
sambao21 has joined #ruby
zenith_ has quit [Ping timeout: 246 seconds]
<havenwood>
c_nick: well, back in the 1.8 days of green threads... my understanding is that the green thread doing IO would release the global vm lock and let other green threads use the os thread.
abuzze has joined #ruby
<havenwood>
c_nick: what brought up green threads?
<slushie||>
if i have a pool of threads and i need to run garbage collection manually, should i run it from within the pooled threads or from the main thread?
iMe has quit [Ping timeout: 245 seconds]
kroder has quit [Remote host closed the connection]
IrishGringo has joined #ruby
<eam>
YamakasY: seems fine
raphaelss has joined #ruby
<c_nick>
havenwood, nice link :)
<c_nick>
thanks
iMe has joined #ruby
selu has joined #ruby
c_nick has quit [Quit: Ex-Chat]
djbkd has joined #ruby
selu has quit [Client Quit]
tvw has quit []
OrbitalKitten has joined #ruby
cocotton_ has joined #ruby
riotjones has joined #ruby
<YamakasY>
eam: but doesn't replace a *.domain in \.*.\domain
sambao21 has quit [Quit: Computer has gone to sleep.]
DonOtreply has quit [Quit: DonOtreply]
cocotton has quit [Ping timeout: 256 seconds]
kirun has joined #ruby
ismael_ has joined #ruby
fryguy9 has quit [Quit: Leaving.]
lucyinthesky has joined #ruby
lucyinthesky has left #ruby ["Leaving"]
riotjones has quit [Ping timeout: 264 seconds]
avahey has joined #ruby
DonOtreply has joined #ruby
lolmaus has joined #ruby
iliketurtles has quit [Quit: zzzzz…..]
peasoup has joined #ruby
fryguy9 has joined #ruby
iliketurtles has joined #ruby
iliketurtles has quit [Remote host closed the connection]
dumdedum has quit [Quit: foo]
jenrzzz has joined #ruby
chrishough has joined #ruby
pygospa has quit [Ping timeout: 245 seconds]
danzilio has quit [Quit: My computer has fallen asleep!]
baroquebobcat has quit [Quit: baroquebobcat]
baroquebobcat has joined #ruby
athan has quit [Ping timeout: 246 seconds]
lyuben_ has quit [Quit: This computer has gone to sleep]
blackoperat has quit [Ping timeout: 245 seconds]
fenzil has joined #ruby
dfinninger has joined #ruby
pygospa has joined #ruby
<ellisTAA>
hello. i’m working on a problem that is frustrating me. i feel like i’m writing a lot of code for this problem. can anyone recommend a way that would reduce the code? i can’t think of dealing with it any other way
<havenwood>
YamakasY: there's only one start of the String, so #sub instead of #gsub
nateberkope has joined #ruby
fedalto has quit [Quit: leaving]
nateberkopec has quit [Read error: Connection reset by peer]
wldcordeiro has quit [Ping timeout: 265 seconds]
<havenwood>
ellisTAA: use `string.chars` in place of `string.split("")`
jenrzzz has quit [Ping timeout: 246 seconds]
Ivision has quit [Ping timeout: 252 seconds]
<havenwood>
ellisTAA: it doesn't seem you quite understand #map yet
<ellisTAA>
havenwood: why nto?
<ellisTAA>
not
alex88 has joined #ruby
wldcordeiro has joined #ruby
<ellisTAA>
my understanding of map is that it applies some code to every element of an array
<ellisTAA>
and returns a new array
zachrab has joined #ruby
<havenwood>
instead of `new_array = array.map ...` you're disregarding the #map return value and treating it like an #each, building your own Array manually.
randiman has joined #ruby
jenrzzz has joined #ruby
paulfm has quit [Read error: Connection reset by peer]
blackoperat has quit [Remote host closed the connection]
aswen has joined #ruby
leat has joined #ruby
<havenwood>
ellisTAA: #each repeatedly executes the block for each iteration (presumably for the side-effects). #map repeatedly executes the block and appends the return value for each iteration to a new Array.
iamjarvo has joined #ruby
Sawbones has joined #ruby
<YamakasY>
havenwood: thanks
<havenwood>
YamakasY: you're welcome
roshanavand has quit [Ping timeout: 240 seconds]
siso has joined #ruby
deuterium has quit [Quit: zzZZZzzz..]
<havenwood>
ellisTAA: So #each for side-effect and #map for its return value, a new Array.
Pupeno has quit [Remote host closed the connection]
<exhacker>
havenwood: Thank you too
<centrx>
exhacker, Also you may want to look into the 'case' statement for that sort of multi-conditional
totimkopf has quit [Ping timeout: 250 seconds]
<exhacker>
centrx: oh, ok, I will
dc_ has joined #ruby
ellisTAA has quit [Quit: ellisTAA]
<bronson_>
Is it possible to call a module like a method?
dagda1 has joined #ruby
Pupeno has joined #ruby
Pupeno has joined #ruby
bronson_ is now known as bronson
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
yfeldblum has quit [Ping timeout: 245 seconds]
<bronson>
Something like My::Config(12)? Because there's only one config, My::Config.new(12) doesn't make a lot of sense.
<havenwood>
ellisTAA: Now try to use #map instead of #each. So drop `new_array = []` and all the `new _array <<`s and do: new_array = array.map do |x| ...
gfawcettpq1 has quit [Ping timeout: 244 seconds]
<centrx>
bronson, No, but what are you trying to do?
<centrx>
bronson, It is possible to have a method named Config, that would be a method on My, but that is somewhat unusual
<bronson>
centrx: It's kinda complex but I'll try to describe.
<pipework>
I'm a fan of My::config
<centrx>
bronson, You may be looking for "Singleton", but if there's only one Config, why are you passing the number 12?
<pipework>
Which is really just My.config for the popular kids these days.
chrishough has joined #ruby
<bronson>
pipework: hm, that sounds promising.
jottr has joined #ruby
athan has joined #ruby
chrishough has quit [Remote host closed the connection]
cocotton_ has quit [Remote host closed the connection]
<bronson>
The problem is with my Geolocal gem... It generates code to geolocate IP addresses.
Aova has quit [Read error: Connection reset by peer]
<havenwood>
pipework: module Nokogiri; class << self; alias_method :html, :HTML end end
<havenwood>
pipework: :)
<pipework>
bronson: Configuration patterns are fun. I usually have MyNamespace::Configuration, which is a class that holds all the config data. Then I have MyNameSpace::Configuration::DSL that yields self to a block for DSL goodness. and then I hook it together with a MyNamespace::configuration method that gets a new instance of Configuration, passes the block into that, which Configuration then gets a new instance of DSL and passes the block and then
<pipework>
sets the Configuration instance that results from that as the response of MyNamespace.configuration
<pipework>
havenwood: IKR :*
<bronson>
To use it, do this: require 'geolocal'; Geolocal.configure { |c| c.countries = {us:'US'} }. Then you run a rake task to generate the code.
<bronson>
For simplicity, the code it generates is in the Geolocal namespace too: require 'geolocal'; Geolocal.in_us?(request.ip)
<pipework>
That way DSL can expose only the interface you want, your configuration class can have other methods and fun things that can't be called from the DSL, and you store an instance of that configuration on the namespace as a class method.
IrishGringo has quit [Ping timeout: 245 seconds]
<bronson>
PROBLEM IS, now I have two geolocal.rb files: the one that supplies the config, and the one for the generated code.
centrx has quit [Quit: Shutting down, Please wait...]
<bronson>
Sometimes Ruby manages to load them in the wrong order, then *boom*
<bronson>
So I need to rename on of them to resolve the ambiguity, but it would be nice to have autoload still make sense.
ldnunes has quit [Quit: Leaving]
<bronson>
Was thinking: require 'geolocal/config'; Geolocal::Config do { ... }
<pipework>
bronson: IMO, I don't really like depending on autoloading. I use autoload for code reloading, but I just require dependencies of things.
Rarikon has quit [Read error: Connection reset by peer]
<bronson>
pipework: true, I tend to do the same. still need to come up with different filenames tho.
Aova has joined #ruby
<bronson>
require 'geolocal/config'; Geolocal::Config.config do { ... } just looks weird.
Rarikon has joined #ruby
<pipework>
bronson: If you get stumped on that, I hear SecureRandom.uuid is a great way to get names for new files. :p
<pipework>
bronson: Usually I just do Geolocal.config {|c| }
<bronson>
guaranteed unique! kinda ugly in a require statement though.
wallerdev has quit [Quit: wallerdev]
<pipework>
If you pass a block to #config, it yields to the configuration, if you don't, it just returns it. Both return it, one just uses the block.
Takle has quit [Remote host closed the connection]
danzilio has quit [Quit: My computer has fallen asleep!]
JoshGlzBrk has joined #ruby
EvanFreeman has quit [Ping timeout: 244 seconds]
Pupeno has quit [Read error: Connection reset by peer]
Pupeno has joined #ruby
zarubin has joined #ruby
leat has quit [Ping timeout: 265 seconds]
aqabiz has quit [Client Quit]
danzilio has joined #ruby
Xeago has quit [Ping timeout: 264 seconds]
markfletcher has joined #ruby
iliketurtles has quit [Quit: zzzzz…..]
sambao21 has joined #ruby
willgorm- is now known as willgorman|away
rushed has joined #ruby
aqabiz has joined #ruby
koding123 has quit [Ping timeout: 246 seconds]
iliketurtles has joined #ruby
aswen has quit [Ping timeout: 245 seconds]
Hijiri has quit [Quit: aaa]
jenrzzz has quit [Ping timeout: 256 seconds]
yago has joined #ruby
tvw has quit []
iMe has quit [Ping timeout: 246 seconds]
leslie has quit [Quit: Have you ever tried to eat a clock? It's very time consuming.]
leslie has joined #ruby
leslie is now known as Guest63769
Aova has quit [Read error: Connection reset by peer]
Xeago_ has quit [Remote host closed the connection]
Guest63769 has quit [Client Quit]
robbyoconnor has quit [Ping timeout: 264 seconds]
iMe has joined #ruby
reprazent has quit [Remote host closed the connection]
mitchellhenke has quit [Quit: Computer has gone to sleep.]
nfk has quit [Quit: yawn]
lyuben_ has joined #ruby
adamjleonard has quit [Quit: Leaving...]
Choclo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Aova has joined #ruby
baweaver has joined #ruby
ukd1 has quit [Quit: leaving]
CpuID2 has quit [Quit: This computer has gone to sleep]
blackmesa has quit [Quit: WeeChat 1.1]
mitchellhenke has joined #ruby
athan has quit [Ping timeout: 246 seconds]
pygospa has quit [Quit: leaving]
iliketurtles has quit [Quit: zzzzz…..]
<exhacker>
when I do a = system("something") it returns TRUE even if the command ended with an error message. is there a way to make a = the error message?
cocotton has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
mitchellhenke has quit [Client Quit]
lanemeyer has quit [Ping timeout: 246 seconds]
<crome>
exhacker: take a look at open3
rushed has quit [Quit: rushed]
fmcgeough has quit [Quit: fmcgeough]
tomengland has quit [Ping timeout: 250 seconds]
<exhacker>
crome: OK i will, thanks for the tip
pygospa has joined #ruby
The_Phoenix has quit [Read error: Connection reset by peer]
ki0 has joined #ruby
tomengland has joined #ruby
cocotton has quit [Remote host closed the connection]
adamjleonard has joined #ruby
GaryOak_ has quit [Remote host closed the connection]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eam>
exhacker: $? is the return value
frem_ has joined #ruby
<shadoi>
exhacker: Shell is also useful
chinmay_dd has quit [Quit: Connection closed for inactivity]
<eam>
open3 can get you the stderr, but $? is all you need if you want the exit code
paradoja has joined #ruby
<crome>
eam: he made it pretty clear he wanted the error
aswen has joined #ruby
EasyCo has joined #ruby
randiman has quit [Quit: (null)]
shredding has quit [Quit: shredding]
chrishough has joined #ruby
last_staff has quit [Quit: last_staff]
<exhacker>
eam: ah, I didn't understand that definition when I read it, thank you
<exhacker>
shadoi: Thanks
brb3 has quit [Quit: ZZZzzz…]
paulfm has quit [Quit: Zzzzz...]
<exhacker>
eam: oh the return value not the error, yea i needed the error
* crome
shuts up
<eam>
crome: can't be sure until I ask :)
<eam>
open3 is good advice
<exhacker>
it's still good to know. i'm coming from R to Ruby and every single thing is different.
<crome>
from R, whoa
<eam>
yeah that is not a typical progression
<exhacker>
lol yea, i'm a CS guy trapped in a statisticians' body. ruby gets me closer to real programming :)
<crome>
exhacker: the common ground is pretty much the "R" :)
Takle has joined #ruby
<exhacker>
crome: lol
Spami has joined #ruby
<crome>
I think what ruby gets you the closest to is plumbing
RAKNUS has joined #ruby
<exhacker>
crome: what do u mean?
ItSANgo has quit [Quit: Leaving...]
<crome>
don't worry about it just yet, just make sure you have enough duct tape
<exhacker>
lol
shredding has joined #ruby
<RAKNUS>
hi people..someone can help me please? in italian maybe
<exhacker>
you can't do much except analysis in R, so I figured this way I can use Rails and build apps around my analytical code
<crome>
ruby is an awesome language that coindidentally makes it just a bit too easy to do horrible, horrible things
athan has joined #ruby
<crome>
it has a peculiar learning curve
pygospa has quit [Quit: leaving]
<exhacker>
crome: haha. should be interesting...
jenrzzz has joined #ruby
baroquebobcat has joined #ruby
<RAKNUS>
no italians here?
<exhacker>
RAKNUS: Qual è la tua domanda? Non so di Ruby, ma io traduco ...
<RAKNUS>
exhacker...ciao....vorrei provare a ricordare
<crome>
rails is an (mostly) awesome framework that, being on top of ruby, makes it waaaay to easy go about developing apps with the complete lack of sensible design or sustainable practices
<crome>
good luck, it's a wonderful world!
zarubin has quit [Remote host closed the connection]
<exhacker>
RANKUS: Ciao
totimkopf has joined #ruby
<exhacker>
crome: thanks
<RAKNUS>
ciao exhacker...puoi aiutarmi?
cphrmky has joined #ruby
brb3 has joined #ruby
cphrmky has left #ruby [#ruby]
cphrmky has joined #ruby
<exhacker>
RANKUS: Non ho visto la tua domanda Ruby. Si può chiedere di nuovo?
totimkopf has quit [Client Quit]
regnartim has quit [Quit: Leaving]
<crome>
exhacker: joke aside, have fun learning ruby and rails, it is actually fun
Mon_Ouie has joined #ruby
tvw has joined #ruby
OrbitalKitten has joined #ruby
<exhacker>
crome: i did the codecademy.com module on it, but after 10 hours of that i still can't really do much yet
<exhacker>
it helped tho i guess
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crome>
most people have absolutely no idea how rails works after having spent years with it
<crome>
so you are on the right track
<exhacker>
groovy
avahey has quit [Quit: Connection closed for inactivity]
RAKNUS has left #ruby [#ruby]
commmmodo has quit [Quit: commmmodo]
mitchellhenke has joined #ruby
athan has quit [Ping timeout: 246 seconds]
<exhacker>
well that guy rankus asked twice in italian if we could help him and twice i asked what his question was so that i could translate it, then he left
athan has joined #ruby
reinaldob has joined #ruby
<crome>
sounds like most italians on ircnet
<exhacker>
heh
fabrice31 has joined #ruby
yago has quit [Ping timeout: 245 seconds]
zachrab has joined #ruby
yago has joined #ruby
retnuh has joined #ruby
avahey has joined #ruby
retnuh has left #ruby [#ruby]
CpuID2 has joined #ruby
CpuID2 has joined #ruby
reinaldob has quit [Remote host closed the connection]
diegoviola has quit [Remote host closed the connection]
fabrice31 has quit [Ping timeout: 245 seconds]
tunaCanBruh has joined #ruby
vdamewood has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
atomi has quit [Quit: upgrading docker]
codecop has quit [Remote host closed the connection]
tensor-dev has quit [Remote host closed the connection]
tensor-dev has joined #ruby
<havenwood>
soosfarm: --path is a remembered option, so when you prefix `bundle exec` to a command it will look to that location
maximski has quit []
ItSANgo has joined #ruby
davedev2_ has quit [Ping timeout: 245 seconds]
az7ar is now known as az7ar_away
<soosfarm>
hm, okay, doesn’t seem to do that though, if I do RUBYLIB=<pathtospecific-gem-inside-vendor-bundle>/lib and execute the script it works
davedev24_ has joined #ruby
<havenwood>
soosfarm: and `bundle exec` prefixed to the script doesn't work?
<soosfarm>
oh god
jgt has quit [Ping timeout: 245 seconds]
<soosfarm>
i didn’t know that :(
<soosfarm>
of course it works perfectly, thanks
Soliah has joined #ruby
<havenwood>
soosfarm: that's how you run in the context of the bundle :)
<soosfarm>
oh, makes sense
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LouisRoR has quit [Ping timeout: 252 seconds]
josephndenton has joined #ruby
posixpascal has quit [Ping timeout: 252 seconds]
posixpanda has joined #ruby
LouisRoR has joined #ruby
pdoherty has joined #ruby
tensor-dev is now known as tensor
rushed has quit [Quit: rushed]
shum has quit [Quit: WeeChat 1.1.1]
DonOtreply has joined #ruby
ki0 has quit [Remote host closed the connection]
shum has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
kirun has quit [Quit: Client exiting]
OrbitalKitten has joined #ruby
hmsimha has quit [Ping timeout: 252 seconds]
baroquebobcat has quit [Quit: baroquebobcat]
josephndenton has quit [Ping timeout: 264 seconds]
leafybasil has joined #ruby
sambao21 has quit [Quit: Computer has gone to sleep.]
it0a has quit [Ping timeout: 245 seconds]
pygospa has quit [Quit: leaving]
pygospa has joined #ruby
Astrologos_ has joined #ruby
gccostabr has joined #ruby
mjuszczak has joined #ruby
gccostabr has quit [Client Quit]
<mjuszczak>
I'm trying to use Net::HTTP to fetch a URL and read the headers. Unfortunately having a bit of trouble. Are there examples anywhere? So far I have: http = Net::HTTP.new('localhost', '8080') ... how would I then find a header value?
<Senjai>
I answered because it looks like you put in the work to try. But if you didn't I'd ask you to google it, because I know that'd be the first result :P
<Senjai>
ellisTAA:
<ellisTAA>
yeah that code took me a while to write
jgt has joined #ruby
mitchellhenke has quit [Quit: Computer has gone to sleep.]
Troy^ has joined #ruby
charliesome has quit [Quit: zzz]
philwantsfish has quit []
GPH|work has quit [Read error: Connection reset by peer]
shredding has quit [Quit: shredding]
kt2 has quit [Read error: Connection reset by peer]
zacstewart has quit [Remote host closed the connection]
kt2 has joined #ruby
baroquebobcat has joined #ruby
zacstewart has joined #ruby
ValicekB has quit [Ping timeout: 246 seconds]
newline1 has quit [Quit: Leaving.]
susmus has quit [Ping timeout: 272 seconds]
ismael_ has quit []
devdazed has quit [Quit: Computer has gone to sleep.]
ismael_ has joined #ruby
susmus has joined #ruby
kt2 has quit [Max SendQ exceeded]
ismael_ has quit [Client Quit]
puppetmonkey has quit [Quit: puppetmonkey]
werelivinginthef has quit [Remote host closed the connection]
ismael_ has joined #ruby
kt2 has joined #ruby
Axy is now known as Mia
yago has joined #ruby
VBlizzard has joined #ruby
newline1 has joined #ruby
badhatter has quit [Read error: Connection reset by peer]
Sawbones has quit [Read error: No route to host]
Sawbones has joined #ruby
badhatter has joined #ruby
shum has quit [Quit: WeeChat 1.1.1]
Sawbones has quit [Client Quit]
bronson has quit [Remote host closed the connection]
shum has joined #ruby
dc__ has quit [Remote host closed the connection]
blizzy has quit [Ping timeout: 245 seconds]
VBlizzard is now known as blizzy
<Senjai>
ellisTAA: I recommend asking yourself "Do I need to be doing this?"
<Senjai>
quite often
<Senjai>
It's the fastest way of getting better IMO
<ellisTAA>
senjai: that code was part of an assignment, but ty
<Senjai>
Ah
RowdyChildren has quit [Ping timeout: 264 seconds]
Guest29161 has quit [Ping timeout: 256 seconds]
jgt has quit [Ping timeout: 246 seconds]
<Senjai>
Typically, if it sounds like something else someone would normally have to do, odds are they've done it and its open source somewhere
fryguy9 has quit [Quit: Leaving.]
blackmesa has quit [Quit: WeeChat 1.1]
ValicekB has joined #ruby
pengin has joined #ruby
markfletcher has left #ruby [#ruby]
charliesome has joined #ruby
wjimenez5271_ has quit [Ping timeout: 256 seconds]
rubytor has quit [Quit: No Ping reply in 180 seconds.]
BTRE has quit [Ping timeout: 256 seconds]
allcentury has quit [Ping timeout: 264 seconds]
kith has quit [Ping timeout: 264 seconds]
Hijiri has joined #ruby
<Senjai>
If its for an assignment
<Senjai>
you could reverse engineer Prime.prime?
iMe has quit [Ping timeout: 246 seconds]
tensor has quit [Quit: tensor]
RowdyChildren has joined #ruby
tensor-dev has joined #ruby
wjimenez5271 has joined #ruby
Evan_ has joined #ruby
BTRE has joined #ruby
iMe has joined #ruby
rubytor has joined #ruby
yago has quit [Remote host closed the connection]
vasilakisfil has joined #ruby
mjuszczak has quit []
fryguy9 has joined #ruby
stunder has quit [Quit: Leaving]
ismael2 has joined #ruby
fgo has joined #ruby
Aova has quit [Read error: Connection reset by peer]
narph has quit [Quit: Connection closed for inactivity]
fryguy9 has quit [Client Quit]
tensor-dev is now known as tensord
tarwich has joined #ruby
tarwich has left #ruby ["undefined"]
F__i__L has quit [Ping timeout: 265 seconds]
Choclo has joined #ruby
pengin has quit [Remote host closed the connection]
goodenough has joined #ruby
ismael2 has quit [Quit: Leaving.]
pengin has joined #ruby
tensord is now known as aqz
baweaver has quit [Remote host closed the connection]
bronson has joined #ruby
fenzil has quit [Ping timeout: 255 seconds]
Aova has joined #ruby
aqz is now known as tens0r
Hijiri has quit [Read error: Connection reset by peer]
Pupeno has quit [Remote host closed the connection]
Hijiri has joined #ruby
pengin has quit [Ping timeout: 245 seconds]
ismael_ has quit []
ismaelga has joined #ruby
tens0r has quit [Quit: tens0r]
charliesome has quit [Quit: zzz]
antgel has quit [Ping timeout: 245 seconds]
dc_ has joined #ruby
enebo has quit [Quit: enebo]
paradoja has quit [Remote host closed the connection]
DadoCe has quit [Remote host closed the connection]
Sid05 has joined #ruby
Apocalypse has joined #ruby
davejacobs has joined #ruby
iMe has quit [Ping timeout: 256 seconds]
jottr_ has quit [Read error: Connection reset by peer]
m8 has quit [Quit: Sto andando via]
Sid05 has quit [Client Quit]
jottr_ has joined #ruby
lkba has joined #ruby
fabrice31 has joined #ruby
momomomomo has quit [Quit: momomomomo]
baweaver has joined #ruby
iliketurtles has quit [Remote host closed the connection]
iMe has joined #ruby
crueber has quit [Quit: Leaving.]
iliketurtles has joined #ruby
kt2 has quit [Quit: ...]
kt2 has joined #ruby
CpuID2 has quit [Quit: This computer has gone to sleep]
jottr_ has quit [Ping timeout: 264 seconds]
Sid05 has joined #ruby
kt2 has quit [Client Quit]
fabrice31 has quit [Ping timeout: 244 seconds]
newline1 has left #ruby [#ruby]
tunaCanBruh has joined #ruby
kt2 has joined #ruby
allcentury has joined #ruby
kalusn has joined #ruby
blackoperat has joined #ruby
wldcordeiro has quit [Ping timeout: 265 seconds]
charliesome has joined #ruby
xp_prg has quit [Ping timeout: 250 seconds]
fenzil has joined #ruby
athan has quit [Ping timeout: 246 seconds]
danjordan has joined #ruby
tunaCanBruh has quit [Ping timeout: 246 seconds]
ki0 has joined #ruby
ellisTAA has quit [Quit: ellisTAA]
rsty has joined #ruby
rsty1 has quit [Read error: Connection reset by peer]
Troy^ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
adriancb has quit [Remote host closed the connection]
dorei has quit []
Moneyxxl has joined #ruby
ki0 has quit [Ping timeout: 245 seconds]
davejacobs has quit []
vdamewood has joined #ruby
Moneyxxl has left #ruby [#ruby]
davejacobs has joined #ruby
rushed has joined #ruby
jottr_ has joined #ruby
nateberkopec has joined #ruby
frem_ is now known as frem
deric_skibotn has quit [Ping timeout: 250 seconds]
ellisTAA has joined #ruby
ellisTAA has left #ruby [#ruby]
Takle has quit [Remote host closed the connection]
apeiros_ has quit [Remote host closed the connection]
ecksit has joined #ruby
ForkingPaths has joined #ruby
apeiros_ has joined #ruby
hmsimha has quit [Ping timeout: 252 seconds]
n008f4g_ has quit [Ping timeout: 252 seconds]
ForkingPaths has quit [Max SendQ exceeded]
jlast has quit [Remote host closed the connection]
danjordan has quit [Quit: danjordan]
Vile` has quit [Ping timeout: 245 seconds]
jlast has joined #ruby
nateberkopec has quit [Quit: Leaving...]
ptrrr has quit [Quit: ptrrr]
Vile` has joined #ruby
bogdanteleaga has joined #ruby
rsty has quit [Ping timeout: 256 seconds]
einarj has joined #ruby
Sid05 has left #ruby [#ruby]
phutchins has joined #ruby
einarj has quit [Remote host closed the connection]
posixpanda has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jlast has quit [Ping timeout: 240 seconds]
reinaldob has joined #ruby
sanguisdex has quit [Ping timeout: 255 seconds]
iMe has quit [Ping timeout: 245 seconds]
skj3gg has joined #ruby
dsahni has joined #ruby
kalusn has quit [Remote host closed the connection]
rfi has quit [Ping timeout: 245 seconds]
iMe has joined #ruby
rfi has joined #ruby
lys has joined #ruby
rubytor has quit [Quit: No Ping reply in 180 seconds.]