Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
<mxweas>
Harzilein .split(/suffix/, 2).first ?
Clooth joined #ruby
jimmy1980 joined #ruby
<Harzilein>
mxweas: why the 2?
<mxweas>
optimization. Once the array hits two elements it stops
<davidcelis>
return :x for summing them?
<mxweas>
so after the first split, since you're just calling .first anyway
<Harzilein>
and i forgot about first, split(/foo$/)[0] would not look nicer than sub(/foo$/){}
randym joined #ruby
looopy joined #ruby
flip_digits joined #ruby
saschaheylik left #ruby
jimmy1980 joined #ruby
saschaheylik joined #ruby
conor_ireland joined #ruby
dbgster joined #ruby
igors joined #ruby
<igors>
hello. anybody familiar with thor? I'd like to use namespaces like ./commands.rb foo:bar
mengu joined #ruby
banisterfiend joined #ruby
flip_digits joined #ruby
jbw joined #ruby
Mramaizng left #ruby
adeponte joined #ruby
ephemerian left #ruby
fantazo joined #ruby
<elijahc>
i've been googling up a storm and i can't quite figure out when to define an instance method and when to define a class method. any ideas?
<andrewvos>
elijahc: You mean as a good practice?
<elijahc>
yup
<andrewvos>
Well, when it makes sense use a class method :)
<andrewvos>
elijahc: If you don't need any values to be passed into the constructor, then you might want to use a class method.
<elijahc>
andrewvos: what if i need to pass in an array to my method?
<andrewvos>
elijahc: What are you currently doing that has made you stop and think?
oneiros_Fade joined #ruby
<elijahc>
well, i'm writing my first ruby program and I'm going to use Thread because i've got 8 cores on this box, and I need to have each core run a method, albeit with different inputs.
<andrewvos>
elijahc: So what does it do, and where are you thinking of using an instance/class method?
looopy_ joined #ruby
<RubyPanther>
elijahc: likely you should fork instead of using Thread
<macmartine_>
irb(main):020:0> Time.local("2011-12-05 17:00:00").utc => 2011-01-01 00:00:00 UTC
stepnem joined #ruby
skurt joined #ruby
mickn joined #ruby
albemuth joined #ruby
<loocorez>
Try Time.local(2011,12,05,18,16,00).utc => 2011-12-06 02:16:00 UTC
<macmartine_>
loocorez: yeah, i figure that has got to be an easier way
<macmartine_>
but that's a good backup, thanks
<loocorez>
Sorry. I need more coffee. I'm interested now, I'll keep looking
mrdodson joined #ruby
<macmartine_>
OK, I have to head home so i'll be offline for 30 min or so.
tburns joined #ruby
mikepack joined #ruby
p0y joined #ruby
<loocorez>
macmartine_: Sure thing. Looks like the time library has an rfc2822 method that can parse a string formatted differently...
igotnolegs joined #ruby
SolarisBoy left #ruby
banisterfiend joined #ruby
cdepue joined #ruby
_kinderman joined #ruby
Martz joined #ruby
roaminghorse joined #ruby
Pip joined #ruby
Pip joined #ruby
norex joined #ruby
chrisja left #ruby
sbanwart_ joined #ruby
norex joined #ruby
Martz joined #ruby
rramsden joined #ruby
tburns joined #ruby
CannedCorn joined #ruby
stephenjudkins joined #ruby
sbanwart__ joined #ruby
trivol joined #ruby
tburns joined #ruby
jinho joined #ruby
rpowell joined #ruby
frode15243 joined #ruby
omry_ joined #ruby
<jinho>
I want to do a regex in ruby 1.9 where I want to find a string that ends with a period like: "Scintigraphic evaluation of acute lower gastrointestinal hemorrhage: current status and future directions." but some of these strings can also be preceeded and end with brackets like: "[Role of multi-detector row computed tomography for localization of acute lower GI bleeding]." and I'd like to get rid of the brackets
Skaag_ joined #ruby
<jinho>
so far I have: \[?(.+)\]?\.
<jinho>
but of course that keeps the end bracket - do I have to use assertions for this case?
<jinho>
or am I being blockheaded?
jwmann joined #ruby
<jinho>
help would be much appreciated!
stephenjudkins joined #ruby
wilmoore joined #ruby
dagnachewa joined #ruby
acts_as_david joined #ruby
tobyo joined #ruby
<atmosx>
jinho: try #regexp
<atmosx>
tell them you're programming in ruby it will help
tshauck joined #ruby
stephenjudkins joined #ruby
<jinho>
atmosx: gotcha thanks
cdepue joined #ruby
Skaag joined #ruby
cjs226 joined #ruby
p0y joined #ruby
macmartine joined #ruby
Paladin joined #ruby
davidcelis joined #ruby
musee joined #ruby
esparkman joined #ruby
rickmasta joined #ruby
LittleBill902 joined #ruby
randym joined #ruby
banisterfiend joined #ruby
jimmy1980 joined #ruby
Samoi joined #ruby
Samoi joined #ruby
Samoi joined #ruby
<loocorez>
macmartine: Still looking for a solution?
<macmartine>
loocorez: looks like that kinda does it -- though I'd have to programatically get the PST in there since
crankycoder joined #ruby
<loocorez>
Yeah, like #{Time.zone} ?
<sgronblo>
Does anyone know how ruby-prof counts methods called from a block passed to a method?
mikepack joined #ruby
banisterfiend joined #ruby
<macmartine>
loocorez: Time.zone => (GMT-08:00) Pacific Time (US & Canada)
jonathan___ joined #ruby
<jonathan___>
Hi all, I'm new in Rails and I wonder what does exactly "form_for([@post, @post.comments.build]) do |f|"
<loocorez>
macmartine: Time.now.zone
ryanf joined #ruby
<jonathan___>
I understand the "form_for(@post) do |f|" but I need more explanations with the call of form_for with 2 arguments
<jonathan___>
and the meaning of the .build
<sgronblo>
jonathan___: /j #rubyonrails
<jonathan___>
yes ...
jarjar_prime joined #ruby
esparkma_ joined #ruby
iamjarvo joined #ruby
esparkman joined #ruby
maletor joined #ruby
radic joined #ruby
randym joined #ruby
Pip joined #ruby
Natch| joined #ruby
sdwrage left #ruby
skillachie joined #ruby
kevinbond joined #ruby
mxweas_ joined #ruby
esparkman joined #ruby
<shevy>
jonathan___ many people here don't know enough about rails to help you. For instance, I have no idea what the method form_for() is doing. Don't be shy to have a look at the source though!
xpot joined #ruby
looopy joined #ruby
sdwrage joined #ruby
<skillachie>
Hi , the meta method present in Ruby/gnome poppler is not in the poppler gem or I do not know how to call that method
<Davenjah>
this is the string that i love to decode
<Davenjah>
and no, it is not base64
roaminghorse joined #ruby
<shevy>
I didn't know you were not using ruby
<Davenjah>
never heard of it before
<shevy>
use PHP its better
<Davenjah>
i thought when linux guys say ruby. they mentioning someone's girlfriend
<Davenjah>
didnt know it is something can be used with linux
<shevy>
pretty much
<shevy>
you are a wise person
* fowl_mouth
sets mode: +stfu_bitch Davenjah
<Davenjah>
lol
<Davenjah>
to the maximum
<Davenjah>
.whois 118.82.185.158
<Davenjah>
opsss im not in my server :/
<Davenjah>
New Zealand
<Davenjah>
where we get meat from
<fowl_mouth>
Davenjah: stop babbling
<Davenjah>
fowl_mouth, can you export 100 of sheeps to us?
<fowl_mouth>
Davenjah: what country is that?
<Davenjah>
Dubai
<Davenjah>
i pay for anyone help me decode this --> 5ZiLHBofF8qKNINew4NUa7TPDl8pDgYbPPLi9tf6oFE=
<sdwrage>
Ruthenium: you still there?
<Ruthenium>
still here
<sdwrage>
Ruthenium: do you do any web work?
<Ruthenium>
no
luckyruby joined #ruby
<sdwrage>
I am basically trying to write a script to allow dynamic content to cut off at a certain length in a fixed height div without js or css intervening...
<sdwrage>
the + 1's are to compensate for spaces that were removed
<sdwrage>
because those act as a single space
stephenjudkins joined #ruby
<sdwrage>
basically I needed something that acts like I can cut it at a specific row based on character limit but, in the browser, if a word is too long, it drops down to another row in the paragraph. so just doing a character count wouldn't work
<sdwrage>
thats why I was creating this
<sdwrage>
I don't know how flakey it looks code wise :\
nelsnelson_ joined #ruby
<Ruthenium>
so if the word doesn't fit in the limit you want to move it to the next line?
asQuirreL joined #ruby
sarmiena_ joined #ruby
<sdwrage>
exactly
<sdwrage>
because that is what it does in the browser
<sdwrage>
Ruthenium: ^^
mk03 joined #ruby
<sdwrage>
needless to say, I need to use a monospaced font but that is fine
<sarmiena_>
how would i match all alphanumeric sequences in a given string? doing my_string.match(/[a-zA-Z0-9]+/) only returns the first occurrence
<Ruthenium>
sarmiena_: String#scan
<sdwrage>
sarmiena_: scan?
<sarmiena_>
ah i think i found it
<sarmiena_>
scan
<sarmiena_>
thanks
<sdwrage>
lol
<sdwrage>
:)
Nanuq joined #ruby
apok joined #ruby
JohnBat26 joined #ruby
_debo joined #ruby
arash joined #ruby
Azure_ joined #ruby
djdb joined #ruby
stephenjudkins joined #ruby
headius joined #ruby
smgt joined #ruby
flippingbits joined #ruby
xpot joined #ruby
stoffus joined #ruby
levity_island joined #ruby
hurikhan|Work joined #ruby
randym joined #ruby
mafolz joined #ruby
masterhumper joined #ruby
workmad3 joined #ruby
perryh joined #ruby
disappearedng joined #ruby
<disappearedng>
do you guys normally write code like this? @entries = retrieve_entries(current_user ? current_user.tags : nil)
<disappearedng>
is this "idiomatic" in ruby
<davidcelis>
that would be rails
<davidcelis>
p.s. that is a horrifically open-ended question
ph^ joined #ruby
<ryanf>
I don't know what property(s) of it you are referring to
<ryanf>
the ternary is pretty common
<ryanf>
the rest of it seems straightforward
<ryanf>
also there's nothing inherently railsy about that
<ryanf>
"current_user" isn't built into rails or anything
<davidcelis>
ryanf: it's rails
<davidcelis>
because
<davidcelis>
he's also in #rubyonrails asking about it :)
<ryanf>
haha
<ryanf>
that's cheating
Morkel joined #ruby
zommi joined #ruby
bosphorus joined #ruby
dekroning joined #ruby
adeponte joined #ruby
batlock666 joined #ruby
Seisatsu joined #ruby
Cerales joined #ruby
jamnew joined #ruby
ChampS_ joined #ruby
LittleBill902 joined #ruby
Paladin joined #ruby
workmad3 joined #ruby
pi3r joined #ruby
visof joined #ruby
adeponte joined #ruby
Mchl joined #ruby
burgestrand joined #ruby
ikaros joined #ruby
cableray joined #ruby
flippingbits joined #ruby
Helius joined #ruby
jbpros joined #ruby
pen joined #ruby
pencilcheck joined #ruby
cyri_ joined #ruby
masterhumper joined #ruby
rtdp joined #ruby
xec joined #ruby
visof joined #ruby
BiHi joined #ruby
ryanf joined #ruby
apok joined #ruby
Manhose joined #ruby
pen joined #ruby
Cerales joined #ruby
Ammar01 joined #ruby
Taos joined #ruby
<Taos>
Whats the @ in classes? instance?
<fowl_mouth>
Taos: it's indicating whether the class is private or public
<fowl_mouth>
@ means private
pencilcheck joined #ruby
<Taos>
Ewwwww public private :(
<Taos>
Im only learning ruby for completeness because I learnt python first and i have to say nothing is really jumping off the page at me
timonv joined #ruby
pen joined #ruby
jds joined #ruby
<fowl_mouth>
Taos: i was joking
<fowl_mouth>
Taos: @ indicates instance variables
SaneWarning joined #ruby
<Taos>
fowl_mouth: were you really joking >.>
ChampS_ joined #ruby
<Taos>
You still have public private and that is evilllll
<fowl_mouth>
Taos: Almost every single object oriented language has private/public
<Taos>
Its an evil concept and ill be happy when everyone gives up being a stickler
roaminghorse joined #ruby
mutable joined #ruby
<mutable>
Hi. I'm trying to figure out where are gems installed by 'gem install ...' kept in Fedora. How can I find it please?
<fowl_mouth>
Taos: Why is it an evil *concept* ?
jbpros joined #ruby
elliot98 joined #ruby
<mutable>
it's 'gem which'
mutable left #ruby
heftig joined #ruby
<shevy>
Taos, @foo is an instance variable. You use it to store data that you want to fetch, use modify
<fowl_mouth>
Taos: the idea of differentiating between public and private interface is sound and is one of the cornerstones of OO
james_cotterill joined #ruby
ephemerian joined #ruby
nicoulaj joined #ruby
pen joined #ruby
stephenjudkins joined #ruby
mxweas_ joined #ruby
Morkel joined #ruby
sarmiena_ joined #ruby
michael_mbp joined #ruby
pen joined #ruby
Manhose_ joined #ruby
ikaros joined #ruby
roaminghorse joined #ruby
fritzthecat_ joined #ruby
gregorg joined #ruby
gregorg joined #ruby
Quadlex joined #ruby
fowl_mouth joined #ruby
Locke23rus_ joined #ruby
adambeynon joined #ruby
_debo joined #ruby
Helius1 joined #ruby
EddieS joined #ruby
Locke23rus joined #ruby
ognevsky joined #ruby
Pip joined #ruby
Pip joined #ruby
trivol_ joined #ruby
JumpMast3r joined #ruby
sejo joined #ruby
tatsuya_o joined #ruby
Locke23rus joined #ruby
andreas__ joined #ruby
Locke23rus joined #ruby
ognevsky joined #ruby
Ch4rAzZz joined #ruby
mxweas_ joined #ruby
jimmy1980 joined #ruby
kalusn joined #ruby
mengu joined #ruby
pen joined #ruby
stephenjudkins joined #ruby
josephwilk joined #ruby
ramusara joined #ruby
looopy joined #ruby
vitoravelino joined #ruby
tk_ joined #ruby
stephenjudkins joined #ruby
fl0w joined #ruby
enikar joined #ruby
jensn joined #ruby
ChampS_ joined #ruby
Shamgar joined #ruby
iocor joined #ruby
<Axsuul>
Is there a way to define a method for +=
<Ruthenium>
+= is just a + and assignment
<Axsuul>
Yea but is there a way to define a method for a class that utilizes +=, for example I can define a method for +
<Ruthenium>
+= just calls + method
<Ruthenium>
then assigns result
<fowl_mouth>
Axsuul: self.x += 10 is the same as: self.x=(self.x + 10)
<Axsuul>
ah thanks
<fowl_mouth>
well, self.x=(self.x().+(10)
<Ruthenium>
self.x=self.x.+ 10
rpowell joined #ruby
<fowl_mouth>
Ruthenium: what's up
<Ruthenium>
nothing to see here
<fowl_mouth>
Ruthenium: u seem like a nice girl
jimmy1980 joined #ruby
<Ruthenium>
am not
gmci joined #ruby
p1d joined #ruby
MAD joined #ruby
<MAD>
Hello everybody…
_debo joined #ruby
fermo joined #ruby
bjhaid joined #ruby
dleedev joined #ruby
workmad3 joined #ruby
<shevy>
Axsuul you can at least define + class Test; def +(i); puts "Adding #{i}."; end; end; test = Test.new; test + 'Hello World' # => "Adding Hello World."
dleedev left #ruby
Morkel joined #ruby
trivol joined #ruby
michael_mbp_ joined #ruby
naftilos76 joined #ruby
awesome_ joined #ruby
Muz joined #ruby
bjhaid joined #ruby
pencilcheck joined #ruby
Locke23rus joined #ruby
pen_ joined #ruby
siddick joined #ruby
jimmy1980 joined #ruby
cdepue joined #ruby
ikaros joined #ruby
clockwize joined #ruby
crimzon joined #ruby
ognevsky joined #ruby
nemski joined #ruby
<nemski>
hi
randym joined #ruby
nari_ joined #ruby
crimzon left #ruby
<nemski>
can someone explain to me why this http://pastie.org/2974333 returns an error on the second call to 'a.each'
<Ruthenium>
what error?
<nemski>
test.rb:5: undefined method `each' for :IP:Symbol (NoMethodError)
<nemski>
so why does the to_s only work the first time
rohit joined #ruby
excelsio1 joined #ruby
fl0w joined #ruby
nlko joined #ruby
<nlko>
what is the best pdf generator in ruby?
<nlko>
im looking at prawn and sme princexml at the moment
<nlko>
am i overlooking anything?
skillachie joined #ruby
Manhose joined #ruby
saschaheylik joined #ruby
<shevy>
nemski for whatever reason, the object where .each is run, is a Symbol
<shevy>
you'd prefer an array usually for .each
<nemski>
yeah the last element
<nemski>
it's an IP address
<shevy>
isn't an IP Address a string?
<shevy>
nemski what version of ruby do you run
<shevy>
works for me without an error
<nemski>
1.8.7
<shevy>
same here
<shevy>
print "#{a} = #{v}\n" shorter would be puts "#{a} = #{v}" btw
<nemski>
are you require ing any libs
gregorg joined #ruby
gregorg joined #ruby
<shevy>
nope
<shevy>
"a" is a hash
<shevy>
works here
<nemski>
yep
<shevy>
:)
<nemski>
weeeird
<nemski>
OS?
<shevy>
linux, knoppix
<shevy>
but it doesnt matter, the code you have on the pastie works in ruby nemski
<heftig>
nemski: this will work in 1.9, but not 1.8
<heftig>
you reuse the variable "a" within the block
<heftig>
don't do that if you want to be compatible with 1.8
<shevy>
oh
<shevy>
indeed he does
<nemski>
stupid debian is always behind
<shevy>
nemski, it's not good to use the same names
<nemski>
i just came across it playing with irb
nari_ joined #ruby
<nemski>
silly me
dazoakley joined #ruby
Pip joined #ruby
xissburg joined #ruby
xissburg joined #ruby
vmatiyko joined #ruby
adambeynon joined #ruby
Shrink joined #ruby
ChampS_ joined #ruby
xissburg joined #ruby
hinogi joined #ruby
hinogi joined #ruby
Indian joined #ruby
vmatiyko left #ruby
<xissburg>
how to define ++ operator?
sepp2k joined #ruby
<nemski>
def ++(var) var += var end ?
vmatiyko joined #ruby
vmatiyko left #ruby
xhx joined #ruby
<nemski>
i would have no idea
vmatiyko joined #ruby
vmatiyko left #ruby
<Tasser>
nemski, won't work, because you can't define macros
<Tasser>
ehh xissburg ^
<xissburg>
?
<shevy>
xissburg does not work in ruby
<xissburg>
not possible
<xissburg>
?
<shevy>
yes. not possible.
zmanfx joined #ruby
<rohit>
Can't you define that method in the Kernel module?
clockwize joined #ruby
fridim_ joined #ruby
<rohit>
oh you can't define a method named ++
<Tasser>
xissburg, learn some lisp and the difference between macro and function :-P
<xissburg>
yea
nlko left #ruby
fetimo joined #ruby
<sie>
Does ruby have some XML parsing libraries by default?
<Tasser>
sie, install the nokogiri gem
<Tasser>
how do I get the current namespace in Rake?
randym joined #ruby
<shevy>
sie you have a funny nick
araujo joined #ruby
<shevy>
I find Makefiles easier to understand than Rakefiles :)
<Tasser>
yeah, Rake is a PoS :-/
<Tasser>
but well, it does get shit done
<Tasser>
I'll probably use something else later on
<shevy>
hmm what are you doing with rake?
<Tasser>
creating indexes with lucene / generating relevancy scores from them
Morkel joined #ruby
<sie>
Is nokogiri fast/fastest?
<Tasser>
sie, kind of
<sie>
shevy - Also, check the wave generator I made. It doesn't create WAVs(yet), but it's prettay! (check the .rb's ending)
<sie>
And tell me how shitty it is.
<Tasser>
shevy, I'll probably switch to thor if I need some metaprogramming
<shevy>
wave generator where?
kalusn joined #ruby
<shevy>
Tasser I think the only piece of metaprogramming I did so far which I liked was
RichieEvans joined #ruby
<shevy>
CONFIG.some_option
vitoravelino joined #ruby
vitoravelino joined #ruby
<shevy>
which is basically a sugared hash... CONFIG['name_of_key']
<derchiller>
if i use put the following string, i got the right character of it: "\u{0434}"
<derchiller>
so u may convert the "\u0434" string to "\u{0434}"
<ggtoo>
derchiller: how would i do that?
_debo joined #ruby
ChampS_ joined #ruby
emmanuelux joined #ruby
tommyvyo joined #ruby
d3c joined #ruby
<derchiller>
hard to find it out without the content of the file. i also was wrong and it isn't neccessary to make the characters looks like '\u{0430}' -> http://pastebin.com/7sw48DZV
<derchiller>
@ ggtoo
nanderoo joined #ruby
Synthead joined #ruby
<ggtoo>
derchiller: the file xml file contains onlye \u0456\u..., i wanted to replace those with the actual characters you just showed. If i read from file i read \u0344 string not the actual character.
<koala_man>
does rubyzip support reading a zipfile without modifying it? are there any libs that do?
RomD` joined #ruby
gearaholic joined #ruby
linoj joined #ruby
yekta joined #ruby
dyer joined #ruby
jimmy1980 joined #ruby
dv310p3r joined #ruby
fetimo_ joined #ruby
yfeldblum joined #ruby
notbrent joined #ruby
bwright joined #ruby
ChampS_ joined #ruby
Shrink joined #ruby
jtrudeau joined #ruby
<derchiller>
ggtoo: thats the only solution i've found so far. i'm sure that there's a solution which is more elegant, but i can't find it: http://pastebin.com/FeVhiHMJ
amacgregor joined #ruby
jensn joined #ruby
<ggtoo>
derchiller: Thank you very much. This is what i wanted. Wow.
jbrokc joined #ruby
cdepue_ joined #ruby
excelsior joined #ruby
gmci joined #ruby
jbrokc left #ruby
csavola joined #ruby
<derchiller>
gladly
_debo joined #ruby
_kinderman joined #ruby
tatsuya_o joined #ruby
jimmy1980 joined #ruby
bwright joined #ruby
michael_mbp joined #ruby
Ammar01 joined #ruby
cyri_ joined #ruby
radic joined #ruby
Clooth joined #ruby
hechien joined #ruby
wookiehangover joined #ruby
bwright joined #ruby
heftig joined #ruby
theRoUS joined #ruby
mitchty joined #ruby
netzapper joined #ruby
mkulke joined #ruby
<netzapper>
so I'm hacking on my DSL for graphics fx in a game. I'm trying to figure out how I can get a block to close both over the instance variables of the object of the method that's defining the block, and over the instance methods (though not necessarily variables) of the class that the block is instance_exec'd inside.
iamjarvo joined #ruby
<netzapper>
if I use local variables instead of @variables, things work fine. Do I really need just just do "local_var = @instance_var" and refer to "local_var" inside my blocks?
dazoakley joined #ruby
moshef joined #ruby
evantravers joined #ruby
bbttxu joined #ruby
v0n joined #ruby
enroxorz joined #ruby
enroxorz joined #ruby
Davenjah left #ruby
moondiamond_ joined #ruby
ceej joined #ruby
evantravers joined #ruby
Indian joined #ruby
moondiamond_ joined #ruby
adambeynon joined #ruby
vtr joined #ruby
omry_ joined #ruby
wmoxam joined #ruby
jgarvey joined #ruby
xhx joined #ruby
PaciFisT joined #ruby
rippa joined #ruby
jimmy1980 joined #ruby
frem joined #ruby
<shevy>
netzapper what
<shevy>
show code on pastie pls
axl_ joined #ruby
sbanwart joined #ruby
bier|tp joined #ruby
nonotza joined #ruby
conor_ireland joined #ruby
ixti joined #ruby
sandstrom joined #ruby
<mkulke>
hello, i have a string which is an xml string plus a custom string appended
nari_ joined #ruby
bier joined #ruby
<mkulke>
i get rid of the appended string when doing 'awk "/<*>/"'
<mkulke>
how would i do that w/ ruby regexps?
notbrent joined #ruby
dotnull joined #ruby
<derchiller>
mkulke: if string =~ /(.*)<.*?>/ then result = $1.to_s end
pen joined #ruby
<derchiller>
u may also want to use the string.match() or string.scan() method
Targen joined #ruby
<mkulke>
derchiller: yeah, it kind of works (altho i need the xml, and the appended non-xml string to be thrown away)
macmartine joined #ruby
<mkulke>
but i have the problem, that using this regexp i get: "<?xml version="1.0" encoding="UTF-8"?>"
<mkulke>
which is kind of right
<mkulke>
if content =~ /(<.*?>).*/ then content = $1.to_s end
<derchiller>
if u want to use regular expressions, thats the options u may want to use. but if u want to parse the xml file u may want to use a class, not a regular expression
g0bl1n joined #ruby
theRoUS joined #ruby
theRoUS joined #ruby
<mkulke>
i get an output from an app which is appended w/ a more or less random string (not easy to cut out).
<mkulke>
like "<a.....z>\nblabla"
<mkulke>
i do parse the xml
<mkulke>
but i need to cut the frigging stuff at the end of the app
xhx joined #ruby
<mkulke>
err the app result string
<derchiller>
can't help u out there. building up the regexp is your job :) but, if your source is always valid xml, u may want to try out REXML or XmlSimple
<mkulke>
i DO use rexml
<mkulke>
i just wonder whether i can replace the ugly awk call
<derchiller>
:)
<mkulke>
right now my call is: %x{java -jar nagios_to_xml.jar #{filename} | awk "/<*>/"}
<mkulke>
works great
<mkulke>
but its ugly
theRoUS joined #ruby
<derchiller>
yes, that looks like the sourcecode of a bash script, but not ruby ^^
<mkulke>
*then* i can parse it w/ xml
<mkulke>
rexml
<mkulke>
i guess i could basically search for the last ">" and chop everything off from that on
<ccooke>
hmm. Anyone know if puppet is stable on Rubinius? Can't seem to find online.
cdepue joined #ruby
<derchiller>
should be possible
<Tasser>
ccooke, run the test suite on rubinius and see what ahppens
looopy joined #ruby
<mkulke>
(and pray that the app will never output a string containing >)
<mkulke>
ah whatever
<derchiller>
mkulke: u can use String.sub or String.sub! resp. String.gsub
_kinderman joined #ruby
<derchiller>
with regular expressions to remove an unwanted string also
<mkulke>
derchiller: exactly. but what would be a regexp for a non "< >" enclosed string?
<derchiller>
replace /<.*?>/ with an empty string -> String.gsub(/<.*?>/, '')
<mkulke>
that would throw away the xml
Ankhers joined #ruby
<mkulke>
not the non-xml string
<derchiller>
may gsub(/>.*?</, '') ?
<mkulke>
neither :)
<derchiller>
may gsub(/>(.*?)</, '') ?
<derchiller>
should work IMHO
<mkulke>
no, it doesn't. i am beginning to doubt it's possible at all
bjhaid left #ruby
<derchiller>
everything is possible
<mkulke>
not with regexp
<mkulke>
its not a parser
<derchiller>
it may be one
<derchiller>
depends on the pattern
<mkulke>
i thought there was a logical limitiation
<derchiller>
not every problem is solvable with the use of only regular expressions, thats right
<derchiller>
but regexp helps. but u're free to try it another way also
<yekta>
Somehow with some setting I've set in my environment I have lost the ability to (option + left) to jump left over words in IRB and rails consoles. Instead of going left it gives me [D for option + left and just 'D' for CTRL+left. Anyone have any ideas for what setting might be messing that up?
ckrailo joined #ruby
<macmartine>
If I store a timezone in a variable - "Pacific Time (US & Canada)" how can I get the 3 abberviated name? ie. PST
pootpoot joined #ruby
mensch joined #ruby
perturbedpanda joined #ruby
csavola joined #ruby
jwmann joined #ruby
MAD joined #ruby
p0y joined #ruby
<derchiller>
yekta: sounds like a terminal problem
vladyn joined #ruby
<derchiller>
macmartine: use a table for comparison. but sadly i can't help u finding one
albemuth joined #ruby
jimmy1980 joined #ruby
jensn_ joined #ruby
zerofool2005 joined #ruby
envygeeks joined #ruby
axl__ joined #ruby
Narcissus joined #ruby
Narcissus joined #ruby
omry_ joined #ruby
<Narcissus>
Can anyone explain why, when I am using rails 3.0.9 with ruby 1.8.7, I get the error on line 7? http://pastebin.com/rnSdiKWB
enikar joined #ruby
axl__ joined #ruby
<envygeeks>
Narcissus: does your Gemfile declare and explicit version of rake?
<Narcissus>
nope
axl_ joined #ruby
<envygeeks>
or does it declare rake without a version
<dch4pm4n>
Narcissus: Use bundle exec rake db:migrate
<dch4pm4n>
or rvm get latest if you have rvm installed and you won't have to run bundle exec
<Narcissus>
dch4pm4n: can you explain why it did that?
<Narcissus>
envygeeks: it doesn't declare rake at all
<dch4pm4n>
I am not 100% but my theory is that it's trying to use different gemsets
LiquidInsect joined #ruby
<Narcissus>
ah okay, that seems to be quite a big annoyance with ruby (to me), there are so many different versions available it's difficult to know what I should be using where
<yekta>
derchiller: well it does work when I ssh into production servers
<Taos>
Anyone here had experience with MySQL Workbench, I want opinion not help
<dch4pm4n>
Narcissus: it is annoying. I use a different gemset with every new project and have no gems in my default gemset. This was there are no conflicts by putting everything in the default global gemset (i.e. the problem you've just experienced)
<dch4pm4n>
s/was/way/
<envygeeks>
same reason I had to finally cave in and modify rbenv to work without a custom shebang and use it to manage custom gemsets
<envygeeks>
bundler gets annoying for development :(
<dch4pm4n>
indeed
vtr joined #ruby
shevy joined #ruby
ckrailo joined #ruby
pwelch left #ruby
tobym joined #ruby
<yekta>
Taos: works great for me
yfeldblum joined #ruby
JumpMast3r joined #ruby
frem joined #ruby
mikepack joined #ruby
xissburg joined #ruby
io_syl joined #ruby
io_syl joined #ruby
Manhose joined #ruby
nelsnelson joined #ruby
ChampS_ joined #ruby
_kinderman joined #ruby
ikaros joined #ruby
csavola joined #ruby
<Taos>
yekta: can I have more than that
<Taos>
yekta: do you ever do ERD diagrams in it?
<shevy>
hmm
<shevy>
what is an easy way to use Readline for multi-line input
<envygeeks>
mztriz: I think it would be better to do line =~ /regex/ then use $1 and $2 would probably save a couple of lines since you could do something like /^([0-9]+)\s(.*)/ => $1 $2
<envygeeks>
well \s+ would probably work out better :P
<sodani1>
hello, if I do [].inject, inject is defined by the enumberable module correct? How can I know that this is defined by enumberable and not class Array?
symb0l joined #ruby
<envygeeks>
sodani1: type ri Array#inject and it will tell you where it's defined (for example for inject it says it's defined by enumerable)
<mztriz>
envygeeks: thanks I'll give that a try :)
<RedGoesFasta>
or
<ccooke>
sodani1: well, you can call [].method(:inject): => #<Method: Array(Enumerable)#inject>
<RedGoesFasta>
Array.instance_method(:inject)
<sodani1>
hmm, ri Array works for me but ri Array#inject does not. I'm getting a return that Nothing is know about Array#inject
asuka_ joined #ruby
<sodani1>
[].method(:inject) seems to do the trick though. thanks
<sodani1>
I wonder why ri Array#inject isn't finding anything
SaneWarning joined #ruby
<ccooke>
sodani1: works in ri on 1.9.x, doesn't work on 1.8.x
<envygeeks>
I did my ri on 1.9.2p290 with built in ri if that helps
<RevDrSpectre7>
I am having a really hard time getting libv8 and therubyracer installed on BSD
<deryldoucette>
envygeeks: thank you on that ruby-debug19 link. I'll also pass it on to mpapis and see if we can't get better rvm specific support as well.
<deryldoucette>
looked like someone was doing the same with rbenv (if i read that right)
wwzd left #ruby
<Algorith>
hmm, I'm probably doing something horribly wrong here... does all computation in a recursive def in ruby not stop when 'return' gets called?
axl_ joined #ruby
axl__ joined #ruby
<sie>
return just returns value from a function. All recursive functions must be stopped with some condition. if arg == 0 then return x else the_func arg * 3 end
crankycoder joined #ruby
omry_ joined #ruby
randym_ joined #ruby
<Harzilein>
hmm
Squarepy joined #ruby
thepix joined #ruby
tatsuya_o joined #ruby
_debo joined #ruby
rickmasta joined #ruby
omry_ joined #ruby
badabim_ joined #ruby
flip_digits joined #ruby
AutoMan joined #ruby
<alex__c2022>
anyone ever run into an issue like this? RegexpError in xxx unmatched (: /^(E\373\307\237$\227\016\t\204\^Ez\357(E\005)+/ ?
<alex__c2022>
could it be I/O related?
Squarepy joined #ruby
sbanwart joined #ruby
p1d joined #ruby
gearaholic joined #ruby
<gearaholic>
How can i get the mime-type of a file?
DemonWitch joined #ruby
grekko joined #ruby
rramsden joined #ruby
GreaseMonkey joined #ruby
philcrissman joined #ruby
_md joined #ruby
jay_zawrotny joined #ruby
apok_ joined #ruby
zastaph joined #ruby
iocor joined #ruby
<billy_ran_away>
Anyone familiar with Differ? How can I get it to only show differences?
smgt joined #ruby
skammer joined #ruby
<billy_ran_away>
Got it! Differ.format = :color; Differ.diff_by_line(string1, string2).to_s.lines.each { |line| puts line if line.include? "\e" }
cooper joined #ruby
<tightwork>
ruby on windows is a mess wth?
nadirvardar joined #ruby
_debo joined #ruby
<Asher>
windows is a mess
<yxhuvud>
so is everything else
<yxhuvud>
just a matter of degree
looopy joined #ruby
atmosx joined #ruby
luke-- joined #ruby
hadees joined #ruby
g0bl1n joined #ruby
manizzle joined #ruby
saschaheylik joined #ruby
renanoronfle joined #ruby
Axsuul joined #ruby
ephemerian joined #ruby
muraii joined #ruby
kevinbond joined #ruby
<muraii>
This perhaps belongs in #cygwin, but it seems to fit #ruby better. I've installed Ruby 1.8.x via cygwin's installer, and RubyGems 1.8.x via "ruby setup.rb". I've since compiled Ruby 1.9.x and I *think* I need to remove the separate RubyGems installation.
axl_ joined #ruby
<muraii>
Trying to set up Jekyll, but I think the error I'm getting is due to Ruby/RubyGems version. I'd like to remove the separate RubyGems install, but setup.rb doesn't seem to have an option for that.
<muraii>
What's the best way to proceed?
axl_ joined #ruby
Bonkers joined #ruby
strife25 joined #ruby
conor_ireland joined #ruby
hadees joined #ruby
jensn joined #ruby
sdwrage joined #ruby
bosphorus joined #ruby
demian`_ joined #ruby
bafilius joined #ruby
g0bl1n joined #ruby
fayimora joined #ruby
Knodi joined #ruby
cableray joined #ruby
luckman212 joined #ruby
burgestrand joined #ruby
Morkel joined #ruby
adeponte_ joined #ruby
skinnymuch joined #ruby
<Morkel>
What is the best gem to build a webscraper? mechanize, capybara or s.th else?
csavola joined #ruby
workmad3 joined #ruby
michael_mbp joined #ruby
<burgestrand>
Morkel: no idea, sorry. I mean, I use capybara daily but it’s only to drive my tests.
p1d joined #ruby
kf8a joined #ruby
<Morkel>
burgestrand: i use it too for this case. But i dont know how usefull it is as scraper :-)
CannedCorn joined #ruby
_debo joined #ruby
<SegFaultAX|work>
Is there a hash method to merge/update one hash into another without generating any new keys.
<SegFaultAX|work>
Only update existing keys.
iocor joined #ruby
ChampS_ joined #ruby
<shadoi>
Morkel: scrubyt is built for it
<shadoi>
not sure how up to date it is though
<Morkel>
shadoi: thanks but scrubyt is only 'Hpricot and Mechanize on steroids'
ikaros_ joined #ruby
rpowell joined #ruby
rpowell joined #ruby
s0ber joined #ruby
y3llow joined #ruby
nelsnelson_ joined #ruby
quest88 joined #ruby
<muraii>
Not bumping, per se, but curious: what's the best way to uninstall RubyGems 1.8.x in cygwin? I assume that's necessary upon installing Ruby 1.9.x.
_solomon joined #ruby
workmad3 joined #ruby
senj joined #ruby
jbpros joined #ruby
sandstrom joined #ruby
_debo joined #ruby
_debo_ joined #ruby
_debo__ joined #ruby
adeponte joined #ruby
jrist joined #ruby
trivol joined #ruby
pen joined #ruby
Ch4rAzZz joined #ruby
<shevy>
rm -rf *
<shevy>
rip it apart!
<shevy>
out with the bad
_debo joined #ruby
_debo joined #ruby
developish joined #ruby
sbanwart_ joined #ruby
tburns_ joined #ruby
kaneda joined #ruby
jimmy1980 joined #ruby
nelsnelson joined #ruby
_debo_ joined #ruby
skrewler joined #ruby
bosphorus joined #ruby
sbanwart__ joined #ruby
luckyruby joined #ruby
apucacao joined #ruby
apok joined #ruby
skrewler_ joined #ruby
s0ber joined #ruby
y3llow joined #ruby
y3llow joined #ruby
_kinderman_ joined #ruby
root joined #ruby
roadze joined #ruby
iocor joined #ruby
iocor joined #ruby
Manhose joined #ruby
avandendorpe left #ruby
Rango joined #ruby
timonv joined #ruby
jimmy1980 joined #ruby
btanaka joined #ruby
kennethreitz joined #ruby
_kinderman joined #ruby
axl__ joined #ruby
AutoMan left #ruby
emmanuelux joined #ruby
timonv joined #ruby
minijupe joined #ruby
ion- joined #ruby
robyonrails joined #ruby
gmci joined #ruby
workmad3 joined #ruby
<ion->
how can i get a repl that stays alive in the same scope as a script?
<csavola>
ion-: like starting irb and requiring the script file?
<ion->
csavola: yes. do i need to export objects somehow to access them?
<ion->
i suppose i can look it up. didnt think about making it as if it was a module
sbanwart__ joined #ruby
cableray joined #ruby
strife25 joined #ruby
<csavola>
ion-: it depends on what you mean by "script" all a require does is load the file and make sure it's only done once
Cervajz joined #ruby
iocor joined #ruby
<ion->
csavola: i just want to poke around in this simple test script. it pops a json string from redis and at that point i want to use the interactive interpreter
<ion->
i was thinking there might be trick like python -i
<csavola>
ion-: sounds like you want a debugger like ruby-debug
<envygeeks>
why are the exceptions being suppressed by the original raise?
<Afal>
burgestrand: wow whoever made that pry tool must be a really cool guy ;)
<burgestrand>
Afal: not me, even though our names are similar, but yes he is :)
<shadoi>
banisterfiend yeah?
<envygeeks>
yes
<Afal>
erk >_<[1~
<shadoi>
envygeeks: that makes my eyes bleed
<shadoi>
envygeeks: isn't raise a keyword?
<envygeeks>
the keyword is an alias to Kernel#raise
looopy joined #ruby
<envygeeks>
Sorry Kernel.raise
<shadoi>
ah.. yeah it's not reserved
jimmy1980 joined #ruby
<shadoi>
hmm… beyond me.
randym joined #ruby
<envygeeks>
yeah i tripped me up at first when I saw that there were suppressed exceptions but there is nothing in the bundler source suppressing them :S
Jelco_ joined #ruby
nelsnelson joined #ruby
billy_ran_away joined #ruby
stephenjudkins joined #ruby
<fowl_mouth>
envygeeks: you're only defining a singleton method on Kernel
<fowl_mouth>
you need to redefine the instance method
<envygeeks>
fowl_mouth: raise works on Kernel.raise
<envygeeks>
that is not the problem
<fowl_mouth>
are you sure? im pretty sure it's just a module_function
<fowl_mouth>
let me check
<envygeeks>
yes I'm sure because I've been using it :|
<envygeeks>
if it didn't work it wouldn't have printed out the *args either when I ran rake pry ;)
<fowl_mouth>
you're note defining 'raise' on the singleotn class
<fowl_mouth>
not*
<fowl_mouth>
nm
pootpoot left #ruby
<envygeeks>
you're right
<envygeeks>
lol
<envygeeks>
I just noticed that too
<shadoi>
fowl_mouth: aha! trying to hide from your hordes of fans now?
<epitron>
shhhh
<shadoi>
lol
root joined #ruby
<envygeeks>
fowl_mouth: that's not the issue anyways the issue is the fact that there are random suppressions of raises in Kernel#raise
<fowl_mouth>
hehe bbs
<envygeeks>
but I have feeling this could be a rescue in a rescue without an explicit return
kevinbond joined #ruby
<shadoi>
envygeeks: I was just thinking of a place where I did that, and it bit me.
<shadoi>
I didn't realize it was suppressing the actual exception though
<shadoi>
possible
<envygeeks>
I might just file a ticket on bundler and call it a day since it's really his problem and this could be the source of quite a few slow downs I've been having with bundler
<envygeeks>
I don't have time :P since this project I'm working on with bundler is for a much larger project and we can live with slow startup times
emptyflask joined #ruby
<macmartine>
I'm getting this error when I go to my app locally with Passenger on Apache. You can see it's caused by pointing to a gem directly on :git and apache/passenger can't find it. I found some mentinos of some approaches but they aren't working. Here's what I have and the error https://gist.github.com/1440521 any ideas?
<macmartine>
sorry, wrong room :/
namidark joined #ruby
samuel02 joined #ruby
michaelbarton joined #ruby
<michaelbarton>
I'm struggling to compile 1.9.3 on OS X lion. I'm NOT using xcode but instead the recommended osx-gcc package that can be downloaded. There error I'm getting is outlined here: https://gist.github.com/1362382
dagnachewa joined #ruby
<michaelbarton>
There is a similar issue for this on the RVM github repo: http://bit.ly/rYpRGS
Seisatsu joined #ruby
cooper joined #ruby
axl_ joined #ruby
tomzx joined #ruby
h4mz1d joined #ruby
davidcelis joined #ruby
p1d joined #ruby
<dekroning>
how can I print the hex value of first character in a string, e.g. "abc"[0] because now it's returning the decimal value of the ascii table (ruby 1.8.7)
robyurkowski joined #ruby
fetimo joined #ruby
apok_ joined #ruby
nari_ joined #ruby
fetimo__ joined #ruby
raythecat joined #ruby
fetimo___ joined #ruby
<blueadept>
is there a way to get rails to recompile css without restarting the app using the asset pipeline?
p1d joined #ruby
fetimo_ joined #ruby
statbot joined #ruby
skrewler joined #ruby
fixl joined #ruby
<epitron>
dekroning: yeah, string[n] gives you the ascii value
<epitron>
string[n..n] gives you a 1-character string
<epitron>
you can also do: string.each_char { |str| str == a one char str }
<epitron>
i hope you're not doing character-at-a-time parsing though
<epitron>
that's bad!
<epitron>
ruby has much better ways of parsing strings