drbrain has quit [Remote host closed the connection]
drbrain has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
krohrbaugh has joined #ruby-lang
KA_ has quit [Quit: KA_]
krohrbaugh has quit [Client Quit]
soypirate has quit [Quit: Leaving]
KA_ has joined #ruby-lang
mrsolo has quit [Quit: Leaving]
lsegal has joined #ruby-lang
krohrbaugh has joined #ruby-lang
KA_ has quit [Client Quit]
Spillrag has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
madhadron has joined #ruby-lang
<madhadron>
What's the easiest way to insert some text at the beginning and the end of an IO in Ruby?
kogent has joined #ruby-lang
kogent has quit [Remote host closed the connection]
kogent has joined #ruby-lang
tenderlo_ has joined #ruby-lang
tenderlove has quit [Ping timeout: 255 seconds]
sandbags has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
unlikely_monkey has joined #ruby-lang
<andrewvos>
shsjshshdjjsjsh
<CoverSlide>
what's an IO and where can I get one?
<madhadron>
CoverSlide: A File object, a StringIO...
<madhadron>
A iostream, really
<madhadron>
Or alternately, how to make Nokogiri handle multiple XML roots in a stream sensibly
<andrewvos>
CoverSlide: i got some bro
postmodern has joined #ruby-lang
cyri_ has quit [Quit: cyri_]
Bosox20051 has joined #ruby-lang
havenn has quit [Remote host closed the connection]
krohrbaugh has quit [Quit: Leaving.]
xalei has joined #ruby-lang
marr has quit [Ping timeout: 276 seconds]
wmoxam_ has joined #ruby-lang
<andrewvos>
nokogirlllll
madhadron has left #ruby-lang [#ruby-lang]
benanne has quit [Quit: kbai]
mistym has quit [Remote host closed the connection]
megha has quit [Ping timeout: 248 seconds]
havenn has joined #ruby-lang
<zenspider>
argh. maglev parser is in gemstone :/
<zenspider>
I think...
Kuifje has quit [Ping timeout: 256 seconds]
__butch__ has quit [Quit: Leaving.]
robotmay has quit [Remote host closed the connection]
gregmore_ has quit []
gregmore_ has joined #ruby-lang
gregmore_ has quit [Remote host closed the connection]
mercwithamouth has joined #ruby-lang
unlikely_monkey has quit [Remote host closed the connection]
megha has joined #ruby-lang
Spillrag has quit [Ping timeout: 252 seconds]
bluepojo1 has joined #ruby-lang
KA_ has joined #ruby-lang
bluepojo has quit [Ping timeout: 245 seconds]
tenderlo_ has quit [Remote host closed the connection]
bluepojo1 has quit [Ping timeout: 244 seconds]
nXqd has quit [Ping timeout: 255 seconds]
sush24_ has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
sush24 has quit [Ping timeout: 255 seconds]
KA_ has quit [Quit: KA_]
toretore has quit [Quit: Leaving]
drbrain has quit [Ping timeout: 256 seconds]
kentos has quit [Ping timeout: 246 seconds]
krohrbaugh has joined #ruby-lang
kentos has joined #ruby-lang
KA_ has joined #ruby-lang
charliesome has joined #ruby-lang
jtoy has quit [Quit: jtoy]
jtoy has joined #ruby-lang
kogent has quit [Remote host closed the connection]
kogent has joined #ruby-lang
sush24_ has quit [Quit: This computer has gone to sleep]
kiwnix has joined #ruby-lang
tsou has quit [Read error: No route to host]
kogent has quit [Ping timeout: 256 seconds]
Rakko has joined #ruby-lang
kiwnix has quit [Client Quit]
brianpWins has joined #ruby-lang
kiwnix has joined #ruby-lang
srbaker has joined #ruby-lang
gregmore_ has joined #ruby-lang
imajes has quit [Excess Flood]
sush24 has joined #ruby-lang
sush24 has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
imajes has joined #ruby-lang
stardiviner has joined #ruby-lang
gregmore_ has quit [Ping timeout: 252 seconds]
tylersmith has quit [Quit: tylersmith]
srbaker has quit [Quit: Computer has gone to sleep.]
dwu has joined #ruby-lang
lcdhoffman has joined #ruby-lang
<havenn>
Seems odd that if you change the capitalization of a gem name when you require it, MRI will actually reload the gem instead of returning false: require 'csv'; require 'CSV'; require 'cSv'
<havenn>
JRuby's require seems to be case-insensitive.
drbrain has joined #ruby-lang
wallerdev has joined #ruby-lang
srbaker has joined #ruby-lang
sn0wb1rd has quit [Quit: sn0wb1rd]
<havenn>
RBX's require is different than Ruby or JRuby's, returning true to varied caps. Seems to me that JRuby's behavior would be preferred?
madish has quit [Quit: ChatZilla 0.9.89 [Firefox 16.0.1/20121026125834]]
gregmore_ has joined #ruby-lang
retro|cz has joined #ruby-lang
gregmore_ has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
arooni-mobile has joined #ruby-lang
jtoy has quit [Quit: jtoy]
alvaro_o has quit [Quit: Ex-Chat]
<Rakko>
havenn: are you talking about just the situation of running various Rubys on case-insensitive file systems? Or is that true on Unix too?
srbaker has quit [Quit: Computer has gone to sleep.]
spuk has quit [Ping timeout: 276 seconds]
mpan has quit [Ping timeout: 248 seconds]
brianpWins has quit [Quit: brianpWins]
sush24 has joined #ruby-lang
dzhulk has quit [Quit: Leaving.]
<havenn>
Rakko: Good point. LoadError on Ubuntu but behavior above on OS X.
spuk has joined #ruby-lang
KA_ has quit [Quit: KA_]
KA_ has joined #ruby-lang
drbrain has quit [Remote host closed the connection]
drbrain has joined #ruby-lang
RubyGuy has joined #ruby-lang
emocakes has quit [Quit: emocakes]
jtoy has joined #ruby-lang
jtoy has quit [Client Quit]
sn0wb1rd has joined #ruby-lang
KA_ has quit [Quit: KA_]
wmoxam_ has quit [Ping timeout: 252 seconds]
<RubyGuy>
test
RubyGuy has left #ruby-lang ["Leaving"]
RubyGuy has joined #ruby-lang
<RubyGuy>
Can Someone answer this question - I want the script to continue on even when a error pops up http://pastebin.com/sZFqR2eH
<drbrain>
RubyGuy: you want to rescue Resolv::ResolvError in the loop and continue
mercwithamouth has quit [Ping timeout: 252 seconds]
kurko_ has quit [Quit: Computer has gone to sleep.]
<RubyGuy>
can you give me an example
<drbrain>
RubyGuy: also, you don't need to redefine rand, use rand(1..255)
stardiviner has quit [Read error: Connection reset by peer]
stardiviner has joined #ruby-lang
gregmore_ has quit [Remote host closed the connection]
ryanf has quit [Ping timeout: 255 seconds]
KA_ has joined #ruby-lang
evanx has joined #ruby-lang
megha has quit [Quit: WeeChat 0.3.9.2]
mercwithamouth has joined #ruby-lang
workmad3 has joined #ruby-lang
<postmodern>
how can you test whether a Net::SMTP instance has been closed?
<postmodern>
ah wait, it appears do_quit sets @started to false
mytrile has joined #ruby-lang
sepp2k has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 256 seconds]
ryanf has joined #ruby-lang
gregmore_ has joined #ruby-lang
evanx has quit [Ping timeout: 246 seconds]
earthquake has quit [Quit: earthquake]
evanx has joined #ruby-lang
stonerfish has joined #ruby-lang
gregmore_ has quit [Remote host closed the connection]
OneWhoFrogs has joined #ruby-lang
mistym has quit [Remote host closed the connection]
ryanf has quit [Ping timeout: 245 seconds]
<OneWhoFrogs>
Could someone look over this DSL for me? I'd like to know what I can improve before I start implementing it. https://gist.github.com/4640483
gjaldon has joined #ruby-lang
guns has joined #ruby-lang
ryanf has joined #ruby-lang
stonerfish has quit [Quit: Leaving.]
mytrile_ has joined #ruby-lang
mytrile has quit [Read error: Connection reset by peer]
unlikely_monkey has joined #ruby-lang
unlikely_monkey has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 246 seconds]
brianpWins has quit [Quit: brianpWins]
unlikely_monkey has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
<sandbags>
anyone have any idea why a random Ruby string might end up with spaces encoded as xC2A0 rather than x20 ?
kurko_ has quit [Ping timeout: 252 seconds]
<sandbags>
this is in the context of a Rails application although the puzzling data is in a MySQL row so i've no idea really whether Rails was involved
<sandbags>
other rows before and after the offending row seem normal
<KINGSABRI>
postmodern, It generates random chars , I thinks pattern_create is fixed sequanced chars to allow pattern_offsec determine the length , correct me
<postmodern>
KINGSABRI, look at the documentation of Chars::CharSet, it allows control the length
<KINGSABRI>
postmodern, it's going good in generating ,, now the another hand ,, get offset
apeiros_ has joined #ruby-lang
enebo has quit [Read error: Connection reset by peer]
enebo has joined #ruby-lang
<yorickpeterse>
whitequark: problem: storing AST nodes as Hash keys will result in me not being able to perform a lookup if I have a node with the same structure but with a different object ID. Is there a way to work around this?
<yorickpeterse>
Ideally I'd compare nodes based on the type, children and meta data but I'm not sure if Hash#key? and Hash#[] and the likes would work with that
banisterfiend has quit [Remote host closed the connection]
<yorickpeterse>
Hm, I suppose I could subclass Hash and modify the behaviour of Hash#[]
<yorickpeterse>
(of that subclass)
<whitequark>
yorickpeterse: hmm
<whitequark>
I guess I could precompute hashes before freezing
<yorickpeterse>
the easy but non scalable way: extract keys, use #select in combination with #==
<whitequark>
yorickpeterse: metadata won't go in hash, it is a design choice
<yorickpeterse>
that's fine for me
<whitequark>
ok. then I'll do the stuff with #hash
<yorickpeterse>
In fact, if it were I'd never get two nodes to equal each other
<yorickpeterse>
due to line numbers being stored they'd always be different
ruurd has quit [Quit: Leaving...]
<KINGSABRI>
postmodern, I can get it by index s.index(/A2A3A/)
<KINGSABRI>
=> 4
<whitequark>
yorickpeterse: but it will still require one deep comparison on each #== and lookup
<yorickpeterse>
hmm
ruurd has joined #ruby-lang
<yorickpeterse>
As long as it doesn't get balls slow I'm fine with it, I don't expect an insane amount of lookups anyway
banisterfiend has joined #ruby-lang
<whitequark>
well, now it requires one deep comparison per #==
<whitequark>
but even if the nodes are actually non-equal
<yorickpeterse>
if there was something like #object_id but it not being unique (e.g. `foo'.some_id == 'foo'.some_id # => true`) that would make this so much easier
<whitequark>
yorickpeterse: it's called #hash
<whitequark>
but it could be same for different nodes, because you have an unbounded amount of nodes but your hash space is obviously bounded
<yorickpeterse>
Interesting, it seems Hash#[] doesn't even use #==
<whitequark>
yes, it uses #eql?
* whitequark
sighs
<whitequark>
let me explain this yet again
<yorickpeterse>
oh? The C code doesn't seem to show that
<whitequark>
ruby has three comparison operators, #== (equality), #eql? (equivalence) and #equal? (identity)
mossplix has joined #ruby-lang
<whitequark>
they're mainly important due to the way the numeric tower works
<whitequark>
== is what you use, .eql? is what Hash uses, .equal? isn't used by Ruby itself, it's only for your convenience when debugging
<whitequark>
and various weird tricks.
<yorickpeterse>
if Hash#[] were to use eql? I'd expect to be able to override that method to patch it up (on my AST nodes). This doesn't seem to be the case though
<whitequark>
Hash works like this: first it effectively compares elements by their #hash, then, after it found two elements with the same #hash, it compares them with #eql?
<whitequark>
"effectively" both as in "in essence" and "fast"
<yorickpeterse>
Hm, that would explain: #hash returns different output
<yorickpeterse>
so it already bails out there
<whitequark>
#hash value should have a nice random distribution in order for the hash table to work efficiently
<whitequark>
i.e. have O(1) lookup
<whitequark>
#eql? is required because #hash values aren't unique
<whitequark>
and in fact #hash return value _must_ be a Fixnum
<Mon_Ouie>
Does it error if you return a bignum?
<yorickpeterse>
Hm, I think I have an idea
<whitequark>
Mon_Ouie: yeah
<yorickpeterse>
one that would not require to mess with eql, ==, etc
enebo has quit [Ping timeout: 256 seconds]
<whitequark>
try it yourself
<whitequark>
Mon_Ouie: hm, it doesn't, strange
megha has joined #ruby-lang
<whitequark>
well, it does truncate it internally anyway
<whitequark>
yorickpeterse: which idea?
<yorickpeterse>
gimme a sec, first need to see if it actually works
<yorickpeterse>
basically I'm just storing the definitions for each new scope. This way I can just say `current_scope.has_definition?(:local_variable, 'foo')` and I'm done
<yorickpeterse>
I needed this anyway so it's another win
<whitequark>
hm ok
<yorickpeterse>
hmmmm, maybe that I means I can even ditch the whole lookup table with AST nodes as the keys
<whitequark>
perfect
<yorickpeterse>
yes! haha
* yorickpeterse
makes a fist
megha has quit [Quit: WeeChat 0.4.0]
<yorickpeterse>
Hm, I need to write some tests for this in combination with constant paths though. But first, groceries!
megha has joined #ruby-lang
<KINGSABRI>
postmodern, PM, please?
mytrile_ has quit [Ping timeout: 256 seconds]
<postmodern>
KINGSABRI, not sure what your trying to do?
pnr has joined #ruby-lang
<KINGSABRI>
postmodern, I need to build same "String.generate" but simple one an I can control exact length