apeiros_ changed the topic of #ruby to: Ruby 1.9.3-p327: http://ruby-lang.org (ruby-2.0.0-preview2) || Paste >3 lines of text on http://gist.github.com
<dunpeal> alternatively, is there a way to at least get the filename causing this?
hotovson has joined #ruby
hotovson has quit [Remote host closed the connection]
Kuifje has quit [Ping timeout: 265 seconds]
adeponte has quit [Remote host closed the connection]
<eka> dunpeal: fixing it?
malte_ has quit [Quit: malte_]
adeponte has joined #ruby
<dunpeal> eka: with 1.9.x, can I always replace an iconv call with a String#encode one?
tpelletier has joined #ruby
tpelletier has quit [Client Quit]
banisterfiend has quit [Ping timeout: 252 seconds]
rismoney has joined #ruby
cableray has quit [Quit: cableray]
banisterfiend has joined #ruby
DaltonUS has quit [Quit: DaltonUS]
thecreators has joined #ruby
<rismoney> has anyone used win32api ?
<mpfundstein> u should. but testing it doesnt harm
banisterfiend has quit [Ping timeout: 260 seconds]
philips_ has quit [Excess Flood]
Na_Klar has quit [Quit: ChatZilla 0.9.87 [Firefox 17.0.1/20121129164337]]
snorkdude has quit [Quit: snorkdude]
snorkdude has joined #ruby
adamnbowen has quit [Quit: Textual IRC Client: www.textualapp.com]
geggam has joined #ruby
<geggam> /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:294:in `block in load_gemspec_uncached': invalid byte sequence in US-ASCII (ArgumentError)
<geggam> any pointers ^
<geggam> on how to fix
tenmilestereo[aw has joined #ruby
iamjarvo has joined #ruby
philips_ has joined #ruby
twoism has joined #ruby
_64k has joined #ruby
malte_ has joined #ruby
tenmilestereo has quit [Disconnected by services]
tenmilestereo[aw has quit [Client Quit]
emocakes has quit [Quit: emocakes]
tenmilestereo has joined #ruby
Virunga has quit [Remote host closed the connection]
twoism has quit [Remote host closed the connection]
twoism has joined #ruby
icole has joined #ruby
zastern has quit [Remote host closed the connection]
joallard has joined #ruby
twoism has quit [Ping timeout: 265 seconds]
otters has joined #ruby
<joallard> I just crashed my computer with a ruby console. Is this normal?
lenovodroid has joined #ruby
<wildcard1> no, but awesome!
<wildcard1> can you tell us how?
dsdeiz has quit [Ping timeout: 260 seconds]
<joallard> Sure
<shevy> joallard this is not normal
<joallard> I was looking if there was lazy evaluation on an or in an inject
<shevy> joallard do you use windows
<havenn> joallard: Windows.
<joallard> (1..10**10).to_a.inject(|a,b| a || b)
<joallard> don't run this as is
<shevy> on linux, ruby never managed to crash my computer
<joallard> havenn: Linux.
<havenn> joallard: AMG!
<wildcard1> joallard: that certainly goes on for a while
banisterfiend has joined #ruby
<wildcard1> ran out of ram?
<joallard> probably.
<wildcard1> do you see OOMs in your logs?
healpay has joined #ruby
<joallard> i couldn't see anything, the whole thing just crashed after a while
<shevy> ok you create a huge array
<wildcard1> that's interesting
<canton7> yeah, #to_a is never, ever going to be lazy :P
<shevy> hehe
<joallard> Haha, lesson learned
elico has quit [Quit: elico]
<joallard> I wonder if I should report this somewhere
<joallard> shouldn't there be a cap on memory
<geggam> normal systems limit that for you
mockra has joined #ruby
<joallard> geggam: define "normal" :)
<geggam> not windows ?
<mpfundstein> yeah actually malloc should fail and abodt ruby
<havenn> joallard: Running it now, curious how much ram this will take... :P
<mpfundstein> abort*
<wildcard1> in linux, malloc will never return NULL unless overcommit is off
<havenn> Aaack, 14GB and counting.
<mpfundstein> malloc would abort
cakehero has quit [Quit: Computer has gone to sleep.]
freakazoid0223 has joined #ruby
mockra_ has joined #ruby
<wildcard1> malloc wont abort when overcommit is on
<wildcard1> that's what overcommit does
<mpfundstein> good info thx
<wildcard1> i find this is a big problem for ram tight jvm environments
<mpfundstein> wow i just read about it
<neurotech> As part of learning Ruby, I'm looking to build this simple, one page tip calculator in Ruby using sintra, haml and js: https://www.dropbox.com/s/95o1gkkbnov96r2/tipcalc.png
<joallard> I'm looking at kern.log...
dsdeiz has joined #ruby
<mpfundstein> the kernel allocates and doesnt fail before u try to use it
<mpfundstein> dont know. weird behavior imo
Noldorin has joined #ruby
<neurotech> What should I look into in regards to having the slider update the "percentage of total" text?
mockra has quit [Ping timeout: 255 seconds]
jonahR has quit [Quit: jonahR]
<canton7> neurotech, http://jqueryui.com/slider/
cascalheira has joined #ruby
<wildcard1> mpfundstein: it's been default behaviour for quite long in linux. since 2.2 i think. it's normally a good thing, but it has edge cases.
banisterfiend has quit [Ping timeout: 255 seconds]
<neurotech> ty canton7
<mpfundstein> didnt know that. and i do c linux coding for a while :-)
<neurotech> canton7: How should I include jquery? can I just do gem install jquery, then require 'jquery' ?
<wildcard1> cool, i miss c sometimes
<joallard> okay then, how should I evaluate a block through an array until the first that returns true?
<canton7> neurotech, it's a javscript library
stevechiagozie has quit [Ping timeout: 250 seconds]
<canton7> neurotech, this is all done with javascript/html, not ruby
phelps has joined #ruby
<mpfundstein> i dont like that it obscurrs a problem. if i check in my code if malloc fails i expect it to have some mean :-)
banisterfiend has joined #ruby
xAndy is now known as xandy
dsdeiz has quit [Ping timeout: 246 seconds]
kmurph has joined #ruby
geggam has quit [Quit: fewd !]
<canton7> neurotech, in fact, that mockup you pasted is 95% javascript, 3% html, 1% ruby
<canton7> (and 1% magic)
<neurotech> Yeah, I'm pretty new to this stuff
jsilver has quit [Ping timeout: 245 seconds]
<neurotech> I want to do it this way to get my head around sinatra, haml, heroku
<neurotech> maybe it's too simple
<canton7> it's a good web dev exercise
<canton7> doesn't involve much ruby, though :P
cakehero has joined #ruby
<havenn> joallard: Well, it runs. Took 16GB RAM plus 63GB SSD Swap but didn't crash. :P
joallard has quit [Quit: Ex-Chat]
anders_ has quit [Quit: Lämnar]
<mpfundstein> lol
joallard has joined #ruby
<mpfundstein> awesome
samphippen has quit [Quit: Computer has gone to sleep.]
<joallard> havenn: nice.
ner0x has joined #ruby
<joallard> now try 10**12 !
<havenn> joallard: Ha, I've only got 512 SSD... that is a non-starter. :)
<joallard> ;)
<ner0x> Is there a way to make .inspect be "prettier" with possible indents and newlines?
blischalk has joined #ruby
<canton7> ner0x, pp ?
<ner0x> canton7: Not sure what that is.
<canton7> require 'pp' \n pp some_object
g_bleezy has quit [Remote host closed the connection]
dsdeiz has joined #ruby
banisterfiend has quit [Read error: Operation timed out]
<joallard> ner0x: what i do is use yaml to do `y thing`
Catnaroek has joined #ruby
<neurotech> ner0x: I like awesome_print
stefan41 has quit [Remote host closed the connection]
siksi has quit [Ping timeout: 252 seconds]
six has joined #ruby
emergion has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<ner0x> What would be the best way to avoid geocoding during tests?
emergion has joined #ruby
dsdeiz has quit [Ping timeout: 244 seconds]
otters has quit [Quit: WeeChat 0.3.9.2]
xandy is now known as xAndy
swex has quit [Remote host closed the connection]
swex has joined #ruby
friskd has quit [Ping timeout: 255 seconds]
cascalheira has quit [Quit: Linkinus - http://linkinus.com]
yshh has joined #ruby
<wildcard1> ner0x: put in a fixed location?
matchaw has joined #ruby
<ner0x> wildcard1: Look like they updated the gem with new :test lookup. Nice. Didn't know that.
<wildcard1> cool
<shevy> hmmm
<shevy> if I have a hash, is there a simple way to print 4 keys+values on each line? it has about 60 elements in total, so 15 lines it should be
xAndy is now known as xandy
<wildcard1> sometihng like this ?
reppard has joined #ruby
freakazoid0223 has quit [Ping timeout: 252 seconds]
<wildcard1> h.keys.each_with_index do |key,index| ..stuff.. if index > 4 break end
<wildcard1> ?
infinitiguy2 has quit [Read error: Connection reset by peer]
icole has quit [Remote host closed the connection]
xaq has quit [Remote host closed the connection]
blazes816 has quit [Quit: blazes816]
<heftig> do the each_with_index stuff, print things, and "puts if index % 4 == 3" at the end to get a linebreak every 4 entries
<wildcard1> oh i misread, my bad. you want a mod
<wildcard1> ya what he said
<wildcard1> :)
cjhanks has joined #ruby
<heftig> or do each_slice(4)
<shevy> ah
<cjhanks> I've tried 3 examples to compile ruby C extensions, none worked. How can you create a module method?
slainer68 has quit [Remote host closed the connection]
<wildcard1> cjhanks: i tend to use ffi. i havent written a full module in C in long
jsilver has joined #ruby
jblack_ has quit [Ping timeout: 252 seconds]
tonypelletier has joined #ruby
NiteRain has joined #ruby
<ner0x> Geocoder.configure: Can I put this in the enrivonments files? Or does it have to go into /initializers/ ?
cableray has joined #ruby
<heftig> shevy: h.each_slice(4).map { |slice| slice.map { |k,v| "#{k}:#{v}" }.join(" ") + "\n" }.join
Asher2 has joined #ruby
<shevy> thanks! you are the man!
<cjhanks> wildcard1: Thanks or the tip, it looks like it will do what I like. But the lack of ease makes me want to just abandon ruby support.
<wildcard1> that's unfortunate
denken has quit [Quit: leaving]
<shevy> I tried .slice and wondered why it wasnt working, then I realized I needed more beer before trying to ponder about this
<heftig> alternatively, join(" ") }.join("\n")
<heftig> then the last line won't be terminated by a newline
denken has joined #ruby
taoru has joined #ruby
Asher has quit [Ping timeout: 252 seconds]
jarred has quit [Quit: jarred]
<shevy> I am out of beer :(
<burgestrand> cjhanks: rb_define_singleton_method, if by module method you mean one invokable without an instance?
<burgestrand> (core has a "module_function" as a separate thing, which is both a class method on the module it is defined on, as well as a private instance method on the object the module is included into)
lenovodroid has quit [Remote host closed the connection]
<burgestrand> (… but that ain’t a module method)
xandy is now known as xAndy
jfl0wers has joined #ruby
daniel_hinojosa has quit [Ping timeout: 265 seconds]
tonypelletier has quit [Quit: leaving]
emergion has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<cjhanks> bubuz: Thank or the clarification. Your suggestion worked.
<reppard> shevy: i've got a few i could spare
<shevy> reppard btw I managed to compile ruby from source finally, using new binutils
burgestrand has quit [Quit: Leaving.]
zeade has quit [Quit: Leaving.]
emergion has joined #ruby
<reppard> shevy: very nice. I'll remember that if I try building it anytime soon =)
<reppard> actually...i'll just go ahead and brew install that
felipe_Brz has joined #ruby
<felipe_Brz> hi is this http://pastie.org/5582354 the best way to catch parameters on the cli?
dyrot has quit [Ping timeout: 244 seconds]
<felipe_Brz> i mean, this = ~ notation is a little bit unnatural
<felipe_Brz> is there another way to capture regexps ?
<shevy> I never see = ~
<shevy> only =~
_64k has quit [Quit: _64k]
<shevy> aha, in your paste it is =~ and not = ~
<ner0x> Anyone know how I can modify the path to which capybara looks for browsers?
<shevy> felipe_Brz, =~ is the shortest, there exists also .match though
<reppard> ner0x: in what respect??
<felipe_Brz> shevy: but then even if I use .match then i still need to refer to the captured stuff as $1 and $2 and so on?
dunpeal has left #ruby [#ruby]
daniel_hinojosa has joined #ruby
icole has joined #ruby
<reppard> ner0x: google capybara default browser?
<ner0x> reppard: Past that part, doesn't find them on my box.
<shevy> felipe_Brz within a matchdata object, you can call [1] [2] etc... rather than $1
<reppard> ner0x: does it error out or does it just load up firefox
<ner0x> reppard: it won't load any browsers. They all crash as soon as it's up.
<felipe_Brz> shevy: i see thanks for helping
kmurph has quit [Quit: kmurph]
daniel_hinojosa has quit [Client Quit]
<reppard> what do you mean they all crash? does that mean that its actually trying to start the browser?
nick_h has quit [Ping timeout: 264 seconds]
<shevy> felipe_Brz, object = /(\d+):(\d+)/.match("Time: 12:34am")
<ner0x> reppard: It's trying to start the browser but all the executables on linux for firefox/chrome are shell commands, not binaries.
<shevy> object[0] # => "12:34"
<shevy> object[1] # => "12"
<shevy> object[2] # => "34"
<shevy> felipe_Brz you see?
nick_h has joined #ruby
<shevy> but I like =~ more
<reppard> ner0x: type which firefox
<shevy> though $1 $2 is ugly
<reppard> i'm pretty sure that will point to a binary
<felipe_Brz> shevy: thanks..can you chain other commands to the results if you use =~?
daniel_hinojosa has joined #ruby
<ner0x> reppard: False. /usr/bin/firefox is a shell script that points to /usr/lib/firefox
<ner0x> reppard: which firefox brings up the bin version.
* ner0x isn't a noob. :)
<shevy> felipe_Brz hmmm not sure... if it not ambigous, most likely
<shevy> felipe_Brz or you may have to use () parens
<felipe_Brz> shevy: i see i'll try it and see thanks
<shevy> (x = y =~ /bla/).lala()
<shevy> or whatever else you want to do there
<shevy> $1 is a bit odd...
<shevy> they seem to get reset quite often
Chryson has quit [Ping timeout: 252 seconds]
<reppard> ner0x: hmmm, i've been spoiled for a few months now with this macbook air =)
<reppard> lemme ssh into one of my linux boxes
EhyehAsherEhyeh_ has quit [Ping timeout: 265 seconds]
<reppard> hmmm, i don't really understand why it would matter if to was loading a script or not
dyrot has joined #ruby
jarred has joined #ruby
<ner0x> Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
swex_ has joined #ruby
AlSquire has quit [Quit: This computer has gone to sleep]
<ner0x> Unless of course it doesn't start a selenium driver for you.
<reppard> do you have selenium-webdriver installed?
<heftig> firefox needs the selenium extensions
<reppard> apparently the webdriver is dependent on the firefox version
<reppard> which might explain some issues i've had at work with firefox crashing on me from time to time =)
swex has quit [Ping timeout: 252 seconds]
xAndy is now known as xandy
snorkdude has quit [Quit: snorkdude]
chriskk has joined #ruby
emsilva has quit [Quit: Computer has gone to sleep.]
Russell^^ has quit [Quit: Russell^^]
<ner0x> Yeah, tried it with chrome: End of File error.
stevechiagozie has joined #ruby
marr has quit [Ping timeout: 265 seconds]
kil0byte has joined #ruby
jfl0wers has quit [Quit: jfl0wers]
adkron has joined #ruby
love_color_text has joined #ruby
tenmilestereo has quit [Quit: Leaving]
<ner0x> Yeah, it doesn't work with selenium out of the box.
jfl0wers has joined #ruby
GlenK has quit [Quit: leaving]
matip_ has joined #ruby
emsilva has joined #ruby
becom33 has quit [Ping timeout: 246 seconds]
love_color_text has quit [Remote host closed the connection]
xemu2 has joined #ruby
otters has joined #ruby
postmodern has joined #ruby
miskander has quit [Quit: miskander]
ttt has joined #ruby
matip has quit [Ping timeout: 265 seconds]
xemu has quit [Ping timeout: 252 seconds]
eka has quit [Quit: Computer has gone to sleep.]
slainer68 has joined #ruby
eka has joined #ruby
sailias has quit [Read error: Connection reset by peer]
sailias has joined #ruby
eka has quit [Client Quit]
jonahR has joined #ruby
jenrzzz has joined #ruby
slainer68 has quit [Ping timeout: 250 seconds]
becom33 has joined #ruby
thinkclay has quit [Quit: Leaving.]
moshee has quit [Ping timeout: 260 seconds]
icole has quit [Remote host closed the connection]
moshee has joined #ruby
icole has joined #ruby
joallard has quit [Quit: Ex-Chat]
kmurph has joined #ruby
Iszak has quit []
jrajav has joined #ruby
Noldorin has quit [Quit: Computer has gone to sleep.]
icole has quit [Ping timeout: 250 seconds]
krz has joined #ruby
statarb3 has quit [Ping timeout: 246 seconds]
jarred has quit [Quit: jarred]
jenrzzz has quit [Ping timeout: 250 seconds]
Hanmac1 has joined #ruby
Takehiro has joined #ruby
thecreators has quit [Remote host closed the connection]
zeade has joined #ruby
Hanmac has quit [Ping timeout: 255 seconds]
adeponte has quit [Remote host closed the connection]
Takehiro has quit [Ping timeout: 246 seconds]
<aedorn> I need a way to test code against a web server that fails in some way... Sometimes it sends bad data, sometimes an unexpected response, etc. I don't suppose anyone made something like that for testing purposes?
snorkdude has joined #ruby
snorkdude has quit [Client Quit]
Averna has joined #ruby
adkron has quit [Ping timeout: 244 seconds]
<reppard> aedorn: could you not stub response codes?
Noldorin has joined #ruby
havenn has quit [Remote host closed the connection]
stevechiagozie has quit [Ping timeout: 256 seconds]
<aedorn> reppard: no, not for this. I need something I can run for X amount of time and get Y amount of different things happening. Well, okay, I could stub it all out it would just take forever
<ner0x> reppard: Got poltergeist up and running. Faster and I can page.driver.render("#{file}") if I need to see it.
<felipe_Brz> is there a way to catch the 'undefined local variable' exception with a function just like you can method_not_found?
lawliet has quit [Quit: lawliet]
Averna has quit [Quit: Leaving.]
sn0wb1rd has joined #ruby
toekutr has joined #ruby
<reppard> reppard: very nice, glad you got it worked out
<reppard> one of the teams at work uses poltergeist but i haven't done much with it
<ner0x> It's pretty easy to set up. No actual browser but that slows down testing anyway.
<reppard> oops, -reppard * ner0x
<ner0x> Realistically I just wanted to see what the page looked like during certain phases of the integration test.
<ner0x> Since I can render it out, no harm no foul.
<reppard> we use selenium and i hate the browser popping up for every test so i usually set up an x virtual frame buffer
<ner0x> I feel like I'm the only one who still uses Test::Unit
jarred has joined #ruby
<reppard> ner0x: i'm pretty sure the koans are still using test unit ;)
<ner0x> Good enough. I like straight syntax. The wordy coding annoys me.
<reppard> i love Test::Unit
<reppard> the only thing i like more with rspec is the string definitions
<reppard> if a test method name is really long using snake case is annoying sometimes
bigmac has joined #ruby
<reppard> but i prefer assert to .should
<matip_> I can't find why gem install stanford-core-nlp doesn't work. here is the log: http://paste.kde.org/632012/ . any idea?
<felipe_Brz> is there a channel for general programming ?
<ner0x> reppard: snake case? _ _ _ _?
jrajav has quit [Quit: phunq, sandwich store loop, WHAT NO UNIVERSE]
<reppard> ner0x: yeah
<ner0x> reppard: test 'thing is to do this why not' do in Test::Unit?
matip_ is now known as matip
matip has quit [Changing host]
matip has joined #ruby
<reppard> ner0x: does that work? never tried like that
<reppard> i've always seen def test_this_should_do_something
jimeh has quit [Quit: Computer has gone to sleep.]
<reppard> matip: you try setting the path when you exec gem install?
jarred has quit [Quit: jarred]
<reppard> gem install blah blah JAVA_HOME=/path/
* matip is trying ^
<matip> same error
<ner0x> reppard: Yes, that works.
charliesome has joined #ruby
<reppard> perhaps i'll be revisiting Test::Unit
<reppard> I was thinking about giving minitest a good run
<matip> # JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/; gem install stanford-core-nlp
<reppard> matip: why sudo?
<matip> this worked ^
<matip> (as root)
<matip> weird
<ner0x> reppard: Minitest didn't really give a good enough reason for me to switch. Cucumber was a no way. RSpec I didn't really like. I guess I'm picky.
jarred has joined #ruby
<matip> reppard, why are you asking? isn't it common to install gems as root?
stevechiagozie has joined #ruby
<reppard> Cucumber didn't make sense to me as when I was learning that stuff I had no business end to present too
<reppard> matip: it all depends
<matip> on..?
<ner0x> matip: Not really
jarred_ has joined #ruby
<matip> what do you do instead?
<reppard> your gems dont have to be glabally installed anyway
jarred_ has quit [Client Quit]
<ner0x> matip: Look up rvm
<reppard> you can put them in vendor/bundle
<reppard> on a per project basis
<reppard> root not needed
<eph3meral> felipe_Brz: not really
<ner0x> reppard: He's better off learning rvm realistically. He might not need multiple versions but it's stil the easiest option.
<eph3meral> felipe_Brz: you might check #algorithms though
<reppard> ner0x: indeed..or rbenv
<reppard> =)
<felipe_Brz> eph3meral: hmmm i see... but somewhere to discuss programming language theory, is there anywhere like that?
<postmodern> reppard, if your going to go the rbenv route, just use ruby-build + chruby
<ner0x> reppard: Right.
<reppard> postmodern: that is a fair argument
jarred has quit [Ping timeout: 245 seconds]
<reppard> doesn't seem to be much difference to me though
<postmodern> reppard, rbenv shims seem to confuse a lot of people
<reppard> you use ruby-build with rbenv
<postmodern> reppard, chruby doesn't use shims, it just manipulates PATH
<reppard> ahh i gotcha
<reppard> i see that now
<reppard> hmm, i kind of like the shims
<postmodern> reppard, also if you use ruby-build directly, you can install rubies into /opt/rubies/ instead of ~/.rbenv/versions/
<postmodern> reppard, i kind of like not having to type `rbenv rehash` all the time :P
<reppard> postmodern: thats why i created an alias ;)
<reppard> but yeah
<reppard> rehash kind of threw me off at first
dmiller has quit [Remote host closed the connection]
<reppard> exec $SHELL works too
mrdtt has joined #ruby
<shevy> if ($text =~ /([A-Z]{3})/) { print "The string has $1 substring";}
<shevy> perl
<felipe_Brz> how would I go about iterating through a hash and, for each key,value, create a variable named "key" that holds value ? i thought there would be something analogous to what map does for arrays
<shevy> ruby is perl cleaned-up
<eph3meral> ruby is python that doesn't suck
<shevy> felipe_Brz you cant use something like .each_pair {|key,value|
<shevy> felipe_Brz ?
freeayu has joined #ruby
<felipe_Brz> shevy: well but how would I create a variable
<eph3meral> felipe_Brz: there's always /list btw
<shevy> felipe_Brz also, .map is more "apply on each element"
The_8473 has joined #ruby
<shevy> felipe_Brz you know how to create a variable in ruby. foo = "xyz", foo is a variable
<shevy> hash.each_pair {|my_key, my_value|; key = my_value
<eph3meral> felipe_Brz: map is basically to "transform" an array… you still get an array back, very similar to the original, but each item in the array is slightly different from what it was
The_8472 has quit [Ping timeout: 246 seconds]
<eph3meral> felipe_Brz: lol, you don't know how to create variables?
ner0x has quit [Quit: Leaving]
<shevy> he knows
<shevy> he just forgot it
<felipe_Brz> well
<shevy> it can happen when the brain is confused about something else
<felipe_Brz> can I mention php here or will i be stoned?
<eph3meral> felipe_Brz: have you done any beginner's tutorials yet?
<eph3meral> haha, stoned
<eph3meral> most likely
<shevy> felipe_Brz you wont need php
cakehero has quit [Quit: Computer has gone to sleep.]
<felipe_Brz> i'll mention anyway because i think it's the only way
<shevy> you asked how to iterate through a hash.
<shevy> use .each_pair {|key,value|}
<felipe_Brz> shevy: yes ok, i think my true doubt lies in creating a variable dinamically
<shevy> .each_pair {|key,value| x = "bla "+key}
katherinem13 has quit [Quit: katherinem13]
<shevy> now you have a "dynamic" variable
<reppard> eww
<reppard> meta!!!
katherinem13 has joined #ruby
<felipe_Brz> but I don't know the name of the variable i will create!
<shevy> he wont need eval :)
<shevy> felipe_Brz it is not needed either, you could always use an array for those variables too
<shevy> and then use accessor methods to access that array
<reppard> felipe_Brz: why do you need to dynamically create variables? can you not just call the keys you need?
<felipe_Brz> reppard: i can but it is a bit unwieldy
<shevy> felipe_Brz if you really want to use totally dynamic names, then you have to use eval() most likely, but that is awful, I tell you. try it once, then you understand
<reppard> i've only found eval useful for creating regex from strings
<shevy> felipe_Brz it may be best if you could say from where you start, and what end goal you want to achieve
<ryanf> reppard: Regexp.new
<shevy> {:a => 5, :b => 6, :c => 7}.each_pair {|key,value| puts "#{key}: #{value * 2}" } # => {:b=>6, :c=>7, :a=>5}
<felipe_Brz> i have a hash with string keys and string values, and I wish I could create a variable for each pair, where the name of the variable is |key| and the value is |value|
<shevy> oops
<reppard> ryanf: i know but that doesn't always play nice with gets
<shevy> ignore the result, the result is ok, just irb giving the wrong thing that I pasted
<shevy> # b: 12 c: 14 a: 10
nfk has quit [Quit: yawn]
<shevy> ok hash with string keys, string values
benlieb has quit [Quit: benlieb]
<shevy> let's go step by step
<reppard> felipe_Brz: i guess what i dont understand is why you need to do this when you have a key and a value already
<reppard> both of which can be modified if need be
<reppard> whats the point in having the collection in the first place you know?
<shevy> hash = { 'a' => '5', 'b' => '6', 'c' => '7', 'd' => '8' }
<shevy> now the question is... why you really need variables haha
<shevy> ok so you want to create
<shevy> a = 5
<shevy> b = 6
<shevy> one simple way via
<shevy> instance_variable_set
<felipe_Brz> reppard: yes i know I'm making a shell script and i've stored lots of options in a string string hash now I want to turn the |key|s into variables so I can use them more easily
<reppard> felipe_Brz: hash[key]
<shevy> hash = { 'a' => '5', 'b' => '6', 'c' => '7', 'd' => '8' }
<shevy> hash.each_pair {|key,value| instance_variable_set(('@'+key).to_sym,value) }
<shevy> now you have
<shevy> @a @b @c @d
<shevy> try it in irb
<felipe_Brz> shevy: just did
<reppard> felipe_Brz: are these values static?
<felipe_Brz> not really reppard
<shevy> well, in a class you can use that easily
<reppard> i was going to say
<reppard> just create a class
<shevy> class FelipeLikesRuby; def initialize; hash = { 'a' => '5', 'b' => '6', 'c' => '7', 'd' => '8' } ; hash.each_pair {|key,value| instance_variable_set(('@'+key).to_sym,value) }; end
<reppard> and have something like OPTIONS = { 'a' => blah, so on}
<shevy> and if you want accessors, you can use attr*
<reppard> and doe something like def self.[] key
<shevy> x = FelipeLikesRuby.new # => #<FelipeLikesRuby:0xb6541bfc @a="5", @b="6", @d="8", @c="7">
<reppard> OPTIONS[key]
<reppard> end
jfl0wers has quit [Quit: jfl0wers]
<shevy> :)
<shevy> this will be felipe_Brz first real class in ruby!
<reppard> shevy: haha
<felipe_Brz> hehe
<shevy> let's make sure he understand reppard's code
<shevy> felipe_Brz, you understand: def self.[] key
<shevy> ?
<shevy> the [] part
<felipe_Brz> lets see
<shevy> :)
<reppard> it would have to be within a class obviously
<felipe_Brz> that's you overriding the [] thing?
<reppard> so class OptionsClass or something
<shevy> yeah within class FelipeLikesRuby
<shevy> ok but how is the [] thing called felipe_Brz
<reppard> or that =)
<shevy> )in a general way)
<felipe_Brz> array accessor yes?
<shevy> well
<felipe_Brz> array notation
<shevy> for an array yes... but here we have a new class
<shevy> your own class!
<shevy> but this is ok as an answer
<shevy> you could write def self.[] key but also def self.[](key)
francisfish has quit [Ping timeout: 260 seconds]
ry4nn has joined #ruby
<shevy> and call it on your instance like foo['bla']
<shevy> well actually
<shevy> FelipeLikesRuby['bla']
<shevy> reppard is a clever man
<shevy> and not on your instance, sorry
<shevy> as def self was used
<shevy> without self, it would be on the instance
cakehero has joined #ruby
<shevy> tada!
<felipe_Brz> shevy reppard i see, that'll get the job done. thanks for helping
<reppard> anytime!
<shevy> class FelipeLikesRubyMoreThanPhpNow
<shevy> class FelipeNowThinksThatRubyIsMoreFunToo
<shevy> hmmm
<shevy> noone uses such long names though
<felipe_Brz> i use php to do some stuff but i never thought it was better than ruby
<felipe_Brz> php is sort of like a frankestein that has had a few limbs attached here and there
mrdtt has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
mrdtt_ has joined #ruby
<felipe_Brz> thing is, i get a lot done with it hehe
<shevy> as a language in total, probably not... but php is still very useful, if you can look past the fact that it is not as beautiful as ruby
<shevy> yeah I know :(
<shevy> I'd wish ruby would have the same focus on the WWW
<swarles> I don't
blischalk has quit [Quit: blischalk]
<swarles> That makes for shitty languages
<swarles> Like.... PHP
<xybre> For debugging purposes, I'm trying to get some information on a context, variables and such. Problem is, it seems to be executing in the wrong context.
<shevy> no, PHP never had any real design. it always lacked someone capable of thinking
<shevy> oh an eval riddle
<shevy> we need someone clever
<autumn> swarles: however ask someone who has used little more and to them, it is the holy grail
<shevy> reppard, Hanmac1
<xybre> Yeah, eval "Should" be able to evaluate in the context given to it, but it seems oblivious.
<swarles> Well, of course it's a good tool. But the web should be something it just happens to do well
mrdtt_ has quit [Client Quit]
<swarles> Like how Perl just happens to be good for CGI
<shevy> ok
<shevy> but perl was before php :(
mrdtt has joined #ruby
<xybre> perl happens to be good for regex.
<shevy> there used to be really nice browser games in perl
<swarles> yes, but that doesnt matter
<swarles> what..
<ryanf> xybre: object.send :binding does not do what you want it to
<ryanf> xybre: every object in the system has a private binding method, but they're all the same -- it's just the top-level "binding" method that you can invoke anywhere to get your current binding
<shevy> old AM Mari archmage... you had one mage, 5 colours. if all forts were down, you were dead. you used spells to summon, attack etc... the mechanics were not the main thing, but people rallied together in guilds, on IRC. that was awesome
<shevy> aaaah ryanf is the smart man able to help :)
<xybre> ryanf: Ah. Wonderful.
* xybre headdesks
<shevy> top-level binding... my brain needs to remember that
<ryanf> xybre: here's some black magic for you https://github.com/pry/pry/blob/master/lib/pry/core_extensions.rb
<ryanf> __binding__ is what you wanted "send :binding" to do
<xybre> BindingImplMethod hmm
<ryanf> if you don't want to re-implement that, you could always just load pry and then call that version of __binding__ ;)
<ryanf> I kind of forget why it needs to be so complicated. I understood briefly
<xybre> Thanks, I'll dig around :)
ruben_ has joined #ruby
sorbo_ has joined #ruby
<shevy> lol ryanf
<ruben_> Goodbye!
ruben_ has left #ruby [#ruby]
<shevy> this is an epic quote
phelps has quit [Quit: Textual IRC Client: www.textualapp.com]
<shevy> "Briefly, in a glimpse, I understood the whole universe. Then I realized I had a headache ..."
<shevy> but fear not, in 1000 years the human overlords will chuckle about our limited intelligence
jrajav has joined #ruby
<aedorn> hmmm... I think the only reason Perl is on my system is for ack
<shevy> hehe
<shevy> aedorn what distribution you use
xemu2 has quit [Ping timeout: 252 seconds]
tchebb has quit [Ping timeout: 252 seconds]
jblack has joined #ruby
<aedorn> Sabayon
<shevy> ah gentoo is this right ... hmmm
<aedorn> yeah, pretty much
<shevy> if it would be debian, apt/dpkg I think uses perl
havenn has joined #ruby
jrajav has quit [Client Quit]
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
<shevy> hmm but come to think about it... it seems as if perl is used less and less
<aedorn> I wanted something that I didn't feel like I had to fight every 10 seconds to get something done, but not so complex as to require lots of time to reload the whole system if needed.
xpen has joined #ruby
<shevy> uh, but doesn't gentoo force a lot of extra time? since you must compile + setup more
becom33_ has joined #ruby
<reppard> set up puppet and run away
<aedorn> shevy: Yes, but Sabayon is binary based with their own repositories. It does inherit from Gentoo, and you're more than welcome to compile from source, but you certainly don't have to
cjhanks has left #ruby ["Leaving"]
<shevy> ah
malte_ has quit [Quit: malte_]
<shevy> that sounds a bit like a merge of gentoo + archlinux
ryanf has quit [Quit: leaving]
tchebb has joined #ruby
<becom33_> http://pastie.org/5582599 Im trying to get the $stuff . what am i doing wrong
<reppard> arch uses pacman right?
<swarles> yes
becom33 has quit [Ping timeout: 265 seconds]
<reppard> i've only installed that on one box and didn't use it for very long
<reppard> seemed stable from what i could tell
<swarles> pacman -S is how you install
<swarles> -Ss is search
<xybre> I guess there's no way of getting around an Object method :/
<becom33_> after "echo" there can be anything . I just want check if any one the tmp array function are listed after echo
<aedorn> eh.. it's more like a merge of Gentoo and Ubuntu. Sabayon makes it super easy
freakazoid0223 has joined #ruby
becom33_ is now known as becom33
<shevy> xybre everything is an object, even a method! and a message of a method object to another method object!
<reppard> xybre: how do you mean? its ruby..theres usually away
ryanf has joined #ruby
<reppard> not saying its a good idea but you can pretty much do anything
<reppard> haha
<shevy> eval() inside an eval() inside a loop()
moos3 has quit [Quit: Computer has gone to sleep.]
<swarles> Yeah. I've been known to get the id of objects when I'm somewhere and I can't access it directly
<swarles> and use ObjectSpace._id2ref
adeponte has joined #ruby
<xybre> shevy: of course. I was just trying to call methods on objects in general without having to inject a special method into Object itself to get the context.
<becom33> hey shevy some help ?
<xybre> Still can't get local_variables from a context yet though.
<shevy> becom33 ask
<xybre> er binding
<becom33> http://pastie.org/5582599 Im trying to get the $stuff . what am i doing wrong
<becom33> after "echo" there can be anything . I just want check if any one the tmp array function are listed after echo
<xybre> reppard: metaprogramming voodoo :) Getting local_variables from a context passed into a method.
cakehero has quit [Quit: Computer has gone to sleep.]
<shevy> becom33, there must be an error here:
<shevy> v = tmp.find { |m| line =~ /echo [A-Za-z\s\W]+ #{Regexp.escape(m)}/ }
<shevy> are you sure this code works?
<shevy> because it seems as if .find returns nil
<shevy> so line is probably nil
<xybre> For debug purposes, I jsut want to be able to log the locals in a method, and the instance variables in the object, without having to pass them all in one at a time.
<becom33> shevy, no thats why Im asking you a help
<reppard> man that is beautiful
<becom33> regex is wrong
<rismoney> anyone use win32api ?
<shevy> becom33 well
<shevy> becom33 I am not sure what you want to do there
<reppard> my head hurts now
<reppard> goodnight eveyone
reppard has quit [Quit: leaving]
<shevy> becom33 cant you try to change that regex
<becom33> i want check if any of tmp array values are in the string after echo
<shevy> I dont like your variable names ;)
<becom33> Im trying Im getting nil all the time
regedarek has quit [Read error: Operation timed out]
<becom33> shevy, those are demo variables
jblack has quit [Ping timeout: 255 seconds]
<shevy> becom33, http://pastie.org/5582621 can you work from here
<shevy> it returns at least the match to "hello"
Nisstyre-laptop has quit [Ping timeout: 252 seconds]
ananthakumaran has joined #ruby
<becom33> |line| line this is very wrong
freakazoid0223 has quit [Quit: Leaving]
zastern has joined #ruby
twoism has joined #ruby
<shevy> why
<shevy> what are you trying to do
nari has joined #ruby
<becom33> string is "echo $stuff" i wanted to check if any of the tmp array values are after the echo in string . the thing is the string is dynamic so before or after echo there can be anything since those are php and html codes special chars also can be there
<shevy> I am not quite able to grasp it yet
<shevy> let me break it down so that my brain can understand
<becom33> ok
<shevy> the string is ... string = "echo $stuff"
<becom33> yes thats one of the simples string , since the string is dynamic it could be like this also "echo <h1>$stuff</h1> $more"
regedarek has joined #ruby
<aedorn> v = tmp.find { |m| line =~ /echo.*#{Regexp.escape(m)}/ }
<shevy> wow
<shevy> aedorn was able to understand it :)
<becom33> aedorn, let me try that
<becom33> yes that works like a baby
<aedorn> shevy: keyword searching ;)
phelps has joined #ruby
staafl has quit [Ping timeout: 252 seconds]
huangjs has joined #ruby
radic has quit [Disconnected by services]
radic_ has joined #ruby
swarles has quit [Ping timeout: 244 seconds]
twoism has quit [Remote host closed the connection]
becom33 has quit [Ping timeout: 246 seconds]
twoism has joined #ruby
kokainepizza has quit [Quit: My pooter is sleep.]
<aedorn> I feel like porting Ruby to OS/2.
<aedorn> (except someone already did that so nevermind)
sgxrtm has joined #ruby
twoism has quit [Ping timeout: 252 seconds]
becom33 has joined #ruby
fire has quit [Read error: Operation timed out]
RoUS has quit [Ping timeout: 260 seconds]
Guest5080 has quit [Ping timeout: 255 seconds]
<shevy> aedorn cool
joofsh has quit [Remote host closed the connection]
sgxrtm has quit [Quit: ChatZilla 0.9.89 [Iceweasel 10.0.4/20120426170919]]
felipe_Brz has quit [Remote host closed the connection]
BoomCow has joined #ruby
sailias has quit [Quit: Leaving.]
voodoofish430 has quit [Quit: Leaving.]
sailias has joined #ruby
sailias has quit [Client Quit]
sailias has joined #ruby
yacks has joined #ruby
Fezzler has joined #ruby
wiiw has joined #ruby
<wiiw> http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-c-new .. How to find that each options mean ?
staafl has joined #ruby
fire has joined #ruby
<aedorn> wiiw: scroll up some .. it's under the header of Options.
Fezzler has quit [Client Quit]
eroc has quit [Quit: eroc]
<wiiw> aedorn: find it , thank you
cyong has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
Blue_Ice has quit [Ping timeout: 246 seconds]
ananthakumaran has quit [Ping timeout: 255 seconds]
staafl has quit [Ping timeout: 260 seconds]
ananthakumaran has joined #ruby
pen has joined #ruby
kiyoura has quit [Ping timeout: 252 seconds]
crackfu has joined #ruby
atno has quit [Quit: Leaving]
BoomCow has quit [Quit: This computer has gone to sleep]
nicholas has joined #ruby
nicholas is now known as nicholas__
g_bleezy has joined #ruby
RoUS has joined #ruby
RoUS has quit [Changing host]
RoUS has joined #ruby
Guest5080 has joined #ruby
<nicholas__> i'm a clang developer trying to figure out why ruby doesn't build (using ruby from svn). could anyone help debug? miniruby fails like so:
<nicholas__> /home/nicholas/ruby/lib/optparse.rb:1280:in `define': undefined method `append' for nil:NilClass (NoMethodError)
sayan has joined #ruby
Noldorin has quit [Quit: Computer has gone to sleep.]
havenn has quit [Ping timeout: 265 seconds]
ananthakumaran has quit [Quit: Leaving.]
becom33 has quit [Ping timeout: 255 seconds]
<RubyPanther> nicholas__: check the configure output for a missing dependency
tjbiddle has joined #ruby
wiiw has left #ruby [#ruby]
moshee has quit [Remote host closed the connection]
elico has joined #ruby
<nicholas__> there are various things it is "checking for ..." but doesn't find, and it's not clear that any of those are dependencies
<nicholas__> is there something particular i should notice?
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
havenn has joined #ruby
toekutr has quit [Remote host closed the connection]
becom33 has joined #ruby
<nicholas__> yeah, this config output looks fine to me. let me know if you want me to pastebin something (config.log/status?)
jgrevich_ has joined #ruby
BoomCow has joined #ruby
Hanmac1 is now known as Hanmac
toekutr has joined #ruby
jgrevich has quit [Ping timeout: 265 seconds]
jgrevich_ is now known as jgrevich
slainer68 has joined #ruby
stevechiagozie has quit [Ping timeout: 246 seconds]
Astral_ has quit [Read error: Connection reset by peer]
Astral_ has joined #ruby
sayan has quit [Read error: Connection reset by peer]
slainer68 has quit [Read error: Operation timed out]
pablo_ has quit [Read error: Connection reset by peer]
Astral__ has joined #ruby
frem has quit [Quit: Computer has gone to sleep.]
kil0byte has quit [Read error: Connection reset by peer]
kil0byte has joined #ruby
ananthakumaran has joined #ruby
Astral_ has quit [Ping timeout: 240 seconds]
nomenkun has joined #ruby
becom33 has quit [Ping timeout: 264 seconds]
becom33 has joined #ruby
wf2f has quit []
<aedorn> hmmm gitlab vs github ... opinions?
nomenkun has quit [Ping timeout: 260 seconds]
xbayrockx has joined #ruby
xbayrockx is now known as wf2f
mercwithamouth has joined #ruby
jrunning has joined #ruby
sayan has joined #ruby
xpen has quit [Ping timeout: 265 seconds]
IrishGringo has joined #ruby
Takehiro has joined #ruby
bigmcq77 has quit [Quit: Computer has gone to sleep.]
ninegrid_ has quit [Ping timeout: 265 seconds]
cyong has quit [Quit: Leaving.]
RoUS has quit [Read error: Operation timed out]
Guest5080 has quit [Ping timeout: 246 seconds]
pcarrier has quit [Ping timeout: 260 seconds]
crackfu has quit [Quit: Leaving...]
mengu has quit [Quit: This computer has gone to sleep]
pcarrier has joined #ruby
bigmcq77 has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
richardr has joined #ruby
<richardr> Hi there
<richardr> I have two JSON files. They do not follow the same structure. Both feature multiple levels of nesting. One occasionally repeats a key (at various levels) called "src". What I'd like to do, is simply recursively search for all the keys "src" within my JSON file, in Ruby, and have the opportunity, once I know the value of this key, to manipulate / replace that value with something else.
nick_h has quit [Ping timeout: 260 seconds]
rakl has joined #ruby
<richardr> Any help would be greatly appreciated, I'm thinking I need to do something with map
<richardr> I'm just unsure on how to keep the iteration going, while getting back values that I can manipulate directly (the original object) based on the value itself
nick_h has joined #ruby
yacks has quit [Ping timeout: 252 seconds]
Bry8Star has quit [Read error: Connection reset by peer]
kil0byte_ has joined #ruby
<aedorn> there's nothing to do that by default ... the two options you can do are a recursive find/replace, or something a bit more meta
<richardr> Here's a pastie with an example: http://pastie.org/private/5cwyvuhlf7oqzz0el3xiq Essentially, want to replace "src": "file.jpg" with "src": "http://domain.com/file.jpg"
<richardr> A little tricky though, any pointers on some find / replace magic that could help me out highly appreciated
<richardr> The actual file replacement I sort of have a handle on, but the actual recursion and place to make that replacement I'm a little lost on at the moment
kil0byte has quit [Ping timeout: 255 seconds]
dmerrick has joined #ruby
<richardr> I imagine this is bad practice, but the only idea I have so far is do a regular expression find / replace. But I think some form of deep search is a much better approach, if somebody has the logic
Bry8Star has joined #ruby
becom33 has quit [Ping timeout: 260 seconds]
sorbo_ has quit [Quit: sorbo_]
<aedorn> how are you reading the JSON files in?
<richardr> aedorn: They come in as JSON strings, I can use JSON.parse, or use them as strings ... whatever makes it easier to parse
<richardr> aedorn: but at the time of parsing, I have both JSON files available
pcarrier has quit []
<Hanmac> richardr: so they are eigher in src or meta/src? (or other locations too?)
<richardr> Hanmac: "src" could potentially appear anywhere in the structure, but always keyed "src", does that make it very difficult?
iamjarvo has quit [Quit: Leaving.]
kumarat9pm has joined #ruby
<richardr> Hanmac: for the first JSON file, while nested, it is consistent
<Hanmac> for the first i have this: h.each_value {|v| (v[0]["src"] || v[0]["meta"]["src"])[0,0]="http://domain.com/"}
<Hanmac> (i dont mean for the first json)
huoxito has joined #ruby
kumarat9pm has left #ruby [#ruby]
<richardr> Hanmac: thanks, really appreciate this help .. I will start working with this (but unfortunately "src" could appear in a parent key named "meta", or "randomkey" I wouldn't know
<richardr> potentially
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
mercwithamouth has quit [Ping timeout: 244 seconds]
<Hanmac> try this:
<Hanmac> def find_key(h,k);h.nil? ? nil : (h[k] || find_key(h.each_value.find{|v| v.is_a?(Hash) },k));end
<Hanmac> h.each_value {|v| find_key(v[0],"src")[0,0]="http://domain.com/"}
<aedorn> yeah.... string, gsub replace, then parse seems like your best choice for that since you're looking at multiple data types. Okay, maybe not the best way, but certainly the quickest
mercwithamouth has joined #ruby
huangjs has quit [Quit: Leaving]
<aedorn> or do what Hanmac has..
<richardr> Hanmac: this was my original thought process , but no idea on implementation: http://pastie.org/private/t9lrllii3hldlezvb2gicg
<richardr> aedorn,Hanmac: thanks! will try this out now
xpen has joined #ruby
Slivka has joined #ruby
h4mz1d has joined #ruby
<Hanmac> currnetly the second line only adds stuppidly domain before the filename ...
<richardr> Hanmac: It's still a huge help to me, thanks so much ... playing around with it now
<Hanmac> PS: the hash and the string values in the hash are changed ... so if you need an unchanged hash you should make a copy
Skelz0r has quit [Read error: Operation timed out]
<richardr> Hanmac: I noticed it only adds the domain onto the first object in each iteration, would it be possible to run through all the objects
<richardr> I think it's the v[0]\
<richardr> restricting to first object
dmerrick has quit [Quit: dmerrick]
<Hanmac> h.each_value {|r|r.each{|v|find_key(v,"src")[0,0]="http://domain.com/"}}
<richardr> I'll update my paste
<richardr> Wow, thanks
Skelz0r has joined #ruby
<aedorn> richardr: his method will recurse on any enumerable with each_value, so passing the hash will also work
rippa has joined #ruby
wallerdev_ has joined #ruby
wallerdev has quit [Read error: Connection reset by peer]
wallerdev_ is now known as wallerdev
tjbiddle has quit [Quit: tjbiddle]
<aedorn> actually, wait.. no.. hash has its own each_value... soooo right. Ignore me. I should just watch TV in silence
<richardr> aedorn: I appreciate the thought on this though, thanks heaps!
cj3kim has quit [Quit: This computer has gone to sleep]
<aedorn> You'll just have to watch out if you have more nested levels using that .. so array->hash->array->hash->array->hash probably is not going to work. Hopefully none of your data structures will go that far anyway
fire is now known as megharsh
s4muel_ has quit [Remote host closed the connection]
<richardr> aedorn: I don't imagine it'll be nested more than 3 times, it was just that the keys are not necessarily consistent - or known to me that contain "src"
s4muel has joined #ruby
scruple has quit [Quit: Leaving]
<richardr> @meta = JSON.parse(@meta).each_value {|r|r.each{|v| find_key(v, "src").replace("http://domain.com")}} <- Because I need to utilise that value, loop through 1.json, find the appropriate domain before replacing (quite a bit of logic here) if I assign src = find_key() can I manipulate that and it still manipulates the original object in memory, or is it just a copy?
<richardr> Sorry if that doesn't make sense
tjbiddle has joined #ruby
zg has joined #ruby
tjbiddle has quit [Client Quit]
zg has left #ruby [#ruby]
elico has quit [Ping timeout: 246 seconds]
starburst has joined #ruby
h4mz1d has quit [Ping timeout: 252 seconds]
zeade has quit [Quit: Leaving.]
daniel_hinojosa has quit [Ping timeout: 260 seconds]
sayan has quit [Remote host closed the connection]
<JohnTeddy> What is a reputable/good ruby project to work on?
rippa has quit [Ping timeout: 240 seconds]
tintin has joined #ruby
tintin has left #ruby [#ruby]
cj3kim has joined #ruby
Spaceghostc2c has quit [Excess Flood]
<RubyPanther> JohnTeddy: one you start and give a good name
friskd has joined #ruby
<RubyPanther> if somebody works on a project, it is because they needed it, or needed features/bug fixes and did a fork/fix/pull request
<RubyPanther> There is actually a long line of people waiting for an interesting but incomplete project to wander along
Spaceghostc2c has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
<Hanmac> i also works on my projects for fun
adeponte has quit [Remote host closed the connection]
<havenn> JohnTeddy: Looking for a larger or smaller project?
zeade has joined #ruby
solidresolve has quit [Remote host closed the connection]
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
solidresolve has joined #ruby
rippa has joined #ruby
havenn has quit [Remote host closed the connection]
<Hanmac> my projects are good, but i dont know if they are reputable :D
Asher2 has quit [Quit: Leaving.]
<neurotech> I'm trying to get my head around nokogiri. I'm trying to scrape some basic content and just want the text, not the actual markup. https://gist.github.com/4386057
emmanuelux has quit [Quit: emmanuelux]
<neurotech> How can I make my erb render the scraped content as just text, not text+markup? (here's my erb currently https://gist.github.com/4386059 )
Catnaroek has quit [Quit: brb peepls n poopls!!1]
<neurotech> Trying to run that gives me "undefined local variable or method `name'"
Catnaroek has joined #ruby
<BoomCow> name isnd't defined
IrishGringo has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
<neurotech> Shouldn't it be able to see it in https://gist.github.com/4386057
kmurph has quit [Quit: kmurph]
<BoomCow> try making it an instance variable
<BoomCow> @name
Catnaroek has quit [Client Quit]
ebouchut has joined #ruby
jrunning has quit [Quit: leaving]
ebouchut has quit [Client Quit]
<BoomCow> did that work neurotech
<neurotech> It's working, but it's still bringing in the markup
samuel02 has joined #ruby
dhruvasagar has joined #ruby
<neurotech> hmm
gluxon has joined #ruby
<BoomCow> not sure what you mean
<richardr> Hanmac: Is there a more efficient / correct way to achieve this? http://pastie.org/private/vatyaoqlmmovcyixladq second part is parsing 1.json to get the real file names for replacement
<BoomCow> you should only be scraping the text
cableray has quit [Quit: cableray]
<BoomCow> neurotech, in irb, name = => "Earthshaker"
<richardr> Hanmac: for the last value in replace_key, it's strange if I do k.replace("domain.com") replaces it, if I pass in "src" which .debug is reporting correctly in my terminal it replaces it with an empty string ...
<BoomCow> abilities = "FissureEnchant TotemAftershockEcho Slam"
<BoomCow> so those strings are geing assigned to the variables
cableray has joined #ruby
richardr has quit [Remote host closed the connection]
richardr has joined #ruby
<BoomCow> the markup is probably from your h1 and h2 tags
Slivka has quit [Remote host closed the connection]
haxrbyte has joined #ruby
mafolz has joined #ruby
<neurotech> hmm
<neurotech> i'll try some more things
solidresolve has quit [Remote host closed the connection]
solidresolve has joined #ruby
taoru has quit [Remote host closed the connection]
robustus has quit [Ping timeout: 276 seconds]
gluxon has left #ruby [#ruby]
Guest25886 has joined #ruby
akemrir has joined #ruby
robustus has joined #ruby
seich has quit [Ping timeout: 250 seconds]
<richardr> Hanmac: I have to go, but cheers for all the help
<aces23up> why can't i do this?
<aces23up> @submit_data.split('&').map{ |param_str|
<aces23up> split_param = param_str.split('=')
<aces23up> }.flatten
<aces23up> split_param.length == 1 ? [ split_param[0], "" ] ? split_param
haxrbyte_ has joined #ruby
<aces23up> nevermind.
jonahR has quit [Quit: jonahR]
richardr has quit [Remote host closed the connection]
TomRone has quit [Ping timeout: 255 seconds]
seich- has joined #ruby
haxrbyte has quit [Ping timeout: 256 seconds]
Slivka has joined #ruby
TomRone has joined #ruby
The_8472 has joined #ruby
pcarrier has joined #ruby
IceDragon has quit [Quit: Space~~~]
The_8473 has quit [Ping timeout: 255 seconds]
Catnaroek has joined #ruby
TomRone has quit [Ping timeout: 250 seconds]
TomRone has joined #ruby
hakunin has quit [Remote host closed the connection]
haxrbyte_ has quit [Remote host closed the connection]
dyrot has quit [Ping timeout: 245 seconds]
vlad_starkov has joined #ruby
havenn has joined #ruby
richardr has joined #ruby
rippa has quit [Ping timeout: 240 seconds]
becom33 has joined #ruby
Catnaroek has quit [Quit: leaving]
mockra_ has quit [Remote host closed the connection]
Jasko has quit [Read error: Connection reset by peer]
eldariof has joined #ruby
Jasko has joined #ruby
BoomCow has quit [Quit: This computer has gone to sleep]
haxrbyte has joined #ruby
friskd has quit [Quit: friskd]
maesbn has joined #ruby
zeade has quit [Quit: Leaving.]
phelps has quit [Ping timeout: 246 seconds]
kmurph has joined #ruby
phelps has joined #ruby
havenn_ has joined #ruby
Morkel has joined #ruby
havenn has quit [Ping timeout: 244 seconds]
taoru has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
<xybre> Does Ruby stack trapped signals?
<xybre> Signal.trap 'SIGWINCH', lambda{ something }
mahmoudi_ has quit [Quit: Computer has gone to sleep.]
nicholas__ has left #ruby ["Leaving"]
<xybre> If duing the process of "something", like a loop or sleep, will it return the first instance?
huoxito has quit [Quit: Leaving]
<heftig> xybre: they get run in parallel, apparently
<xybre> That sounds like a terrible idea O_o
<heftig> ah, no
<heftig> something else is going on
<heftig> xybre: not in parallel, but the handler is interrupted and run again for the new signal
<heftig> once that signal is handled, it returns to handle the older signal
eph3meral has quit [Quit: eph3meral]
phelps has quit [Ping timeout: 250 seconds]
koshii has joined #ruby
<xybre> It seems like it just kills the old handler and starts a new one, if its the same signal.
<heftig> xybre: no, not kills
<heftig> just interrupts until the new signal is handled
<heftig> try something like lambda { |x| sleep 2; puts x }
mrdtt has quit [Quit: mrdtt]
<xybre> It also looks like it happens somewhat asynchronously
dsdeiz has joined #ruby
imami|afk has quit [Ping timeout: 255 seconds]
phelps has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
richardr has quit [Remote host closed the connection]
banseljaj has joined #ruby
filipe has joined #ruby
kil0byte_ has quit [Read error: Connection reset by peer]
kil0byte has joined #ruby
mockra has joined #ruby
moshee has quit [Ping timeout: 260 seconds]
katze_t4 has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
toekutr has quit [Remote host closed the connection]
kil0byte_ has joined #ruby
kil0byte has quit [Read error: Connection reset by peer]
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
blaxter has joined #ruby
phelps has quit [Ping timeout: 244 seconds]
Bry8Star_ has joined #ruby
zeade has joined #ruby
Bry8Star has quit [Ping timeout: 276 seconds]
mockra has quit [Ping timeout: 246 seconds]
phelps has joined #ruby
Bry8Star_ is now known as Bry8Star
kumarat9pm has joined #ruby
wargasm has quit [Ping timeout: 256 seconds]
kumarat9pm has quit [Client Quit]
phelps has quit [Ping timeout: 250 seconds]
haxrbyte_ has joined #ruby
<xybre> Okay I think I got it, the idea is to only run the meat of the interupt once, when everything has calmed down.
jimeh has joined #ruby
phelps has joined #ruby
haxrbyte has quit [Ping timeout: 260 seconds]
emocakes has joined #ruby
zeade has quit [Ping timeout: 245 seconds]
xaq has joined #ruby
Nisstyre-laptop has joined #ruby
phelps has quit [Ping timeout: 252 seconds]
Morkel has quit [Quit: Morkel]
dsdeiz has quit [Ping timeout: 260 seconds]
<xybre> Looks like the big thing is putting the handler to sleep.
<xybre> Removing their pause makes the whole thing explode, but even a small sleep will keep it going.
phelps has joined #ruby
ryanf has quit [Ping timeout: 244 seconds]
phelps has quit [Ping timeout: 255 seconds]
LouisGB has joined #ruby
Chryson has joined #ruby
sn0wb1rd has quit [Read error: Connection reset by peer]
Bry8Star_ has joined #ruby
sn0wb1rd has joined #ruby
phelps has joined #ruby
Bry8Star has quit [Ping timeout: 276 seconds]
Bry8Star_ is now known as Bry8Star
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
pen has quit [Read error: Connection reset by peer]
francisfish has joined #ruby
pen has joined #ruby
lolmaus has joined #ruby
phelps has quit [Ping timeout: 252 seconds]
Nisstyre-laptop has quit [Quit: Leaving]
Bry8Star_ has joined #ruby
Bry8Star has quit [Ping timeout: 276 seconds]
Bry8Star_ is now known as Bry8Star
phelps has joined #ruby
fivetwentysix has joined #ruby
<fivetwentysix> Is it better to fork / thead when wanting to make x amount of simultaneous API calls
yshh has quit [Read error: Connection reset by peer]
cableray has quit [Quit: cableray]
mercwithamouth has quit [Ping timeout: 246 seconds]
yshh_ has joined #ruby
xaq has quit [Remote host closed the connection]
zeade has joined #ruby
cousine has joined #ruby
Bry8Star_ has joined #ruby
richardr has joined #ruby
ryanf has joined #ruby
Spaceghostc2c has quit [Excess Flood]
pen has quit [Remote host closed the connection]
phelps has quit [Ping timeout: 252 seconds]
<richardr> I have a JSON string (or can easily use JSON.parse to get a hash), how would I add nested values that don't already exist in the structure? I receive errors along the lines of: undefined method `[]' for nil:NilClass
Xeago has joined #ruby
Bry8Star has quit [Ping timeout: 276 seconds]
becom33 has quit [Quit: Leaving]
cousine has quit [Remote host closed the connection]
codebiff has joined #ruby
codebiff has quit [Client Quit]
Spaceghostc2c has joined #ruby
phelps has joined #ruby
becom33_ has joined #ruby
ryanf has quit [Ping timeout: 265 seconds]
tyman has joined #ruby
<becom33_> how can I get the selected folder and sub folder file to be listed in a array . for a example .php .html .tpl files inside the folders need to be listed in the array
eka has joined #ruby
zeade has quit [Ping timeout: 260 seconds]
jgrevich has quit [Remote host closed the connection]
zeade has joined #ruby
zeade has quit [Client Quit]
marr has joined #ruby
richardr has quit [Remote host closed the connection]
<havenn_> becom33_: Dir['*.{php, html, tpl}']
<havenn_> fivetwentysix: Depends, I guess. You are deciding between forking and threading for making a remote API call?
<fivetwentysix> havenn_: yep
banisterfiend has joined #ruby
mockra has joined #ruby
<heftig> i'd say threads, they have less weight
<fivetwentysix> can I use active record with postgres in threads?
<heftig> yes
<banisterfiend> heftig: i read that on linux context switching b/w processes and between threads takes more or less the same time
phelps has quit [Ping timeout: 250 seconds]
<heftig> banisterfiend: forking is still costlier, though
nomenkun has joined #ruby
pskosinski has joined #ruby
<heftig> and context switches between threads of the same app don't cause a TLB flush, I believe
<heftig> s/app/process/
chussenot has joined #ruby
<pskosinski> Hello. Can I open file with path like: foo/bar.txt in Windows? Will it work? Or I need to change / to \ ? ^^
oposomme has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
nkts has joined #ruby
phelps has joined #ruby
<heftig> pskosinski: File::SEPARATOR
Jasko has joined #ruby
<heftig> also, File.join
mockra has quit [Ping timeout: 244 seconds]
wallerdev has quit [Quit: wallerdev]
<heftig> Paradox: better than salad sauce
<pskosinski> Ah… no docs. :< But I guess that it is / or \ depending on platform. Ok, thanks. :)
<heftig> pskosinski: windows also accepts slashes
<Paradox> life is like a jar of mayonnaise
<heftig> you don't have to use backslashes
<pskosinski> And when joining this channel I am getting in info not working link… http://www.modruby.net
<Paradox> if you let it sit outside in the sun too long it goes bad
<pskosinski> heftig: Well, I just read: Sort of. The base Win32 API does accept \ or /. However, the Unicode
<pskosinski> Win32API -- which will be used in the future -- does not accept /.
<pskosinski> Ruby, however, should continue to support both.
<heftig> ew.
<pskosinski> Sorry… I tought that will be in one line…
<becom33_> http://pastie.org/5583464 I want to go trough the selected dir and all the sub dirs it has . but in here it only looks in the selected dir
tvw has joined #ruby
phelps has quit [Ping timeout: 255 seconds]
<havenn_> becom33_: Try ** for recursive search: Dir[File.join('**', '*.{rb, html, tpl}')]
nkts has quit [Quit: Leaving]
<pskosinski> Hm… ok, I get it, thanks.
cableray has joined #ruby
phelps has joined #ruby
chriskk has quit [Quit: chriskk]
<JohnTeddy> @d.add('fish' => 'aquatic animal')
<JohnTeddy> How can I make a method add that can accept those options?
nick_h has quit [Ping timeout: 252 seconds]
arturaz has joined #ruby
<pskosinski> def add argv = {}; ...; end; add 'fish' => 'aquantic animal'
nick_h has joined #ruby
<pskosinski> It should be in argv['fish']
<pskosinski> iirc…
moshee has quit [Ping timeout: 255 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
slainer68 has joined #ruby
<JohnTeddy> I am trying to pass this rspec exercise.
_whitelogger has joined #ruby
<Hanmac> /regexliteral with group capture/ =~ string
Morkel has joined #ruby
<Hanmac> /(?<number>\d+)/ =~ "4a"; p number#=> "4"
xandy is now known as xAndy
jessta has quit [Ping timeout: 246 seconds]
Shrink has joined #ruby
<banisterfiend> Hanmac: ah ok
jessta has joined #ruby
<Hanmac> its only works with regex literals, it does not work with regex variables
<banisterfiend> Hanmac: do u sometimes wish u were a regex literal
ryanf has joined #ruby
matrixise has quit [Ping timeout: 244 seconds]
mockra has joined #ruby
mjolk has joined #ruby
mjolk is now known as Guest55957
nomenkun_ has joined #ruby
matrixise has joined #ruby
ryanf has quit [Ping timeout: 260 seconds]
Guest55957 has quit [Read error: Connection reset by peer]
nomenkun has quit [Ping timeout: 255 seconds]
baphled has joined #ruby
mockra has quit [Ping timeout: 260 seconds]
mjolk2 has joined #ruby
timonv has quit [Ping timeout: 264 seconds]
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
arturaz has joined #ruby
arturaz has quit [Read error: Connection reset by peer]
arturaz has joined #ruby
banisterfiend has quit [Ping timeout: 256 seconds]
becom33_ has quit [Ping timeout: 260 seconds]
<pskosinski> What can be problem when exit function is not killing script?
elaptics`away is now known as elaptics
maesbn has quit []
<mjolk2> what do you mean pskosinski ?
lushious has quit [Ping timeout: 252 seconds]
<mjolk2> such as when the OS kills the process and not the ruby script itself?
<pskosinski> I have a class, a method and in that method: exit. And when I executed method script is not finishing working.
oposomme has joined #ruby
lushious has joined #ruby
apeiros_ has joined #ruby
<mjolk2> why are you using a method to simply exit?
havenn_ has quit [Ping timeout: 260 seconds]
<mjolk2> brb
<pskosinski> Well… not only exit, also clean. ^^
<pskosinski> But on the end is exit.
yshh_ has quit [Read error: Connection reset by peer]
yshh has joined #ruby
pen has joined #ruby
mengu has joined #ruby
vlad_starkov has joined #ruby
yshh has quit [Remote host closed the connection]
<mjolk2> So you have basically an exit dispatcher?
<mjolk2> Why use that as a submethod?
<mjolk2> Instead of just expose and parameterize it for general use within the class?
banisterfiend has joined #ruby
<pskosinski> "Instead of just expose and parameterize it for general use within the class?" Whaaat…?
phelps has quit [Ping timeout: 255 seconds]
<pskosinski> Anyway I modified script so it is just going to the end and finishing. But still curious why exit was not working. :< I see that I can't exit when I have opened a connection.
<pskosinski> Seems logical.
thufir_ has joined #ruby
<mjolk2> Use a pastebin or something
<mjolk2> The way that you're doing your exit sounds a bit crazy
<mjolk2> Because the callee is trying to close the caller
kmurph has quit [Quit: kmurph]
Morkel has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Remote host closed the connection]
phelps has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
thufir_ has quit [Remote host closed the connection]
Jasko has joined #ruby
iPhoneMRZ has joined #ruby
iPhoneMRZ has quit [Client Quit]
<pskosinski> mjolk2: Well… why crazy. Now I have something like: http://wklej.org/id/907112/
Morkel has joined #ruby
bluOxigen has joined #ruby
<pskosinski> Before I was trying to add "exit" on the end of disconnect and execute disconnect from do_something.
Morkel has quit [Read error: Connection reset by peer]
Morkel_ has joined #ruby
<pskosinski> But instead of @handler.shutdown I had @handler.close and it wasn't closing connection :( Looks like I was using outdated tutorial
slainer68 has quit [Remote host closed the connection]
<pskosinski> What is crazy? :p
<mjolk2> this isn't how you were describing it, but that's fine anyway
<pskosinski> Well… sorry then.
<mjolk2> No need to be sorry
pen has quit [Remote host closed the connection]
Takehiro has quit [Remote host closed the connection]
codebiff has joined #ruby
EhyehAsherEhyeh has joined #ruby
codebiff has quit [Client Quit]
phelps has quit [Ping timeout: 255 seconds]
berserkr has joined #ruby
pasties has quit [Ping timeout: 260 seconds]
phelps has joined #ruby
lenovodroid has joined #ruby
s1n4 has joined #ruby
Morkel_ has quit [Quit: Morkel_]
Morkel has joined #ruby
mockra has joined #ruby
EhyehAsherEhyeh has quit [Ping timeout: 256 seconds]
phelps has quit [Ping timeout: 252 seconds]
Shoobdidoo has joined #ruby
phelps has joined #ruby
Shoobdidoo has quit [Client Quit]
Jasko has quit [Read error: Connection reset by peer]
m_m has joined #ruby
mockra has quit [Ping timeout: 265 seconds]
Jasko has joined #ruby
lenovodroid has quit [Ping timeout: 265 seconds]
<m_m> Hi . How i can get answers from my regex as an array for example i need street name and house number i have regex but i have Street and umber as a one string.
nicoulaj has joined #ruby
Catnaroek has quit [Quit: brb]
oposomme has quit [Quit: Leaving...]
Apocalypse has quit [Read error: Connection reset by peer]
pasties has joined #ruby
<apeiros_> m_m: use capturing groups
<apeiros_> that's sequences with () around them. see MatchData#captures
visof has joined #ruby
<visof> Hello everyone
phelps has quit [Ping timeout: 250 seconds]
<mjolk2> m_m assign the response of your regex match to a variable?
<visof> I tried to define method that work for list of integers that,s called sum I do class Array; def self.sum;self.inject(:+);end;end
<visof> But I got sum isn't defined for array
<mjolk2> as for street name/number in the same string, good luck with addresses like "44 West 33rd Street, apt||#||suite 431"
<visof> What have I done wrong in this?
oposomme has joined #ruby
lenovodroid has joined #ruby
<visof> Can anyone help please
BBonifield has quit [Ping timeout: 252 seconds]
chussenot has quit [Quit: chussenot]
phelps has joined #ruby
<m_m> No i have only a few kind of addresses. my regex for one of them : /([a-z]|[A-Z])+\s([0-9])+([a-z]|[A-Z])*\s*\/\s*[0-9]$/ and example : Sudecka 103b/1
nick_h has quit [Ping timeout: 260 seconds]
BBonifield has joined #ruby
nick_h has joined #ruby
<mjolk2> oh god
dhruvasagar has quit [Ping timeout: 246 seconds]
fivetwentysix has quit [Ping timeout: 256 seconds]
<mjolk2> where to start
<apeiros_> visof: you defined it as a class method
<apeiros_> instead of an instance method
Banistergalaxy has quit [Ping timeout: 252 seconds]
hoelzro|away is now known as hoelzro
Banistergalaxy has joined #ruby
<apeiros_> m_m: ([a-z]|[A-Z])+ --> [a-zA-Z]+
insulator has joined #ruby
<mjolk2> also, what's with all the * \s ?
phelps has quit [Ping timeout: 265 seconds]
<apeiros_> and ()+ will not work nicely. it captures only the last match
wermel has joined #ruby
<apeiros_> you usually want (…+)
<visof> apeiros_ I want it to apply for all integer lists how can I do this
nick_h has quit [Ping timeout: 265 seconds]
<apeiros_> visof: don't know what you mean by that
<apeiros_> but the first step would certainly be to define it as an instance method, not a class method
<m_m> I see now. It captures only the last letter from my street name.
nick_h has joined #ruby
<visof> Ok
<m_m> So how i can get a full street name ?
<m_m> Oh. {1,} work fine.
phelps has joined #ruby
krz has quit [Quit: krz]
<whitequark> m_m: {1,} is equivalent to +
_64k has joined #ruby
_64k has quit [Client Quit]
sepp2k has joined #ruby
phelps has quit [Ping timeout: 255 seconds]
_64k has joined #ruby
phelps has joined #ruby
Alenah has joined #ruby
s1n4 has quit [Ping timeout: 244 seconds]
_64k has quit [Read error: Connection reset by peer]
_64k_ has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
katze_t4 has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
s1n4 has joined #ruby
visof has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
phelps has quit [Ping timeout: 252 seconds]
megharsh has quit [Quit: WeeChat 0.3.9.2]
slainer68 has joined #ruby
nomenkun has joined #ruby
cascalheira has joined #ruby
nomenkun_ has quit [Ping timeout: 256 seconds]
fire has joined #ruby
byterussian has joined #ruby
slainer68 has quit [Read error: Operation timed out]
phelps has joined #ruby
malte_ has joined #ruby
stevechiagozie has joined #ruby
Kuifje has joined #ruby
Kuifje has quit [Changing host]
Kuifje has joined #ruby
vlad_starkov has joined #ruby
lkba has quit [Ping timeout: 264 seconds]
neiled has quit [Quit: Computer has gone to sleep.]
RoUS has joined #ruby
RoUS has joined #ruby
RoUS has quit [Changing host]
vlad_starkov has quit [Ping timeout: 250 seconds]
phelps has quit [Ping timeout: 250 seconds]
stevechiagozie has quit [Ping timeout: 246 seconds]
phelps has joined #ruby
sayan has quit [Remote host closed the connection]
nilg has quit [Ping timeout: 245 seconds]
Xeago has quit [Remote host closed the connection]
phelps has quit [Ping timeout: 255 seconds]
mockra has joined #ruby
byterussian has left #ruby [#ruby]
lenovodroid has quit [Ping timeout: 256 seconds]
mockra has quit [Ping timeout: 245 seconds]
phelps has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
Guest5080 has joined #ruby
Jasko has joined #ruby
mengu has quit [Ping timeout: 255 seconds]
slainer68 has joined #ruby
vlad_starkov has joined #ruby
hotovson has joined #ruby
sayan has joined #ruby
becom33 has joined #ruby
Goles has quit [Quit: Computer has gone to sleep.]
<becom33> Im using a output module to style the output . I use the module in some instance classes . but I cant use it in instance class says undefined method
<emocakes> have you defined it becom?
<becom33> instance classes no
fyolnish has quit [Remote host closed the connection]
<becom33> I use them as Class.method(para)
<becom33> emocakes,
nomenkun has quit [Remote host closed the connection]
EhyehAsherEhyeh has joined #ruby
nomenkun has joined #ruby
stevechiagozie has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
EhyehAsherEhyeh has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby
phelps has quit [Ping timeout: 252 seconds]
EhyehAsherEhyeh has joined #ruby
hoelzro is now known as hoelzro|away
lkba has joined #ruby
akemrir has quit [Quit: WeeChat 0.3.9.2]
Guest5080 has quit [Ping timeout: 245 seconds]
<becom33> umm anyone ?
RoUS has quit [Ping timeout: 255 seconds]
sayan has quit [Remote host closed the connection]
kil0byte_ has quit [Ping timeout: 252 seconds]
Virunga has quit [Remote host closed the connection]
phelps has joined #ruby
stevechiagozie has quit [Ping timeout: 255 seconds]
nilg has joined #ruby
Catnaroek has joined #ruby
<becom33> http://pastie.org/5583992 cant use module method inside the instance method
* becom33 anyoen
<becom33> shevy, bro you here ?
phelps has quit [Ping timeout: 250 seconds]
kil0byte has joined #ruby
<Hanmac> becom33 look at extend
fire has quit [Quit: WeeChat 0.3.9.2]
samphippen has joined #ruby
<pskosinski> In case of using TCPSocket, if I will lose internet connection, TCPSocket is not "closing itself". Can I somehow check if connection is established?
phelps has joined #ruby
haxrbyte has joined #ruby
EhyehAsherEhyeh has quit [Ping timeout: 264 seconds]
haxrbyte_ has quit [Read error: Connection reset by peer]
<becom33> got it Hanmac thanks :D
Vert has quit [Ping timeout: 252 seconds]
knirhs has joined #ruby
kil0byte has quit [Ping timeout: 255 seconds]
banisterfiend has quit [Remote host closed the connection]
caemir has left #ruby ["Je pars..."]
Shrink has quit [Ping timeout: 245 seconds]
vlad_starkov has quit [Read error: Connection reset by peer]
stevechiagozie has joined #ruby
zmbmartin has joined #ruby
<zmbmartin> How do I parse a datetime with format of MM/dd/yyyy HH:mm (24 hour notation)?
<zmbmartin> If I try DateTime.parse("MM/dd/yyyy HH:mm") I get an invalid date error
<Hanmac> zmbmartin: look at strptime
ffranz has joined #ruby
hotovson has quit [Remote host closed the connection]
nfk has joined #ruby
mpfundstein has quit [Ping timeout: 260 seconds]
stevechiagozie has quit [Ping timeout: 246 seconds]
kil0byte has joined #ruby
<zmbmartin> Hanmac: Thanks
kil0byte_ has joined #ruby
phelps has quit [Ping timeout: 252 seconds]
emergion has quit [Quit: Computer has gone to sleep.]
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
kil0byte has quit [Ping timeout: 255 seconds]
kil0byte_ has quit [Ping timeout: 250 seconds]
adkron has joined #ruby
phelps has joined #ruby
kil0byte has joined #ruby
kirun has joined #ruby
dreinull has joined #ruby
insulator has quit [Remote host closed the connection]
<dreinull> what's the method again that uses a preformatted string and replces parts of it (useful for aligning stuff for ascii output)?
cakehero has joined #ruby
Virunga has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
vlad_starkov has joined #ruby
x0F_ is now known as x0F
<Hanmac> dreinull look at []= .... s="abc";s[1]="d" ; s#=> "adc"
<Hanmac> or look at sub/gsub
<dreinull> Hanmac: seems like I'm looking for printf
Siphonblast has quit [Quit: quit()]
<dreinull> I always try to find it under String...
Siphonblast has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
Banistergalaxy has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby
kil0byte has quit [Ping timeout: 265 seconds]
jonteru has joined #ruby
Banistergalaxy has joined #ruby
jonteru has left #ruby [#ruby]
<Hanmac> dreinull: "a%sc" % "b" #=> "abc"
phelps has quit [Ping timeout: 245 seconds]
mockra has joined #ruby
<apeiros_> sprintf aka String#%
<Hanmac> but i like % more
daniel_- has quit [Ping timeout: 256 seconds]
<dreinull> sorry, my machine is about to crash. Thanks for the hints
kil0byte has joined #ruby
adambeynon has joined #ruby
<apeiros_> dreinull uses a premillenial operating system?
mockra has quit [Ping timeout: 244 seconds]
<dreinull> oh, seems to have recovered
phelps has joined #ruby
<dreinull> apeiros_: no :)
<dreinull> apeiros_: my mac every once in a while decides to send a random character to the OS. Like pressing a key non-stop
s1n4 has quit [Quit: leaving]
cakehero has quit [Quit: Computer has gone to sleep.]
<dreinull> but I managed to kill tmux and end that nightmare
lenovodroid has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
Villadelfia has quit [Ping timeout: 255 seconds]
Goles has joined #ruby
kil0byte_ has joined #ruby
kil0byte has quit [Ping timeout: 245 seconds]
SeySayux has quit [Ping timeout: 246 seconds]
<Hanmac> apples are banana-ware, they does after-ripen at the customers ... and like real bananas some one are allready over ther date :P
phelps has quit [Ping timeout: 265 seconds]
samphippen has quit [Ping timeout: 252 seconds]
samphippen has joined #ruby
Villadelfia has joined #ruby
* apeiros_ wonders what linux is then - lets the consumer do the riping
fire has joined #ruby
<apeiros_> cuckoo-ware?
phelps has joined #ruby
iamjarvo has joined #ruby
Catnaroek has quit [Ping timeout: 246 seconds]
kil0byte_ has quit [Ping timeout: 255 seconds]
SeySayux has joined #ruby
enroxorz-work has joined #ruby
Morkel has quit [Quit: Morkel]
jfl0wers has joined #ruby
kil0byte has joined #ruby
iPhoneMRZ has joined #ruby
iPhoneMRZ has quit [Client Quit]
<shevy> becom33 hi, nope was sleeping, wanted to wake up 4 hours earlier... but fell asleep again... grr
<becom33> ha ha cool cool
ttt has quit [Remote host closed the connection]
phelps has quit [Ping timeout: 250 seconds]
kil0byte_ has joined #ruby
chussenot has joined #ruby
tenmilestereo has joined #ruby
phelps has joined #ruby
kil0byte has quit [Ping timeout: 250 seconds]
iPhoneMRZ has joined #ruby
iPhoneMRZ has quit [Client Quit]
daniel_- has joined #ruby
iPhoneMRZ has joined #ruby
bean has joined #ruby
justincampbell has joined #ruby
Virunga has quit [Remote host closed the connection]
adkron has quit [Ping timeout: 252 seconds]
samphippen has quit [Ping timeout: 252 seconds]
zmbmartin has left #ruby [#ruby]
samphippen has joined #ruby
burgestrand has joined #ruby
kil0byte_ has quit [Ping timeout: 255 seconds]
NiteRain has quit [Ping timeout: 246 seconds]
WhereIsMySpoon has quit [Changing host]
WhereIsMySpoon has joined #ruby
phantasm66 has quit [Quit: *sleeeep….]
dsdeiz has joined #ruby
oktapodi has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
phelps has quit [Ping timeout: 255 seconds]
kil0byte has joined #ruby
ner0x has joined #ruby
phelps has joined #ruby
adeponte has joined #ruby
chussenot has quit [Quit: chussenot]
<dreinull> % and sprintf are a mess. How am I supposed to understand all that. Managed to format my String but this is terrible.
oktapodi has quit [Remote host closed the connection]
regedarek has quit [Ping timeout: 245 seconds]
iPhoneMRZ has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
kil0byte has quit [Ping timeout: 246 seconds]
rakl has quit [Quit: sleeping]
lkba has quit [Ping timeout: 256 seconds]
matip has quit [Read error: Connection reset by peer]
breakingthings has joined #ruby
m_m has quit [Remote host closed the connection]
phelps has quit [Ping timeout: 252 seconds]
matip has joined #ruby
FDj_ has joined #ruby
fjfish has joined #ruby
strangeworks has joined #ruby
<shevy> dreinull hmm I never think much about the %, I only think about what output I want to achieve
kil0byte has joined #ruby
<shevy> '%3s' % '1' # ' 1'
verto|off has quit [Ping timeout: 244 seconds]
benwoody has quit [Ping timeout: 244 seconds]
FDj has quit [Read error: Connection reset by peer]
francisfish has quit [Read error: Connection reset by peer]
drizz has quit [Ping timeout: 244 seconds]
lepht has quit [Ping timeout: 244 seconds]
thomasfedb has quit [Ping timeout: 244 seconds]
mguy has quit [Ping timeout: 244 seconds]
mguy_ has quit [Ping timeout: 244 seconds]
sheerun has quit [Ping timeout: 244 seconds]
mguy has joined #ruby
Catnaroek has joined #ruby
phelps has joined #ruby
drizz has joined #ruby
neersighted has quit [Ping timeout: 244 seconds]
mguy_ has joined #ruby
verto|off has joined #ruby
verto|off is now known as verto
adeponte has quit [Remote host closed the connection]
verto is now known as Guest61922
benwoody has joined #ruby
mercwithamouth has joined #ruby
tommyvyo has joined #ruby
fyolnish has joined #ruby
sheerun has joined #ruby
thomasfedb has joined #ruby
neersighted has joined #ruby
lepht has joined #ruby
Apocalypse has joined #ruby
philcrissman has joined #ruby
Russell^^ has joined #ruby
phelps has quit [Ping timeout: 255 seconds]
GoGoGarrett has joined #ruby
phelps has joined #ruby
<dreinull> shevy: I wanted something like this: "short 123" and "somewhat longer 123" with flexible space in between
<dreinull> I now used sprintf("%-30s %30s", a, b)
vlad_starkov has joined #ruby
<dreinull> but that doesn't look right to me (but Ruby is nice and does the job anyway)
vlad_starkov has quit [Read error: Connection reset by peer]
<bean> dreinull: that appears to be correct from a quick search
banisterfiend has joined #ruby
Catnaroek has quit [Ping timeout: 250 seconds]
<dreinull> I had to interpolate a which was actually a name into one var because I didn't lnow how to have three vars aligned :)
lenovodroid has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby
phelps has quit [Ping timeout: 264 seconds]
buibex has joined #ruby
dnyy has joined #ruby
kil0byte has quit [Ping timeout: 252 seconds]
thatguycraig has joined #ruby
phelps has joined #ruby
moos3 has joined #ruby
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
<shevy> dreinull yeah, this is very much a common C heritage
mockra has joined #ruby
moos3 has quit [Client Quit]
<shevy> the C folks use the (s)printf() things all over the place
kil0byte has joined #ruby
<dreinull> I'd improve the docs if only...
<shevy> hehehe
<dreinull> that happens so many times with the Ruby docs.
<shevy> yup
<dreinull> Last thing was Enumerable
<shevy> I solved that for myself by using my own documentation locally
<dreinull> what a mess.
<dreinull> shevy: push to ruby!
<shevy> hehe
<shevy> too much work to convince others :P
<dreinull> zzak has a documenting ruby port on github
<shevy> oh?
<dreinull> he's open to all
<shevy> hmm I see, thought you meant the official ruby team
jonahR has joined #ruby
<dreinull> shevy: he is a core commiter for docs
_bart has joined #ruby
mockra has quit [Ping timeout: 244 seconds]
daniel_- has quit [Ping timeout: 246 seconds]
<shevy> ah ok
<shevy> curious to name a project "documenting ruby" hehehe
jerius has joined #ruby
emsilva has quit [Quit: Textual IRC Client: www.textualapp.com]
starburst has quit [Remote host closed the connection]
nari has joined #ruby
daveturnbull has joined #ruby
phelps has quit [Remote host closed the connection]
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
phelps has joined #ruby
banisterfiend has quit [Ping timeout: 250 seconds]
daveturnbull has quit [Quit: daveturnbull]
stat1x has quit [Read error: Connection reset by peer]
tk__ has joined #ruby
phelps has quit [Ping timeout: 250 seconds]
caveat- has quit [Quit: leaving]
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
hotovson has joined #ruby
mikecmpbll has joined #ruby
stevechiagozie has joined #ruby
<_axx> i'm wondering, is net/ssh removed in ruby 1.9.2? i get in error requiring it. is there a gem or something? :)
Virunga has joined #ruby
banisterfiend has joined #ruby
phelps has joined #ruby
<dsdeiz> hi all, anyone using dropbox-sdk? how does one store the access token?
elsifaka has quit [Read error: Connection reset by peer]
caveat- has joined #ruby
adamnbowen has joined #ruby
elsifaka has joined #ruby
Vert has joined #ruby
elsifaka has quit [Read error: Connection reset by peer]
elsifaka has joined #ruby
sayan has quit [Ping timeout: 256 seconds]
elsifaka has quit [Max SendQ exceeded]
elsifaka has joined #ruby
ananthakumaran has joined #ruby
jrajav has joined #ruby
<_axx> oh, stupid me... it isn't a stdlib
oposomme has quit [Quit: Leaving...]
grieve has joined #ruby
phelps has quit [Ping timeout: 255 seconds]
neurotech has quit [Remote host closed the connection]
oposomme has joined #ruby
vlad_sta_ has joined #ruby
mengu has joined #ruby
<bean> _axx: I believe so, one sec, I think I had to install a gem for it the other day
<bean> _axx: yeah, I did "gem install net-ssh"
stat1x has joined #ruby
benlieb has joined #ruby
phelps has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
C0deMaver1ck has joined #ruby
C0deMaver1ck has joined #ruby
C0deMaver1ck has quit [Changing host]
malte_ has quit [Quit: malte_]
banisterfiend has joined #ruby
mksm has quit [Ping timeout: 255 seconds]
vlad_starkov has quit [Ping timeout: 260 seconds]
<_axx> bean: yeah, thanks! :)
<bean> npnp
nari has quit [Read error: Operation timed out]
daniel_- has joined #ruby
Virunga has quit [Remote host closed the connection]
Virunga has joined #ruby
busybox42 has joined #ruby
Iszak has joined #ruby
iamjarvo has quit [Quit: Leaving.]
phelps has quit [Ping timeout: 265 seconds]
<rismoney> is it possible to make a string utf16le in ruby 1.8.7?
banisterfiend has quit [Ping timeout: 260 seconds]
Virunga has quit [Ping timeout: 256 seconds]
NiteRain has joined #ruby
<Hanmac> rismoney i dont think so
phelps has joined #ruby
syamajala has joined #ruby
s1n4 has joined #ruby
joshman_ has joined #ruby
slainer6_ has joined #ruby
kokainepizza has joined #ruby
slainer68 has quit [Ping timeout: 256 seconds]
C0deMaver1ck has quit [Ping timeout: 265 seconds]
thone has joined #ruby
<Mon_Ouie> Depends on what you mean by that. Ruby 1.8 doesn't know about encondings. Strings are just strings of bytes. So you can just put the data in whatever encoding you like.
<Mon_Ouie> You just have to make sure that you don't mix up different, incompatible encodings.
mksm has joined #ruby
phelps has quit [Ping timeout: 250 seconds]
_nitti has joined #ruby
thone_ has quit [Ping timeout: 255 seconds]
mikecmpbll has quit [Quit: Computer has gone to sleep.]
willob has joined #ruby
alesguzik has joined #ruby
phelps has joined #ruby
arturaz has quit [Remote host closed the connection]
stopbit has joined #ruby
Apocalypse has quit [Quit: Input/Output Error]
s1n4 has quit [Quit: leaving]
Guest25886 has quit [Quit: Guest25886]
iamjarvo has joined #ruby
AlSquire has joined #ruby
Apocalypse has joined #ruby
C0deMaver1ck has joined #ruby
C0deMaver1ck has joined #ruby
C0deMaver1ck has quit [Changing host]
lusory has quit [Ping timeout: 264 seconds]
mockra has joined #ruby
miskander has joined #ruby
miskander has quit [Client Quit]
vlad_starkov has joined #ruby
vlad_sta_ has quit [Read error: Connection reset by peer]
vlad_sta_ has joined #ruby
miskander has joined #ruby
nomenkun has quit [Ping timeout: 245 seconds]
rippa has joined #ruby
ananthakumaran1 has joined #ruby
mockra has quit [Ping timeout: 256 seconds]
chussenot has joined #ruby
nomenkun has joined #ruby
tndrbt has joined #ruby
vlad_starkov has quit [Ping timeout: 252 seconds]
ananthakumaran has quit [Ping timeout: 264 seconds]
nomenkun has quit [Read error: Connection reset by peer]
vlad_sta_ has quit [Ping timeout: 255 seconds]
nomenkun has joined #ruby
Jackneill has joined #ruby
Jackneill has quit [Changing host]
Jackneill has joined #ruby
<dsdeiz> hi, if a function returns two variables how do i set a variable for each returned variable?
sayan has joined #ruby
<apeiros_> method, not function. you do `a, b = foo()`
<dsdeiz> awesome, thx!
_nitti has quit [Remote host closed the connection]
lorn has quit [Ping timeout: 260 seconds]
_nitti has joined #ruby
lorn has joined #ruby
blaxter has quit [Quit: foo]
AndChat| has joined #ruby
chussenot has quit [Quit: chussenot]
lkba has joined #ruby
<justincampbell> can i curry a proc with all arguments without executing it?
Banistergalaxy has quit [Ping timeout: 244 seconds]
Gue______ has joined #ruby
Gue______ is now known as asteve
asteve has quit [Changing host]
asteve has joined #ruby
elico has joined #ruby
alexspeller has joined #ruby
statarb3 has quit [Ping timeout: 256 seconds]
blaxter has joined #ruby
nick_h has quit [Ping timeout: 255 seconds]
nick_h has joined #ruby
<burgestrand> justincampbell: wrap it in another proc
starburst has joined #ruby
<burgestrand> justincampbell: curried = proc { other_proc.call(1, 2, 3, 4) }
<justincampbell> burgestrand: good idea :) thanks
syamajala has quit [Remote host closed the connection]
grieve has quit []
Aqua has quit [Ping timeout: 255 seconds]
<canton7> justincampbell, there's also Proc#curry
<justincampbell> canton7: yes but if you give it all arguments, it executes
<justincampbell> required* arguments
<canton7> justincampbell, good point
<justincampbell> trying to give a block a complete set of arguments to be execute elsewhere
<justincampbell> burgestrand: your solution worked, thanks!
<burgestrand> :)
onibox has joined #ruby
Aqua has joined #ruby
elico has quit [Quit: elico]
lolmaus has quit []
slainer6_ is now known as slainer68
gyre007 has joined #ruby
lenovodroid has joined #ruby
thomsch has joined #ruby
chussenot has joined #ruby
Virunga has joined #ruby
buibex has quit [Remote host closed the connection]
banisterfiend has joined #ruby
ffranz1 has joined #ruby
onibox has quit [Quit: leaving]
phelps has quit [Ping timeout: 255 seconds]
stevechiagozie has quit [Quit: leaving]
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
oposomme has quit [Quit: Leaving...]
phelps has joined #ruby
ffranz has quit [Read error: Operation timed out]
banister_ has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
ikaros has joined #ruby
chussenot has quit [Quit: chussenot]
sayan has quit [Ping timeout: 256 seconds]
danneu has joined #ruby
Iszak has quit []
NiteRain has quit [Quit: KVIrc 4.1.3 Equilibrium http://www.kvirc.net/]
brotspinne has joined #ruby
mrdtt has joined #ruby
mafolz has quit [Remote host closed the connection]
gyre007 has quit [Remote host closed the connection]
<brotspinne> hello. do someone know how to convert this array [1, 2, 3, 4] into this [[1, 2], [3, 4]] with a simple method call?
<danneu> brotspinne: yeah
gyre007 has joined #ruby
<danneu> brotspinne: sec
<Hanmac> ary.each_slice(2).to_a
<danneu> too fast for me
<brotspinne> nice
<Gadgetoid> OSX is great for Ruby until it isn't :D
<pasties> there is a simpler wat
<pasties> *way
<pasties> brotspinne: just call flatten on it
<pasties> [[1, 2], [3, 4]].flatten
<canton7> pasties, that's going in the other direction
<pasties> ah misread your question
<canton7> he wants to go [1, 2, 3, 4] *to* [[1, 2], [3, 4]]
<pasties> sorry
<canton7> :P
<brotspinne> shame
<Gadgetoid> .each_slice(2
<shevy> .each_shame
<pasties> hahah
<brotspinne> map &:slap
_64k_ has quit [Quit: _64k_]
<Gadgetoid> Wouldn't each_slice be better than map?
Asher has joined #ruby
<Gadgetoid> Guess fun happens if the array is an odd number of elements long :D
<pasties> it shouldn't slice will just return an array with a single element at the end
<Gadgetoid> [1,2,3,4].each_slice(2).collect {|s| s} ?
miskander has quit [Quit: miskander]
rondale_sc has joined #ruby
iaj has quit [Ping timeout: 250 seconds]
<brotspinne> Gadgetoid: what are you talking about?
<Gadgetoid> Didn't read up :D
<Gadgetoid> just also arrived at ary.each_slice(2).to_a
<Gadgetoid> Ruby is nice sometimes. Sometimes.
filipe has quit [Quit: Leaving]
<shevy> I hate shell scripts
<shevy> why are all those bootup scripts in shell
vlad_starkov has joined #ruby
miskander has joined #ruby
markit has joined #ruby
track7 has quit [Read error: Connection reset by peer]
<markit> hi, I'm puzzled because of this:
mockra has joined #ruby
pcarrier has quit []
<markit> s = 'this is a string'
<markit> s[/(.+)\sstring/,1]
<markit> => "this is a"
_nitti has quit [Ping timeout: 260 seconds]
<markit> is something I was suggested time ago, but don't understand the syntax
<shevy> () captures
<markit> seems a slice, but with regexp
<shevy> what is captured, is available in 1 2 3 4 etc...
<shevy> this is just a regex argument
<shevy> you see the //
<shevy> every string has the [] method
lenovodroid has quit [Ping timeout: 244 seconds]
iaj has joined #ruby
sayan has joined #ruby
skcin7 has joined #ruby
<shevy> "abc"[/b/] # => "b"
<shevy> "abc"[/f/] # => nil
track7 has joined #ruby
<markit> so string[/regexp/]?
<markit> so new to me, thanks
<shevy> yes, // is always a regex anyway
<shevy> it's just the argument to the [] method
<shevy> def [](argument)
<markit> since 'this is a string'[1] gives me back the aschii of 't'
<shevy> if argument.is_a? Regex # or whatever the name was... I forgot it
_nitti has joined #ruby
elsifaka has quit [Quit: Veloma e!]
<markit> mmm too magic under cover for my poor brain
<shevy> well, 1 is not a regex, /1/ would be
<shevy> there is no magic!
banister_ has quit [Ping timeout: 246 seconds]
<shevy> 'foo'[1] is the same as 'foo'[1,1]
<shevy> but that is not a regex argument
<markit> if you were used to language like C or pascal, you will consider it magic ;P
<shevy> memory allocation and pointers is magic to me ;P
<cout> it's all magic
<Hanmac> shevy, "'foo'[1] is the same as 'foo'[1,1]" this is not true for 1.8
atmosx has joined #ruby
<shevy> Hanmac I only use the latter anyway
<markit> hi Hanmac, the above is your suggested code of some days ago, lol
<shevy> lol
mockra has quit [Ping timeout: 260 seconds]
<dsdeiz> hi again! :D just wondering if there's a one liner to determine if a value exists in a hash inside another hash
<markit> I'm trying to combine with my other and does not work as expected
<shevy> dsdeiz perhaps .has_value? twice for both hashes
<dsdeiz> ah got it. thx.
<shevy> if hash1.has_value? 7 and hash2.has_value? 3
vlad_starkov has quit [Ping timeout: 256 seconds]
<markit> I have
<markit> %x[ls /usr/share/xsessions/].split("\n").select{|s| s =~ /^.*desktop/i }.each{|s| s[/(.+)\sdesktop/,1]}
<markit> => ["gnome-classic.desktop", "gnome.desktop", "gnome-fallback.desktop", "gnome-shell.desktop", "ubuntu-2d.desktop", "ubuntu.desktop"]
<markit> then I want to REMOVE the ".desktop" part
<shevy> oh you mean a hash inside a hash, well just access the hash properly :)
<shevy> markit you won't need ls
<shevy> you can use Dir[]
<markit> so I added:
<markit> %x[ls /usr/share/xsessions/].split("\n").select{|s| s =~ /^.*desktop/i }.map{|s| puts s[/(.+)\sdesktop/,1] }
<markit> but gives me "nil" array
<shevy> Dir['/usr/share/xsessions/*']
<markit> sorry, tha code gives me "nil" output from puts
<shevy> well
<shevy> use .reject
<markit> shevy: I prefer code with ruby as a clue for bash commands
<Hanmac> "abc"["a"] exist too
<markit> shevy: no, I want those entries
<shevy> .reject {|line| line !~ /\.desktop/ }
<markit> shevy: just cut off the ".desktop" from the string
fire has quit [Read error: Operation timed out]
<markit> gnome-classic.desktop -> gnome-classic
<shevy> why not use .gsub
<shevy> "gnome-classic.desktop".gsub(/\.desktop/,'') # => "gnome-classic"
<swarley> or
<swarley> string.chomp(".desktop")
<swarley> that takes .desktop off the end of the string
<shevy> hmm that would be short
* markit tries
<shevy> .chomp beats .gsub here :)
<markit> in any case, wondering why the s[/(.+)\sdesktop/,1] does not work there
tangorri has joined #ruby
<tangorri> hi
<brotspinne> File.basename('gnome-classic.desktop', '.desktop')
<canton7> markit, \s is whitespace...
vlad_starkov has joined #ruby
<tangorri> I'm using ruby under windows and pik, but I got problem with bundler
<swarley> [1] pry(main)> l = "gnome-classic.desktop".chomp(".desktop")
<swarley> => "gnome-classic"
<shevy> Hanmac, a bundler problem again, you must help
<markit> canton7: ARGH, right
<tangorri> 'bundle install --path .\gems' ok, but then ruby can't find the gems ...
<markit> ok, not is all rational
<swarley> but seriously
<markit> world isn't ending ;P
<shevy> markit not today, but it will one day *evil laugh here*
<tangorri> Hanmac please help :D
sailias has quit [Quit: Leaving.]
* markit takes note of all the above bright suggestions
<swarley> markit; the one i gave you is probably the most readable way to do it lol
<Hanmac> he was fooling you ... i never used or needed bundler
<shevy> shameless self-promotion ;P
<swarley> shevy; well it is true :p
aldodelgado has joined #ruby
<canton7> tangorri, bundler is about installer gems per-project, not system-wide. Your app needs to include bundler, and maybe execute a function (can't remember) before 'require' will start using the app's local gem cache
<canton7> s/installer/installing
<shevy> Hanmac but you like bundler very much!
<tangorri> canton the same project works on linux and osx
<brotspinne> markit: you don't even need select and map. you could use %x[ls /usr/share/xsessions/].scan(/(.*)\.desktop$/i).flatten
<dsdeiz> in dropbox, the path returns /Public/directory/file.ext, how do i just retrieve 'file'?
sailias has joined #ruby
<atmosx> dsdeiz: what do you mean by 'file' ?
<markit> brotspinne: urgh, incredible concise
<atmosx> dsdeiz: FILENAME?
_64k has joined #ruby
_64k has quit [Client Quit]
<dsdeiz> in /Public/directory/file.ext, id like to just retrieve file from that string
tndrbt has quit [Quit: tndrbt]
alexim has joined #ruby
<canton7> tangorri, looks right
<brotspinne> dsdeiz: File.basename('/Public/directory/file.ext', '.ext') # => 'file'
<dsdeiz> right, thx
<canton7> tangorri, I don't know what you're trying to do, but it looks like you're getting gem and bunder mixed up
statarb3 has joined #ruby
<tangorri> canton7 mixed up ?
<tangorri> I just try to run my app
<canton7> tangorri, what are you actually trying to do? This looks like an XY problem
<atmosx> XY = it's a male!!!!!
ffranz1 has quit [Quit: Leaving]
bluOxigen has quit [Ping timeout: 265 seconds]
<brotspinne> markit: I'm interested in your final solution
lenodroid has joined #ruby
<tangorri> canton7 well I need some gems to run my app, so I do as usual, I use Gemfile and bundler
ffranz has joined #ruby
* atmosx never uses a gemfile and a bundler, heroku app apart.
ffranz has quit [Remote host closed the connection]
AndChat| has quit [Read error: Connection reset by peer]
<canton7> tangorri, ok cool. So why are you surprised when the gems aren't installed system-wide
lenodroid has quit [Read error: Connection reset by peer]
lenodroid has joined #ruby
Banistergalaxy has joined #ruby
<tangorri> because I run bundle install ... :/
<tangorri> so the gem should be there
<markit> brotspinne: I will adopt yours, but when I asked for help some days ago I was interested in using regexp, so I took note of the interesting tips you all gave me
dr_neek has quit [Quit: dr_neek]
<canton7> Like I said, *that doesn't install gems system-wide. only per-app*
ffranz has joined #ruby
<brotspinne> ;)
<tangorri> they are on ./gems dir but not found
lenodroid has quit [Read error: Connection reset by peer]
atmosx has quit [Quit: And so the story goes…]
<canton7> the 'gem' tool won't know how to find gems installed with bundler. Because they're not installed system-wide
<tangorri> really ?
<canton7> How many more times do I need to repeat this?
_64k has joined #ruby
<tangorri> all right !
<tangorri> thanks
<tangorri> I go it
<canton7> cool!
<tangorri> got it now :D
<canton7> bundler installs a set of app-specific gems to an app-specific cache. You then configure the app to require those gems, rather than the system gems
<canton7> that's the whole premise
<tangorri> you are right, my memory fooled me
<tangorri> I need to binstubs or something
<canton7> iirc bundler *can* install gems system-wide, but the --path you passed probably precludes that
fire has joined #ruby
<tangorri> yes
cakehero has joined #ruby
<tangorri> just need to use bundle exec
<tangorri> hmmm bundle exec each time ?
havenn has joined #ruby
<slainer68> tangorri: NO NO, don't press the red button!
<slainer68> xD
<tangorri> :)
thinkclay has joined #ruby
atmosx has joined #ruby
<canton7> tangorri, when running your app?
<tangorri> yes
<canton7> tangorri, in your app, you should have 'require "bundler/setup"' before requiring your gems. That'll make sure the right gems are required
<cout> the RED button is for loading and unloading only. there shall be no pressing of the WHITE button.
bluOxigen has joined #ruby
<tangorri> ok let me check that
friskd has joined #ruby
alexspeller has quit [Remote host closed the connection]
healpay has quit [Remote host closed the connection]
sayan has quit [Quit: Leaving]
<tangorri> well the app runs ok
danneu has quit [Quit: WeeChat 0.3.8]
alexspeller has joined #ruby
<brotspinne> dsdeiz: you can use '.*' instead of '.ext' in my answer
elaptics is now known as elaptics`away
<brotspinne> dsdeiz: so the extension can be anything
<canton7> That's better than the idiom I see a lot, File.basename(file, File.extname(file))
<pskosinski> I have a script and without modifying it much I want to add kind of "watchman" checking every minute if something happened and if so then kill process. I was thinking about making subprocess using fork and share needed data from main process using pipe. Subprocess would check every minute if something happened and if so it would kill main process and exit. Is it good idea, i there something better?
alexim has quit [Ping timeout: 256 seconds]
eldariof has quit [Read error: Operation timed out]
<tangorri> hmmm now shotgun has problem
<pskosinski> Simply my script, when connection dies, is "staying in place". :< And I want to kill it.
Banistergalaxy has quit [Read error: Connection reset by peer]
<pskosinski> freezing *
<pskosinski> Or can I do something like… threads? Two independent scripts in one? ^^ No idea, I was never doing it.
alexspeller has quit [Read error: Connection reset by peer]
brotspinne has quit [Quit: brotspinne]
Banistergalaxy has joined #ruby
nomenkun has quit [Remote host closed the connection]
Iszak has joined #ruby
nomenkun has joined #ruby
<pskosinski> Or is here someone playing with TCPSocket? Because I have no idea how to check is connection still exists, what is it's state… in case when internet connection dies.
<pskosinski> check if *
kmurph has joined #ruby
kmurph has quit [Client Quit]
BoomCow has joined #ruby
elico has joined #ruby
berserkr has quit [Quit: Leaving.]
freeayu has quit [Remote host closed the connection]
atmosx has quit [Ping timeout: 260 seconds]
tk__ has quit [Quit: ばいばい]
_nitti has quit [Remote host closed the connection]
lusory has joined #ruby
Jake232 has joined #ruby
tommyvyo has quit [Quit: Computer has gone to sleep.]
BoomCow has quit [Ping timeout: 260 seconds]
cbosh has quit [Ping timeout: 255 seconds]
pcarrier has joined #ruby
yacks has joined #ruby
frightenedmonkey has joined #ruby
mockra has joined #ruby
philcrissman has quit [Remote host closed the connection]
danneu has joined #ruby
BoomCow has joined #ruby
iamjarvo has quit [Quit: Leaving.]
gyre008 has joined #ruby
_nitti has joined #ruby
<pskosinski> Or I will show where exactly is problem: http://wklej.org/id/907555/ I have internet connection, I am creating it using TCPSocket.new, then in loop I am trying to get data from socket. But when my internet connection dies data never arrives so @handler.gets takes forever. :<
_bart has quit [Ping timeout: 260 seconds]
<pskosinski> IT's waiting all the time for data which will never appear.
gyre007 has quit [Read error: Operation timed out]
<pskosinski> No idea how to fix it. :<
gyre008 has quit [Remote host closed the connection]
jonahR has quit [Quit: jonahR]
gyre007 has joined #ruby
daniel_- has quit [Ping timeout: 246 seconds]
mayfield has joined #ruby
kjellski has joined #ruby
<danneu> pskosinski: `while line = @handler.gets`
kiyoura has joined #ruby
<pskosinski> Oh, if so, then I misunderstood and it's not waiting but I have bug. :< Will try, ty
Noldorin has joined #ruby
cbosh has joined #ruby
<danneu> I can't answer your question, but you don't need the !eof? check since #gets won't assign `line` when it's eof
pwelch has joined #ruby
notVert has joined #ruby
<danneu> Of course, inside that while condition, you'd process_server_output(line)
<pskosinski> Well, it's same. :(
<pskosinski> hm
<danneu> pskosinski: Ohhh, you want it to move on when, say, your internet conn dies. I misunderstood question
sayan has joined #ruby
<pskosinski> Yes, when connection dies, I have no idea how to check if it died.
notVert_ has joined #ruby
<pskosinski> I am for sure getting some data every minute, if I have connection. So if I won't get anything during minute I can kill process…
<danneu> pskosinski: I recommend this Ruby ebook: http://workingwithtcpsockets.com/.
Vert has quit [Ping timeout: 252 seconds]
<danneu> It'd answer that question a 100 times over
<pskosinski> Ok, thanks, will read.
miskander has quit [Quit: miskander]
danneu has left #ruby ["WeeChat 0.3.8"]
<pskosinski> Meh, I have no $30 for it now. :<
chimkan has joined #ruby
philips_ has quit [Excess Flood]
pappaeciccia has joined #ruby
pappaeciccia has quit [Client Quit]
notVert has quit [Ping timeout: 252 seconds]
mpfundstein has joined #ruby
rdegraci has quit [Quit: rdegraci]
JohnBat26 has joined #ruby
nomenkun_ has joined #ruby
elico has quit [Remote host closed the connection]
banisterfiend has joined #ruby
Morkel has joined #ruby
elaptics`away is now known as elaptics
slainer68 has quit [Remote host closed the connection]
<pskosinski> And as I see connection has all the time state "ESTABLISHED", Ruby is not changing its state when internet connections dies… So I guess that I can't rely on it and just do about what I was talking in the beginning? :< ok
nomenkun has quit [Ping timeout: 256 seconds]
mpfundst1in has joined #ruby
chimkan has quit [Ping timeout: 250 seconds]
nga4 has joined #ruby
mrdtt has quit [Quit: mrdtt]
Umren has joined #ruby
Sou|cutter has joined #ruby
dsdeiz has quit [Ping timeout: 252 seconds]
slash_nick has joined #ruby
<slash_nick> Hey guys... anyone know of any Digital Signals Processing (DSP) gems for Ruby?
d2dchat has joined #ruby
atmosx has joined #ruby
nick_h has quit [Ping timeout: 255 seconds]
nomenkun_ has quit [Remote host closed the connection]
blazes816 has joined #ruby
banisterfiend has quit [Ping timeout: 256 seconds]
zeade has joined #ruby
bean__ has joined #ruby
bean has quit [Read error: Connection reset by peer]
bean__ is now known as bean
nick_h has joined #ruby
benlieb has quit [Quit: benlieb]
benlieb has joined #ruby
zz_chrismcg is now known as chrismcg
fire has quit [Quit: WeeChat 0.3.9.2]
philips_ has joined #ruby
Vert has joined #ruby
mockra has quit [Remote host closed the connection]
_64k has quit [Quit: _64k]
<markit> may I use .include?(/regex/) ? seems not to work
oposomme has joined #ruby
<markit> ["gnome-classic", "gnome", "gnome-fallback", "gnome-shell", "ubuntu-2d", "ubuntu"].include?(/gnome/) => false
vlad_starkov has quit [Remote host closed the connection]
notVert_ has quit [Ping timeout: 252 seconds]
jonahR has joined #ruby
notVert has joined #ruby
<Sou|cutter> markit: ["gnome-classic", "gnome", "gnome-fallback", "gnome-shell", "ubuntu-2d", "ubuntu"].any? { |x| x =~ /gnome/ }
<markit> yep, or .find, wondering why include did not work with regex
<Sou|cutter> why would you assume it would?
<Sou|cutter> your array might contain Regexp objects
<markit> ah, I see the point... is checking if that same object is present
<Sou|cutter> yep
<markit> I was focused on string stuff
<markit> thanks a lot
Vert has quit [Ping timeout: 252 seconds]
<Sou|cutter> no prob :)
_64k has joined #ruby
zarubin has joined #ruby
mockra has joined #ruby
Vert has joined #ruby
banisterfiend has joined #ruby
oposomme has quit [Quit: Linkinus - http://linkinus.com]
zarubin has quit [Read error: Connection reset by peer]
zarubin has joined #ruby
notVert has quit [Ping timeout: 252 seconds]
ryanf has joined #ruby
fire has joined #ruby
<shevy> remove that string
notVert has joined #ruby
tenmilestereo has quit [Read error: Operation timed out]
Vert has quit [Ping timeout: 252 seconds]
cakehero has quit [Quit: Computer has gone to sleep.]
Vert has joined #ruby
eldariof has joined #ruby
elico has joined #ruby
breakingthings has quit []
banister_ has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
notVert_ has joined #ruby
delinquentme has joined #ruby
Sou|cutter has quit [Quit: WeeChat 0.3.0]
jgrevich has joined #ruby
chrismcg is now known as zz_chrismcg
notVert has quit [Ping timeout: 252 seconds]
robbyoconnor has quit [Max SendQ exceeded]
<jrajav> A world without string... is chaos
cakehero has joined #ruby
<slash_nick> <insert string theory joke>
robbyoconnor has joined #ruby
<slash_nick> humor as a random-variable
notVert has joined #ruby
jsrn has joined #ruby
Vert has quit [Ping timeout: 252 seconds]
jsrn has left #ruby [#ruby]
Vert has joined #ruby
kjellski has quit [Read error: Connection reset by peer]
notVert_ has quit [Ping timeout: 252 seconds]
notVert_ has joined #ruby
notVert has quit [Ping timeout: 252 seconds]
mayfield has quit [Read error: No route to host]
Vert has quit [Ping timeout: 252 seconds]
kjellski has joined #ruby
Vert has joined #ruby
bean has quit [Quit: Computer has gone to sleep.]
notVert_ has quit [Ping timeout: 252 seconds]
strangeworks has quit [Quit: Leaving]
benlieb has quit [Quit: benlieb]
tommyvyo has joined #ruby
hotovson has quit [Remote host closed the connection]
banister_ has quit [Ping timeout: 265 seconds]
msch has quit [Ping timeout: 252 seconds]
sayan has quit [Quit: Leaving]
kjellski has quit [Read error: Operation timed out]
hakunin has joined #ruby
msch has joined #ruby
statarb3 has quit [Quit: Leaving]
<shevy> when machines will have humor
<shevy> it will be time for the human race to step down and accept their new overlords
sayan has joined #ruby
kjellski has joined #ruby
mpfundst1in is now known as mpfundstein_home
notVert has joined #ruby
tangorri has left #ruby [#ruby]
<mpfundstein_home> humor doesnt work without emotion
<mpfundstein_home> so i think machines would be only good for a certain style of "machinistic" humor
moshee has quit [Ping timeout: 260 seconds]
daniel_- has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
akemrir has joined #ruby
<shevy> mpfundstein_home hmm interesting statement
elico has quit [Quit: elico]
sayan_ has joined #ruby
Vert has quit [Ping timeout: 252 seconds]
ryanf has quit [Ping timeout: 256 seconds]
jfl0wers has quit [Read error: Operation timed out]
dsdeiz has joined #ruby
arietis has joined #ruby
friskd has quit [Quit: friskd]
xemu has joined #ruby
akemrir has quit [Quit: WeeChat 0.3.9.2]
sayan_ has quit [Quit: Leaving]
jblack has joined #ruby
kjellski has quit [Quit: This computer has gone to sleep]
gyre007 has quit [Read error: Operation timed out]
<pskosinski> If someone remembers about what I was talking, solution is simple and looks like this: http://wklej.org/id/907646/ Nice.
gyre007 has joined #ruby
Proshot has joined #ruby
Russell^^ has quit [Quit: Russell^^]
<mpfundstein_home> pskosinski: just out of curiosity. what was the purpose?
miskander has joined #ruby
<jcrawford> what does the term monkey patching refer to in Ruby? I ask because I have seen it used and people are doing nothing more than extending classes or overriding methods in Jekyll and I am not quite sure why overloading/extending is called monkey patching
Vert has joined #ruby
banisterfiend has joined #ruby
<jcrawford> it appears the term really means modifying the run-time code of a dynamic language, surely that does not apply to Jekyll code would it?
notVert has quit [Ping timeout: 252 seconds]
notVert has joined #ruby
<pskosinski> mpfundstein_home: I am establishing a connection. And getting from it data in a loop. It should be killed when I'm not getting anything for X seconds. But connection_handler.gets is "freezing" script (waiting for data, but if my connection crashed data will never come). So it's best way from ways about which I was reading, to do something like this. :p
fire has quit [Quit: WeeChat 0.3.9.2]
Russell^^ has joined #ruby
<pskosinski> crashes *
<pskosinski> It's just waiting for execution 300 seconds and if app won't be executed returning nil.
<pskosinski> execution won't be finished *
<cout> jcrawford: I think the term was originally derogatory
ananthakumaran1 has quit [Quit: Leaving.]
Shadow_S has joined #ruby
_64k has quit [Quit: _64k]
<cout> I think the first time I heard it was in 2005 or 2006
Vert has quit [Ping timeout: 252 seconds]
megharsh has joined #ruby
WorkGroup has joined #ruby
Vert has joined #ruby
notVert_ has joined #ruby
<WorkGroup> Hello, i don't find my mistake (sorry for my bad english is here an german channel to) https://gist.github.com/025263923d39ccb95f31
daniel_- has quit [Ping timeout: 252 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
<jcrawford> WorkGroup: can you show the exact error you are getting as well
sn0wb1rd has quit [Quit: sn0wb1rd]
notVert has quit [Ping timeout: 252 seconds]
<WorkGroup> I don't become an error the Programm only run once
jgrevich_ has joined #ruby
<delinquentme> Ok so I dont get symbols.
jgrevich has quit [Read error: Operation timed out]
jgrevich_ is now known as jgrevich
<cout> delinquentme: what do you not yet?
<delinquentme> and they're using symbols as keys within a hash... and the article states that hashes will re-instantiate the keys if they're not symbols
Vert has quit [Ping timeout: 252 seconds]
<delinquentme> thus it says the advantage of a symbol is to save memory and NOT reinstantiate a key within a hash
Vert has joined #ruby
<jcrawford> WorkGroup: not sure why that would run only once unless there was an error you have no break out clause
<delinquentme> that part makes sense ... but i just tried overwriting values in my hashes and the object ids stayed the same
_bart has joined #ruby
<WorkGroup> jcrawford with while true it also not run
<shevy> delinquentme show the example? you used strings as keys?
AlSquire has quit [Quit: This computer has gone to sleep]
<delinquentme> yeah
sepp2k has quit [Ping timeout: 255 seconds]
<jcrawford> delinquentme: a symbol is just a pointer/label, if you use strings for your keys it will use more and more memory as it will not use the same string location in memory. A symbol will always point to the same memory location
notVert has joined #ruby
<pskosinski> WorkGroup: exec is executing program and not returning to "parent". You need to do something like: https://gist.github.com/4390797
<pskosinski> iirc…
<delinquentme> jcrawford, look at the gist though ... its the same ID ( and thus address ? )
<jcrawford> the Ruby Fundamentals on Lynda.com did a really good explanation of that
<jcrawford> delinquentme: moment looking
notVert_ has quit [Ping timeout: 252 seconds]
the_jeebster has joined #ruby
<jcrawford> no that is incorrect, it will not use the same string memory location, unless you are using symbols
nicoulaj has quit [Ping timeout: 252 seconds]
AlSquire has joined #ruby
<the_jeebster> do I need to perform a reload on the user object after destroying the subscription with the following code? user.subscription.destroy
<the_jeebster> user.subscription = fetch_subscription
Vert has quit [Ping timeout: 252 seconds]
<the_jeebster> err, wrong channel
<the_jeebster> sorry
jenrzzz has joined #ruby
<delinquentme> jcrawford, am I using the wrong code to check the id?
<mpfundstein_home> WorkGroup: Why cant you use EventMachine and listen for events?
<mpfundstein_home> WorkGroup: They poll for it, so you dont have to sleep
snearch has joined #ruby
<WorkGroup> WorkGroup: I don't no I'm new with ruby
<pskosinski> Ah… in case of fork and Process.wait sleep is not needed too. I forgot. :<
<mpfundstein_home> WorkGroup: ah sorry, i didnt look at your code. you have a different problem.
<mpfundstein_home> WorkGroup: But if you use linux, i would ue crontab
<mpfundstein_home> use*
<mpfundstein_home> thats running anyway and you dont have to keep your process running
<WorkGroup> mpfundstein_home thank you that is an great Idea and very simple
delinquentme has quit [Quit: Leaving]
Virunga is now known as LennyLinux
ltsstar has joined #ruby
<atmosx> WorkGroup: you're on a raspberry pi?
<WorkGroup> atmosx Yes
<atmosx> WorkGroup: you used rvm or rbenv for ruby?
<WorkGroup> atmosx: I don't know what you mean sorry my english is bad and i'm new with ruby
<Hanmac> WorkGroup there is #ruby-de but this channel is more active
beneggett has joined #ruby
<beneggett> any good tips on converting a string of text to snake_case?
<atmosx> Okay
<atmosx> cya all guys
<atmosx> bb
atmosx has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
Noldorin has quit [Quit: Computer has gone to sleep.]
<postmodern> beneggett, look at some previous implementations
kjellski has joined #ruby
gyre007 has quit [Remote host closed the connection]
alexspeller has joined #ruby
<beneggett> postmodern: thanks postmodern, not converting spaces to underscores though
<beneggett> i was just wondering if it was a common part of any standard ruby lib that i didn't notice
<beneggett> something in active support or something, I've seen the camel_case things, etc.
gyre007 has joined #ruby
<postmodern> beneggett, extlib or activesupport are your best bets
<beneggett> i'll write my own regexps
<beneggett> ok thx
gyre007 has quit [Remote host closed the connection]
<shevy> guys I have a question
<shevy> I run a ruby script, which calls GNU autoconfigure, like so:
<shevy> result = `./configure`
<shevy> the thing is, if I would do ./configure normally in bash, I get the output, line by line
sn0wb1rd has joined #ruby
<shevy> via result = `./configure`, however, it waits until that command has finished... so I dont get any output for a long while
obryan has joined #ruby
becom33 has quit [Ping timeout: 265 seconds]
<shevy> how could I get the same output line-by-line rather?
<shevy> reason I want that output is because I want to colourize keywords in those strings
<shevy> checking for X11/Intrinsic.h... yes <-- green colour
sepp2k has joined #ruby
<shevy> checking for XmuClientWindow in -lXmu... no <-- red colour
syamajala has joined #ruby
mayfield has joined #ruby
wermel has quit [Remote host closed the connection]
mahmoudi_ has joined #ruby
<shevy> hmm I will have a look at acoc http://raa.ruby-lang.org/project/acoc/
daniel_- has joined #ruby
mercwithamouth has quit [Ping timeout: 246 seconds]
_nitti has quit [Remote host closed the connection]
IceDragon has joined #ruby
digiwth has quit [Ping timeout: 244 seconds]
__BigO__ has joined #ruby
becom33 has joined #ruby
digiwth has joined #ruby
chriskk has joined #ruby
havenn has quit [Ping timeout: 260 seconds]
breakingthings has joined #ruby
kjellski has quit [Quit: This computer has gone to sleep]
syamajala has quit [Remote host closed the connection]
jerius has quit []
tenmilestereo has joined #ruby
rismoney has quit [Ping timeout: 245 seconds]
sailias has quit [Quit: Leaving.]
postmodern has quit [Quit: Leaving]
voodoofish430 has joined #ruby
pskosinski has quit [Quit: Learn Life's Little Lessons]
yacks has quit [Remote host closed the connection]
angelixd_ is now known as angelixd
toekutr has joined #ruby
daniel_- has quit [Ping timeout: 244 seconds]
mksm has quit [Ping timeout: 265 seconds]
dr_neek has joined #ruby
Jake232 has quit [Quit: Computer has gone to sleep.]
ryanf has joined #ruby
jerius has joined #ruby
pskosinski has joined #ruby
_nitti has joined #ruby
mksm has joined #ruby
ryanf has quit [Ping timeout: 255 seconds]
ffranz has quit [Quit: Leaving]
Tomasso has joined #ruby
arturaz has joined #ruby
jcrawford has quit [Excess Flood]
jcrawford has joined #ruby
bean has joined #ruby
johnmilton has joined #ruby
sailias has joined #ruby
malte_ has joined #ruby
tanathos has joined #ruby
sayan has quit [Remote host closed the connection]
<Tomasso> i launch a process that dies after some time from a ruby script i would like the script to relaunch it, but the script itself dies.. hoe should i call it so the script does not become the parent process ?
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
miskander has quit [Quit: miskander]
nick_h has quit [Ping timeout: 260 seconds]
ebobby has joined #ruby
nick_h has joined #ruby
malte_ has quit [Client Quit]
wallerdev has joined #ruby
nemesit has joined #ruby
LouisGB has quit [Ping timeout: 265 seconds]
starburst has quit [Remote host closed the connection]
<mpfundstein_home> tomasso: so the process which spawns your script dies ?
_bart has left #ruby [#ruby]
<Tomasso> mpfundstein_home, yes and it is not able to launch it again
_nitti_ has joined #ruby
dsdeiz has quit [Ping timeout: 260 seconds]
<mpfundstein_home> tomasso: why would you want it to die (or is that a bug?)
<mpfundstein_home> tomasso: i can suggest EventMachine to handle that. You can launch scripts and listen for events like stdin or finished/died
GlenK has joined #ruby
<GlenK> hi. I'm not understanding why it's complaining about this: dice.each { |die| counts[die - 1]++ }
<dreinull> what's the gem again that supports minitest stop on f/e?
<GlenK> tells me unexpected }
<Tomasso> thats a bug, i would like my monitor/launcher script to launch the death.process again
_nitti has quit [Ping timeout: 265 seconds]
<Tomasso> mpfundstein_home, thats a bug, i would like my monitor/launcher script to launch the death.process again
_nitti has joined #ruby
atno has quit [Read error: Connection reset by peer]
AlSquire has quit [Quit: This computer has gone to sleep]
<IceDragon> GlenK ruby doesn't use ++ or -- (forgot what they are called)
Catnaroek has joined #ruby
atno has joined #ruby
_nitti has quit [Read error: No route to host]
<mpfundstein_home> Tomasso: So you want a parent process which spawns children and monitors their "health"
<strtok> increment and decrement operators
<mpfundstein_home> ?
rippa has quit [Ping timeout: 240 seconds]
_nitti_ has quit [Ping timeout: 265 seconds]
baphled has quit [Ping timeout: 265 seconds]
<IceDragon> strtok: right thanks
<Tomasso> mpfundstein_home, yes, and also be.able to.launch.them again
<IceDragon> GlenK: dice.each { |die| counts[die - 1] += 1 }
_nitti has joined #ruby
<mpfundstein_home> tomasso: use event machine, i have some code here doing a bit like this
<mpfundstein_home> tomasso: i'll search for it
<Tomasso> mpfundstein_home, thank you
<mpfundstein_home> Tomasso: it is VERY basic and a bit different use case but should get you started: https://gist.github.com/4391393
<Tomasso> mpfundstein_home, taking a look at God, seems to be easy to use
baphled has joined #ruby
<Tomasso> le me check
<mpfundstein_home> Tomasso: Dont know that one
<mpfundstein_home> Tomasso: There are 100% solutions out there already
miskander has joined #ruby
<Tomasso> mpfundstein_home, thanks!
WorkGroup has left #ruby [#ruby]
<mpfundstein_home> Tomasso: If anything is unclear let me know
krawchyk has joined #ruby
<GlenK> IceDragon: ah, crap. for some reason I thought ruby had that stuff. thanks.
<IceDragon> np
<slash_nick> win 2
<slash_nick> whoops
Astral__ has quit [Ping timeout: 246 seconds]
tyman has left #ruby [#ruby]
ryanf has joined #ruby
wallerdev has quit [Quit: wallerdev]
Astral__ has joined #ruby
Noldorin has joined #ruby
<banisterfiend> why does /^\s*class\s*(\w*)(::)?Bitter/ not match this: "class Cry::Method::Bitter" ?
io_syl has joined #ruby
<ryanf> banisterfiend: nice obfuscation :)
<GlenK> wouldn't you need more :: stuff? /^\s*class\s*(\w*)(::)(\w*)(::)Bitter/
miskander has quit [Quit: miskander]
<pskosinski> Maybe you have no whitespace on the beginning?
<GlenK> pskosinski: but * could mean empty, no?
<pskosinski> :x ok
phelps has quit [Ping timeout: 255 seconds]
miskander has joined #ruby
<IceDragon> banisterfiend: ^\s*class\s+(?:(?:\w*)::)*?Bitter
<IceDragon> dunno if you wanted to "catch" anything.
Catnaroek is now known as lolcathost
wookiehangover has quit [Ping timeout: 256 seconds]
alexspeller has quit [Remote host closed the connection]
<IceDragon> banisterfiend: http://rubular.com/r/ZEn3CnFY2T
becom33 has quit [Ping timeout: 255 seconds]
wookiehangover has joined #ruby
<pskosinski> Anyway code pasted by banisterfiend works for me. :< 1.9.3
phelps has joined #ruby
alesguzik has quit [Quit: leaving]
gyre007 has joined #ruby
kmurph has joined #ruby
tenmilestereo has quit [Ping timeout: 246 seconds]
havenn has joined #ruby
<banisterfiend> IceDragon: thanks
<IceDragon> your welcome
<banisterfiend> you're*
<banisterfiend> ;)
kenneth has joined #ruby
<kenneth> hey there
<IceDragon> *cries*
<kenneth> is there a way to include a module on an instance?
_64k has joined #ruby
<banisterfiend> kenneth: extend
<banisterfiend> kenneth: instance.extend MyModule
eldariof has quit []
<kenneth> awesome, thanks banisterfiend
alexspeller has joined #ruby
<IceDragon> I think extend and include are private.
<banisterfiend> include is, extend is not
blaxter has quit [Quit: foo]
<IceDragon> odd
gyre007 has quit [Ping timeout: 246 seconds]
Siphonblast has quit [Ping timeout: 245 seconds]
havenn has quit [Ping timeout: 260 seconds]
<kenneth> other question, can you do something like module First::Second; end if you want to avoid doing module First; module Second; end; end
<banisterfiend> IceDragon: a little bit, but the rationale is that 'include' is meant only to be used when defining a class, so it should only appear inside the class body
<banisterfiend> kenneth: yes
<banisterfiend> kenneth: but there are a few quirks
zastern_ has joined #ruby
<banisterfiend> (i.e they're note exactly equivalent)
<banisterfiend> not*
<IceDragon> you would need to have module First defined earlier.
rondale_sc_ has joined #ruby
<IceDragon> banisterfiend: That makes sense, except at one point I needed to shorthand some including on multiple classes
shevy has quit [Read error: Operation timed out]
_64k has quit [Quit: _64k]
headius has joined #ruby
rondale_sc has quit [Ping timeout: 252 seconds]
rondale_sc_ is now known as rondale_sc
wallerdev has joined #ruby
_64k has joined #ruby
becom33 has joined #ruby
dougireton has joined #ruby
asteve has quit [Quit: Computer has gone to sleep.]
miskander has quit [Quit: miskander]
thomsch has quit [Remote host closed the connection]
jfl0wers_ has joined #ruby
alexspeller has quit [Remote host closed the connection]
miskander has joined #ruby
Morkel has quit [Read error: Operation timed out]
Morkel has joined #ruby
Siphonblast has joined #ruby
obryan has quit [Quit: Konversation terminated!]
Umren has quit [Read error: Connection reset by peer]
_64k has quit [Quit: _64k]
emmanuelux has joined #ruby
shevy has joined #ruby
zeade has quit [Quit: Leaving.]
<shevy> $stderr.puts 'hi' # is this useful for anything much at all?
<Gate> shevy: debugging
LouisGB has joined #ruby
<shevy> hmm
<shevy> though I could use
<shevy> puts 'hi' if DEBUG ?
<shevy> I am not quite sure about $stderr
mksm has quit [Ping timeout: 255 seconds]
slash_nick has quit [Quit: leaving]
<IceDragon> $stderr is the IO object
<Gate> If what you are writing supresses stdout, you can use stderr, or you can pipe the two seperately, etc
mksm has joined #ruby
Shadow_S has quit [Quit: Textual IRC Client: www.textualapp.com]
harushimo has joined #ruby
Spaceghostc2c has quit [Excess Flood]
<shevy> ah yes, that's a good argument, I forgot pipes
rakl has joined #ruby
Nisstyre-laptop has joined #ruby
_64k has joined #ruby
hadees has joined #ruby
<shevy> wow... I read code of other people
<shevy> ensure; at_exit { exit status.nil? ? 0 : status >> 8 }; end
Neomex has joined #ruby
alexspeller has joined #ruby
<Gate> .... why would you divide your return code by 256?
Spaceghostc2c has joined #ruby
Beoran_ has joined #ruby
<shevy> I have no real idea... I am trying to dissect this code right now
_alejandro has joined #ruby
<mpfundstein_home> shevy: your question is why you would want to use stderr ?
Neomex has quit [Client Quit]
<shevy> mpfundstein_home hmm yeah. well, to use in pipes, that was a good answer, i.e. the 2>&1 thing or whatever it was
<mpfundstein_home> shevy: a linux user will always assume the stdout is the output of the computation a process does
<mpfundstein_home> shevy: stderr would be error output and info output
<mpfundstein_home> shevy: this way you can pipe with stdout to further processes with no error/info/warning messages cluttering your pipeline
<shevy> yeah that makes sense
<mpfundstein_home> its just good unix convention
Beoran__ has quit [Ping timeout: 264 seconds]
miskander has quit [Quit: miskander]
<mpfundstein_home> shevy: your other question is answered here: http://www.perlmonks.org/?node_id=793951
miskander has joined #ruby
miskander has quit [Client Quit]
<shevy> mpfundstein_home are you a old perl hacker by chance? :)
miskander has joined #ruby
benlieb has joined #ruby
arietis has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
JMcAfreak has joined #ruby
_nitti has quit [Remote host closed the connection]
nomenkun has joined #ruby
krawchyk has quit [Remote host closed the connection]
snearch has quit [Quit: Verlassend]
headius has quit [Quit: headius]
sailias has quit [Quit: Leaving.]
Jackneill has quit [Quit: Leaving]
dr_neek has quit [Ping timeout: 260 seconds]
dr_neek has joined #ruby
_nitti has joined #ruby
cascalheira has quit [Quit: Leaving...]
zeade has joined #ruby
aldodelgado has quit [Quit: aldodelgado]
<mpfundstein_home> shevy: nooooo waaay :D i come from a C background
thatguycraig has left #ruby [#ruby]
tvw has quit [Remote host closed the connection]
<Hanmac> then you may like that you can extend ruby with c code
skcin7 has quit [Ping timeout: 252 seconds]
<jrajav> It would be more interesting if you could extend c code with ruby ;)
<mpfundstein_home> Hanmac: yeah but every scripting language can do that. i am more interested in the "beauty" behind ruby. and the smalltalk roots
<kenneth> jrajav: who says you can;t?
<banisterfiend> mpfundstein_home: ask questions like 'how do i...' and we'll tell u the ruby-ish way to do it
bigmcq77 has quit [Quit: Computer has gone to sleep.]
sailias has joined #ruby
<Hanmac> i like the code blocks {}
Sou|cutter has joined #ruby
dankest has joined #ruby
Sou|cutter has quit [Client Quit]
<shevy> haha
<shevy> Hanmac is the ultimate C++-Ruby person
<shevy> but
<shevy> he HATES writing documentation :(
<mpfundstein_home> ;-)
<mpfundstein_home> as long as he writes self documenting code i am fine
<banisterfiend> mpfundstein_home: he's teutonic, writing docs in english is hard work
<mpfundstein_home> banisterfiend: sure. i just studied the book metaprogramming in ruby. it is pretty awesome. Obj C has a couple of similiar concepts
<banisterfiend> mpfundstein_home: Yeah, obj-c and ruby have a lot in common
<mpfundstein_home> smalltalk roots
<mpfundstein_home> :-)
<banisterfiend> yeah
krawchyk has joined #ruby
<mpfundstein_home> what i like is that you can tune it like crazy. i mean ActiveRecord is an awesome piece of work. Or Sinatra.
sailias has quit [Client Quit]
kmurph has quit [Quit: kmurph]
sailias has joined #ruby
<banisterfiend> mpfundstein_home: if you like smalltalk, u might enjoy pry (http://pryrepl.org) which is somewhat influenced by it
<mpfundstein_home> thx
havenn has joined #ruby
rondale_sc has quit [Ping timeout: 246 seconds]
zeade has quit [Ping timeout: 272 seconds]
sailias has quit [Client Quit]
<Hanmac> mpfundstein_home i use ruby for GUI Programmnig and 3D
JMcAfreak has quit [Quit: leaving]
alesguzik has joined #ruby
xAndy is now known as xandy
Morkel has quit [Quit: Morkel]
sailias1 has joined #ruby
<mpfundstein_home> Hanmac: nice but i am more at home on the server depops side
chessguy has joined #ruby
<mpfundstein_home> Hanmac: did some OpenGL in the past. but only 2D and in C. It was kinda obvious that scripting languages will emerge on that field as well
heftig has quit [Quit: leaving]
cantonic_ has joined #ruby
heftig has joined #ruby
cantonic has quit [Ping timeout: 250 seconds]
cantonic_ is now known as cantonic
sailias1 has quit [Ping timeout: 244 seconds]
richardr has joined #ruby
Sou|cutter has joined #ruby
Sou|cutter has quit [Changing host]
Sou|cutter has joined #ruby
sailias1 has joined #ruby
nwertman has joined #ruby
IceDragon has quit [Quit: Space~~~]
havenn has quit [Ping timeout: 246 seconds]
Sou|cutter has quit [Client Quit]
jenrzzz has quit [Ping timeout: 252 seconds]
manouch has joined #ruby
<manouch> hi... is it possible to "catch" a return out of a block when i evaluate it?
<manouch> i'd need to finalize things before unwinding the stack
mercwithamouth has joined #ruby
Sou|cutter has joined #ruby
kirun has quit [Quit: Client exiting]
sorbo_ has joined #ruby
Noldorin has quit [Quit: Computer has gone to sleep.]
Tomasso has quit [Ping timeout: 245 seconds]
cascalheira has joined #ruby
Goles has quit [Quit: Computer has gone to sleep.]
tyman has joined #ruby
tyman has left #ruby [#ruby]
krawchyk has quit [Remote host closed the connection]
AlSquire has joined #ruby
xandy is now known as xAndy
jduan1981 has joined #ruby
DrShoggoth has joined #ruby
dr_neek has quit [Quit: dr_neek]
philcrissman has joined #ruby
eliqtrope has joined #ruby
xAndy is now known as xandy
<eliqtrope> hi all, is there a way to modify self?
Noldorin has joined #ruby
alexspeller has quit [Remote host closed the connection]
<banisterfiend> eliqtrope: give an example what u mean
thinkclay has quit [Quit: Leaving.]
<_nitti> self.modify
<_nitti> modify(self)
<_nitti> way too broad
<sorbo_> eliqtrope: you can't change the value of self. it always points to the current object, and you can't make it point to something else.
tvw has joined #ruby
dr_neek has joined #ruby
benlieb has quit [Quit: benlieb]
nazty has quit [Quit: WeeChat 0.3.9.2]
naz has quit [Remote host closed the connection]
Sou|cutter has quit [Quit: WeeChat 0.3.9.2]
cascalheira has quit [Quit: Linkinus - http://linkinus.com]
koshii has quit [Ping timeout: 252 seconds]
objectivemo has joined #ruby
dr_neek has quit [Quit: dr_neek]
emergion has joined #ruby
Michael has joined #ruby
<eliqtrope> banisterfiend: a, node = Node.new 'parent', Node.new 'child'
<eliqtrope> a.add_child node # self.child, child.parent = child, self; finally modify self to point to child.
Noldorin has quit [Quit: Computer has gone to sleep.]
Michael is now known as Guest26268
br4ndon has joined #ruby
xandy is now known as xAndy
_nitti has quit [Remote host closed the connection]
_alejandro has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
bigmcq77 has joined #ruby
Tux-Tn has quit [Quit: ZNC - http://znc.sourceforge.net]
mjolk2 has quit [Quit: This computer has gone to sleep]
mjolk has joined #ruby
mjolk is now known as Guest37355
<objectivemo> hi
<mpfundstein_home> hi
<objectivemo> I have a quick question. So basically I have the freeze method to freeze an object, but I can reference another object and lose the frozen object, which is cool but it means I can do this
<objectivemo> string = "string"; string.freeze; string << "something" #this gives me error
cakehero has quit [Quit: Computer has gone to sleep.]
<objectivemo> but string = "anthers string" works
thufir_ has joined #ruby
<mpfundstein_home> yes
<objectivemo> how can I freeze the reference from changing
<mpfundstein_home> because string "points" than to anthers string
<mpfundstein_home> it is a new object on the heap
<objectivemo> ya, I understand pointers from my C++ days
<mpfundstein_home> you actually want a const pointer
<objectivemo> all I am asking is, how do I freeze the "pointer"
<objectivemo> how would I achieve that in ruby?
<mpfundstein_home> not?
Guest37355 has quit [Client Quit]
mercwithamouth has quit [Ping timeout: 252 seconds]
willob has quit [Quit: Leaving.]
<objectivemo> mpfundstein_home: huh?
<mpfundstein_home> you can use a symbol
Tomasso has joined #ruby
<objectivemo> fantastic! Thanks mpfundstein_home
dmiller has joined #ruby
<jcrawford> why would this give the error specified in the pastie? http://pastie.org/5586005
nazty has joined #ruby
skcin7 has joined #ruby
<richardr> H1,P4_-_Hello_2(1).png <- why wouldnt this regex H1,P4_-_Hello_2(1)(.*?).png match that? Cheers
Guest26268 has quit [Remote host closed the connection]
<jcrawford> might have to escape the (1) to be \(1\)
becom33 has quit [Ping timeout: 265 seconds]
dreinull has quit [Remote host closed the connection]
_64k has quit [Quit: _64k]
tvw has quit [Remote host closed the connection]
becom33 has joined #ruby
thufir_ has quit [Quit: Leaving.]
<mpfundstein_home> jcrawford
<mpfundstein_home> jcrawford: move the alias_method to the bottom of the class.
<jcrawford> hmm i've never seem to have had a problem with it being just before the method before, but will give your suggestion a shot
<mpfundstein_home> that works: https://gist.github.com/4392541
<jcrawford> that provides the same error
jerius has quit [Ping timeout: 255 seconds]
<richardr> jcrawford: thanks - that matches it. what is the easiest way to escape in Ruby?
<jcrawford> review.rb:108:in `alias_method': undefined method `destination' for module `Jekyll' (NameError)
picca has joined #ruby
<objectivemo> mpfundstein_home: I found out that no reference can be frozen, only objects can be frozen
<objectivemo> so I cannot have defensive programming as I did in say Java or C++
<mpfundstein_home> jcrawford: ok, i'd have to dig deeper
<jcrawford> richardr: Regex.escape?
<objectivemo> best way is to do encapsulation on that object
sorbo_ has quit [Quit: sorbo_]
<richardr> jcrawford: thanks
<jcrawford> mpfundstein_home: i can paste the entire class if ya wish
<mpfundstein_home> objectivemo: encapsualte
<objectivemo> exactly
<mpfundstein_home> objectivemo: but ruby is fairly open
emergion has quit [Quit: Computer has gone to sleep.]
<mpfundstein_home> objectivemo: someone can do whatever he wants. u can also access private instance variable from whereever you want if you know the tricks
<mpfundstein_home> jcrawford: small piece is ok
<jcrawford> i would be open to suggestions, I am new to Ruby and just trying to extend Jekyll so that I can have it the way I want :)
<objectivemo> mpfundstein_home, ya, I found the ways to access private methods.
<objectivemo> I think something like this should do
<jcrawford> oh you know what
<jcrawford> my bad
<jcrawford> i failed to extend the Post :)
alexspeller has joined #ruby
<jcrawford> extending got rid of that error :)
Diranged has joined #ruby
<objectivemo> would have loved to use A::B without having that being able to change
<mpfundstein_home> objectivemo: @@ is not good use for a class variable
<mpfundstein_home> objectivemo: make it like this:
<mpfundstein_home> mom
<objectivemo> mom?
<Diranged> need a quick hand.. i need to convet an array of strings like this [ "foo=bar", "abc=123" ] into json that looks like this: { "foo": "bar", "abc": "123" }
<Diranged> in a ruby template btw..
<Diranged> ive been mucking around with it.. and i can get close, but not quite there.. is there something simple im missing?
<mpfundstein_home> objectivemo: https://gist.github.com/4392593
<mpfundstein_home> thats better than using @@
pwelch has quit [Quit: pwelch]
pwelch has joined #ruby
pwelch has quit [Client Quit]
jerius has joined #ruby
<mpfundstein_home> Diragent: you can first convert the strings to a hash and than convert the array of hash to json using the .to_json method
<objectivemo> Diragent, if you bare with me a moment, I have a snippet for you
raul782_ has joined #ruby
jrajav has quit [Quit: I tend to be neutral about apples]
fomatin has joined #ruby
alexspeller has quit [Ping timeout: 252 seconds]
<objectivemo> Diranged: there you go http://slexy.org/view/s2SOO2M5hR
<objectivemo> I am new to the language, so someone here would probably know of a better way, if they do, I would not mind learning it
emmanuelux has quit [Quit: emmanuelux]
<mpfundstein_home> objectivemo: i like
<objectivemo> thanks mpfundstein_home :)
_64k has joined #ruby
<whitequark> mpfundstein_home: Hash[s.map { |elem| elem.split('=', 2) }]
<objectivemo> mpfundstein_home: hmmm, this looks really cool and geeky, I am just about to start chapter 4 of "The Well-Rounded Rubyist" which is all about modules, but I know exactly what you are doing here, even though I would not be able to make something like that myself now. Thanks for that
<mpfundstein_home> whitequark: O.o good one
<Diranged> objectivemo: thanks, looking into how i can get that into a ruby template
<objectivemo> Diranged: np
<objectivemo> Diranged: You really should be using a hash instead of an array though, using a hash makes life easier as there are already a lot of stuff made for it that you can just chose without reinventing the wheel
* mpfundstein_home thinks whitequarks solution is awesome.
<mpfundstein_home> s = [ "a=b", "c=d" ]
<mpfundstein_home> a = Hash[s.map { |elem| elem.split('=', 2) }]
<mpfundstein_home> puts a
<mpfundstein_home> great
<fomatin> hey guys, i'm just getting started with ruby/rails. i have a repo that i am trying to have working locally
emergion has joined #ruby
<fomatin> but I'm having some trouble with the gems
<mpfundstein_home> objectivemo: look at whitequarks solution. one line of code
<objectivemo> I just tried it now on irb
<Diranged> whitequark's is easier to use.. i like it..
<objectivemo> that is fantastic, really loving ruby when you see things like that, thanks whitequarks
<mpfundstein_home> yes
<fomatin> i tried installing rvm, but then when i tried `rake`, it said it couldn't even find rake
<mpfundstein_home> thats why i am so interested in ruby
<mpfundstein_home> its functional and oop
mengu has quit [Quit: Konversation terminated!]
daniel_hinojosa has joined #ruby
<fomatin> oh nvm, i'll try railsinstaller.org and come back again
<objectivemo> I'm really interested in it because it is not as rigid as Java and C# (languages I use professionally). I find for instance, for me to create a unit test in those two languages, I have to create the objects and methods first before I can compile and run the tests, I don't need to do that with ruby :D
<objectivemo> fomatin: which platform are you on? Windows, Linux or Mac?
brendan_ has quit [Remote host closed the connection]
<fomatin> mac
tommyvyo has quit [Ping timeout: 252 seconds]
<Diranged> thanks guys.. that second example worked perfectly
<Diranged> its exactly what i needed
daniel_- has joined #ruby
Slivka has quit [Read error: Connection reset by peer]
thinkclay has joined #ruby
d2dchat has quit [Remote host closed the connection]
<mpfundstein_home> objectivemo: switch to a job where u can use ruby. we are hiring at the moment in amsterdam :-) / joking
<mpfundstein_home> objectivemo: read "metaprogramming in ruby". it is so inspiring
<objectivemo> mpfundstein_home: funny, I quit my job to learn ruby than ruby on rails :P
<objectivemo> fomatin: There is a better way
d2dchat has joined #ruby
<fomatin> objectivemo, would love to hear it :)
<mpfundstein_home> i am not using rails atm. only sinatra with sinatra-syncrony
<fomatin> I'm coming from node, not really familiar with ruby/rails
wargasm has joined #ruby
gnul0ver has joined #ruby
<gnul0ver> hello
<objectivemo> fomatin: http://jewelrybox.unfiniti.com
<mpfundstein_home> fomatin: i also came from node. after writing some projects in it i wanted something more elegant
<fomatin> haha that kept crashing
Diranged has left #ruby [#ruby]
<objectivemo> mpfundstein_home: sinatra is wonderful for a quick rest api, I managed to do one really fast with it
<gnul0ver> my method y d.methods.sort will not work because yaml is missing? Is that true
<fomatin> mpfundstein_home, I'm actually very fond of node+coffee but new job = new language
<objectivemo> mpfundstein_home: but rails is much much better for when I want to do a whole website
<fomatin> and ruby is pretty cool, so i figured why not
vlad_starkov has quit [Read error: Connection reset by peer]
<gnul0ver> does anyone know about yaml
<fomatin> so objectivemo should i reinstall rvm?
<gnul0ver> for ruby
F1skr has joined #ruby
nwertman has quit [Ping timeout: 265 seconds]
<objectivemo> fomatin: you already have rvm installed and using the latest ruby
<objectivemo> fomatin: in which case, why not: gem install rails
<fomatin> also, when i did `bundle install` it created a symlink ~
yfeldblum has joined #ruby
alexwh_ has joined #ruby
<objectivemo> fomatin: can you elaborate on `bundle install` creating a symlink
benlieb has joined #ruby
<fomatin> aight 1 sec
<fomatin> do i `gem install rails` anywhere?
<objectivemo> yes
Bosma has quit [Quit: leaving]
<fomatin> and also i did `rvm implode`
kmurph has joined #ruby
nemesit has quit [Quit: Leaving...]
<fomatin> so i don't have rvm anymore
kmurph has quit [Read error: Connection reset by peer]
kmurph has joined #ruby
<objectivemo> fomatin: if you did `rvm implode` than forget about everything else i said and just use jewelrybox
<objectivemo> jewelrybox will do everything for you
<fomatin> i opened it
<fomatin> and it's blank
rondale_sc_ has joined #ruby
richardr has quit [Remote host closed the connection]
arturaz has quit [Remote host closed the connection]
reppard has joined #ruby
<fomatin> objectivemo http://d.fouadmat.in/ysEW
jgrevich_ has joined #ruby
<objectivemo> wow
Bosma has joined #ruby
<fomatin> it worked when i had rvm installed
<fomatin> should i install rvm
<fomatin> ?
<objectivemo> formatin: well that's silly then
freakazoid0223 has joined #ruby
jgrevich has quit [Read error: Connection reset by peer]
Bosma has quit [Client Quit]
markit has left #ruby ["Konversation terminated!"]
bradleyprice has joined #ruby
daniel has joined #ruby
jgrevich_ has quit [Read error: Operation timed out]
jgrevich has joined #ruby
daniel is now known as Guest46092
<Guest46092> i'm trying to switch to rbenv, i've done everything i can to try and remove all traces of rvm but gem install still ends up recreating ~/.rvm ??!
bigmcq77 has quit [Quit: Computer has gone to sleep.]
Guest46092 is now known as dspp
<dspp> clear
<reppard> dspp: do you have any leftovers in your bashrc?
<dspp> no, im using zsh but i removed the leftovers from both zshrc and bashrc
<dspp> ach, no i didnt
<dspp> just found a leftover i missed
nilg has quit [Remote host closed the connection]
<reppard> just for fun do ack rvm ~/
<reppard> =)
alexwh_ has left #ruby ["PART #archlinux-offtopic :PRIVMSG *status :help"]
alexwh has quit [Quit: Quitting]
benlieb has quit [Quit: benlieb]
picca has quit [Remote host closed the connection]
Spaceghostc2c has quit [Excess Flood]
eka has quit [Ping timeout: 252 seconds]
x82_nicole has joined #ruby
_nitti has joined #ruby
_nitti has quit [Remote host closed the connection]
Spaceghostc2c has joined #ruby
eka has joined #ruby
`gregorg` has joined #ruby
gregorg_taf has quit [Read error: Connection reset by peer]
benlieb has joined #ruby
GoGoGarrett has quit [Remote host closed the connection]
d2dchat has quit [Remote host closed the connection]
alexwh has joined #ruby
alexwh is now known as Guest90234
buibex has joined #ruby
breakingthings has quit []
melkor has joined #ruby
Guest90234 has quit [Client Quit]
<melkor> I'm using ubuntu and I am trying to setup a rails environment. Should I just use the default packages or should I download and install a different version?
tommyvyo has joined #ruby
alanp_ has joined #ruby
alanp_ has quit [Read error: Connection reset by peer]
alanp_ has joined #ruby
alanp has quit [Read error: Connection reset by peer]
alanp_ is now known as alanp
rondale_sc_ has left #ruby [#ruby]
<melkor> Oh, I see, the package is called 1.9.1 but the actual version is 1.9.2.
<shevy> melkor I think the reason it has that name, 1.9.1, is because of backwards C API compatibility
jerius has quit []
<shevy> though 1.9.2 is outdated as well :)
Goles has joined #ruby
Goles has quit [Max SendQ exceeded]
<melkor> shevy: the package says version 1.9.3, but the ruby website says 1.9.2. My webhost is 1.9.2 so I think the best will just be to use the ubuntu default.
Goles has joined #ruby
<shevy> wait... the ruby website says that?
<shevy> latest source tarball URL is this: ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p362.tar.bz2
<jcrawford> hey guys, i have a list of directory names from a ruby command, i am using .each on them now I need to figure out how to take this directory name and create a valid class name from it for instance if a directory is named php then it would try to create an object of phpArticle, any assistance on something I can read on how to do this?
Goles has quit [Remote host closed the connection]
_set has joined #ruby
<shevy> jcrawford can you make the question shorter. you have directory named "php", string. You append "Article" to this string, so you now have string "phpArticle"
<jduan1981> melkor: have you considered rvm or rbenv to manage different versions of ruby/rails?
<melkor> shevy: www.ruby-lang.org/en/downloads/ under linux it says it will install 1.9.2, that could be outdated.
<shevy> jcrawford first problem is - classes in ruby must start with a capitalized character
<Quadlex> jcrawford: Yes
<melkor> jduan1981: not even a little bit.
<jcrawford> shevy: it's that simple? then i can use string.new
<Quadlex> jcrawford: There is a way to create an object and then "attach" an instance of a class to it
<jduan1981> with rvm/rbenv, you can switch back and forth between different versions of ruby/rails
<melkor> jduan1981: maybe I will try that soon, I first want to do the basics.
Spaceghostc2c has quit [Excess Flood]
<gnul0ver> does yaml come with rails to use with irb ?
<jcrawford> thanks
<shevy> hmm but melkor ... the first paragraph reads "The current stable version is 1.9.3", anyway nevermind that, latest is 1.9.3p362, ruby 2.0 will not be too far away though so be prepared :)
<shevy> jcrawford if you want a string yeah
<shevy> you can turn the string into a constant
<shevy> Object.const_get "bar".upcase'
<jcrawford> actually a better idea :)
<reppard> melkor: i think part of the basics are setting up an environment and sometimes that means a version manager
<jcrawford> if i have dir which is a string variable such as 'php' can i do something like this
<jcrawford> self.articles.dir << article
<shevy> class Bar; end; bar = Object.const_get "bar".capitalize; p bar # Bar
<reppard> its alot easier to set up a version manager now then fight with a global install later
<jcrawford> sorry self.articles[dir] << article
samuel02 has quit [Remote host closed the connection]
<shevy> jcrawford why do you use self.
<jduan1981> melkor: 1. "\curl -L https://get.rvm.io | bash -s stable" to install rvm; 2. use rvm to install ruby, eg: rvm install ruby 1.9.3; 3. install rails: gem install rails 3.2
manouch has quit [Quit: manouch]
<shevy> keep in mind, the << is a method invocation too
Spaceghostc2c has joined #ruby
stopbit has quit [Quit: Leaving]
<jcrawford> its what Jekyll was using, i just am overriding a few methods
<shevy> array << 'hello'; array << 'world'
<shevy> if articles.dir returns an array or string, you could use << of course
<shevy> ah
<shevy> yeah, should work jcrawford
__BigO__ has quit [Remote host closed the connection]
<jcrawford> thanks shevy
ner0x has quit [Quit: Leaving]
<shevy> ruby would warn you if the name would not work ... class Php; end; bar = Object.const_get "php" # NameError: wrong constant name php
adamnbowen has quit [Quit: Textual IRC Client: www.textualapp.com]
philcrissman has quit [Read error: Connection reset by peer]
<shevy> "If most things on the menu disgust you, what on earth are you still doing at the table? The door is right over there, try not to slam it on your way out."
cloaked1 has joined #ruby
gnul0ver has left #ruby ["Leaving"]
<shevy> "Or was it CoffeeScript we're protesting this week? Or Bundler? Oh fuck it, down with SOMETHING! YEAH!"
<shevy> except that the bundler install way didn't work
<shevy> rails is too large for ruby :(
mercwithamouth has joined #ruby
philcrissman has joined #ruby
<cloaked1> New to Ruby here so apologize for the n00b question. I would like to pass the template name for an erb template to a method and then let said method render the template. However, I'm having a very difficult time getting this value to pass correctly so that the filename is correctly understood by the method. this doesn't work: def method(template); erb :template end; method(:filename)
<cloaked1> the following also doesn't seem to work... def method(template); erb template end; method(filename)
<cloaked1> so just not sure how to properly call this method so that it can properly use the passed argument as the filename.
sorbo_ has joined #ruby
joshman_ has quit [Quit: Computer has gone to sleep.]
jimeh has quit [Quit: Computer has gone to sleep.]
tommyvyo has quit [Quit: Computer has gone to sleep.]
<melkor> What is a good webserver for testing ruby on rails applications? I would prefer not to instal apache on this computer.
philcrissman has quit [Remote host closed the connection]
<Quadlex> melkor: Rails comes with WebRAT by default
<Quadlex> Start a new Rails application and type rails server
<reppard> i thought it was WEBrick
<lupine> webrick, you mean?
<Quadlex> Yes, that
<lupine> webrat is a web mocking framework IIRC
<Quadlex> You mean like the RIAA?
<lupine> anyway, webrick is vaguely fine. you can always install thin or mongrel
<melkor> great.
<lupine> rack apps are generally not built to be run without a real web server in the way though, so keep that in mind
<lupine> (e.g., by default, clients can set X-Forwarded-For HTTP headers, and if you don't strip them out, they'll be used to override request.request_ip)
eliqtrope has quit [Quit: Page closed]
<lupine> that's fun to find out a month inbto running a web service with ip-based authentication
pothibo has joined #ruby
jimeh has joined #ruby
koshii has joined #ruby
<JohnTeddy> Why does my output_data method only output two lines to the file?
<JohnTeddy> Shouldn't it output the entire original file?
<melkor> wow, ruby comes with gems by defualt.
<mpfundstein_home> JohNTeddy: can you also provide the csv's
<mpfundstein_home> ?
_alejandro has joined #ruby
<lupine> unfortunately
tommyvyo has joined #ruby
<JohnTeddy> mpfundstein_home: sorry, (I just updated the gist with the csv data)
mengu has joined #ruby
mengu has quit [Remote host closed the connection]
<shevy> sometimes old code I wrote makes me angry
jenrzzz has joined #ruby
<reppard> shevy: same here, i try not to keep it around
<mpfundstein_home> JohnTeddy: it prints out a whole bunch of numbers
<mpfundstein_home> JohNteddy: And crashes after a while
slainer68 has joined #ruby
<shevy> reppard hahah yeah :D I can so relate to that...
<shevy> right now I wonder if I should just remove it, rather than maintain it
havenn has joined #ruby
<reppard> i'm looking at a bunch of old project euler solutions....shiver
elico has joined #ruby
<JohnTeddy> mpfundstein_home: yes, how do I get it to dump the results into event_attendees_clean.csv ?
<reppard> back when i did stuff like puts "Elapsed : " + (Time.new - time).to_s + " secs"
michaelhf has joined #ruby
<reppard> instead of "Elapsed: #{Time.new - time} secs"
LennyLinux has quit [Remote host closed the connection]
<mpfundstein_home> JohnTeddy: first you validate your input csv
<shevy> haha
<shevy> I still do the first a lot reppard
<objectivemo> shevy: repaid: why make you angry, should you not feel happy at the way your progressed
<mpfundstein_home> JohnTeddy: first you validate your input csv
dougireton has quit [Quit: Leaving.]
<mpfundstein_home> 2,11/12/08 13:23,SArah,Hankins,pinalevitsky@jumpstartlab.com,414-520-5000,2022 15th Street NW,Washington,DC,20009
jenrzzz has quit [Ping timeout: 264 seconds]
<mpfundstein_home> invalid byte sequence in US-ASCII
<melkor> what is a good way to download the api?
<shevy> objectivemo hmm, there are some useful things in the old code, but I would have to refactor and fix a few things... this is the part I dislike
alexspeller has joined #ruby
<shevy> I'd rather be in a situation where I'd never have to make any changes
<JohnTeddy> mpfundstein_home: So something in the file is causing a problem?
<JohnTeddy> mpfundstein_home: I validate it by putting it through more regex?
<mpfundstein_home> this one
<mpfundstein_home> 5160,2/2/09 10:38,Dylan,Musial,dcrookes@jumpstartlab.com,,522 Detroit St,Ann Arbo,MI,
<mpfundstein_home> he is ably to write
<mpfundstein_home> see the last ,
<reppard> shevy: or atleast wrote code readable enough that it wasn't a pain to change
<mpfundstein_home> thath shouldnt be there. ther eshould be a \n
_64k has quit [Quit: _64k]
<melkor> Found it.
AndChat|41600 has joined #ruby
<JohnTeddy> mpfundstein_home: So the last , is causing problems?
<JohnTeddy> I see.
<mpfundstein_home> probably. its just a guess
moos3 has joined #ruby
<JohnTeddy> 5160,2/2/09 10:38,Dylan,Musial,dcrookes@jumpstartlab.com,814-571-1000,522 Detroit St,Ann Arbo,MI,48104
<jcrawford> hey guys i have self.articles = {} in my init, then i am using it like this self.articles[type] << article but I am getting an error about a nilclass: site_extension.rb:104:in `block (2 levels) in read_articles': undefined method `<<' for nil:NilClass (NoMethodError)
<JohnTeddy> That ends with a zipcode in the source file.
_64k has joined #ruby
<jcrawford> line 104 is just that line above that has the <<
<jcrawford> type is set to a string verified with puts type.class and puts type to make sure it was set
nwertman has joined #ruby
<mpfundstein_home> the problem is in your
<mpfundstein_home> clean_ methods
alexspeller has quit [Ping timeout: 252 seconds]
Tomasso has quit [Read error: Connection reset by peer]
dougireton has joined #ruby
jenrzzz has joined #ruby
danneu has joined #ruby
nomenkun has quit [Remote host closed the connection]
<mpfundstein_home> both of them generate garbage
AndChat|41600 has quit [Read error: Connection reset by peer]
Xeago has joined #ruby
<JohnTeddy> I got rid of the 'p variable' stuff, and made it just variable
rjfranco has joined #ruby
<JohnTeddy> mpfundstein_home: They clean up the zipcodes and phone numbers
mengu has joined #ruby
<JohnTeddy> At least when I run those methods individually, they output the correct results
<mpfundstein_home> yeah but if you command them out
<mpfundstein_home> 667 records are writing
<mpfundstein_home> written*
jfl0wers_ has quit [Ping timeout: 244 seconds]
nwertman has quit [Ping timeout: 255 seconds]
<JohnTeddy> 'command them out', what do you mean?
<JohnTeddy> (note, this is my biggest program I've written yet)
dmiller has quit [Remote host closed the connection]
<mpfundstein_home> comment sorry
<mpfundstein_home> why do you iterate over file
<mpfundstein_home> in clean_zipcodes?
jenrzzz has quit [Ping timeout: 264 seconds]
becom33 has quit [Ping timeout: 248 seconds]
<mpfundstein_home> JohnTeddy: this should bring u a bit forward: https://gist.github.com/4393292
C0deMaver1ck has quit [Remote host closed the connection]
<jcrawford> ok figured that out but now i have another problem. I am storing the articles in a hash by type such as "php" or "ruby" so I am doing self.articles.each { |type| type.each { |article| .... } } and i have tried the longer do method as well, however when it gets to articles it see's the string php for some reason, along with the article in the type array... {"php"=>[<Article: /articles/php//2012/12/this-is-a-test>], "ruby"=>[]}
emmanuelux has joined #ruby
<JohnTeddy> I see, I don't need to iterate
<JohnTeddy> I made each individual method separately, and was testing it
<JohnTeddy> thanks mpfundstein_home
michaelhf has quit [Remote host closed the connection]
<mpfundstein_home> u welcome
<jcrawford> here is a paste of my code: http://pastie.org/5586380
<jcrawford> if anyone could lend a hand I would appreciate it :)
nga4 has quit []
mercwithamouth has quit [Ping timeout: 265 seconds]
<melkor> Thanks for the info.
melkor has quit [Quit: leaving]
<mpfundstein_home> jcrawford: because php is an array with strings in it
<jcrawford> no php is an array of Article objects
<mpfundstein_home> than do this
<mpfundstein_home> articles.each_pair do |type, content|
<jcrawford> see the comment on the first line of the paste it shows what self.articles = when i puts it :)
<mpfundstein_home> content.send ...
<mpfundstein_home> end
<jcrawford> ok let me try that
emmanuelux has quit [Remote host closed the connection]
<jcrawford> closer but that leads to this
<jcrawford> site_extension.rb:231:in `block in post_attr_hash': undefined method `categories' for [<Article: /articles/php//2012/12/this-is-a-test>]:Array (NoMethodError)
cirwin has joined #ruby
<jcrawford> so it's got the array not the first item