Doobie has quit [Remote host closed the connection]
Doobie has joined #ruby-lang
RomyRomy has quit [Quit: RomyRomy]
RomyRomy has joined #ruby-lang
RomyRomy has quit [Client Quit]
th3g33k has left #ruby-lang [#ruby-lang]
joekarma has quit [Quit: joekarma]
stardiviner is now known as nagato
eddified has joined #ruby-lang
<eddified>
Hello, I'm learning ruby. I'd like to convert an enumerable (or an enumerator obtained via Enumerable.each) into an array. I can do this by handing 'each' a block that constructs the array, but I figure there's probably a better way to do it. Help?
paulp has quit [Remote host closed the connection]
dhruvasagar has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
brianpWins has quit [Quit: brianpWins]
banisterfiend has joined #ruby-lang
eddified has quit [Quit: Leaving.]
rippa has quit [Ping timeout: 255 seconds]
s0ra_h is now known as sora_h
paulp has joined #ruby-lang
savage- has quit [Remote host closed the connection]
sora_h is now known as s0ra_h
s0ra_h is now known as sora_h
havenn has joined #ruby-lang
knu has quit [Remote host closed the connection]
havenn has quit [Ping timeout: 244 seconds]
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
dc5ala has quit [Quit: Ex-Chat]
dc5ala has joined #ruby-lang
rue has quit [Ping timeout: 264 seconds]
dhruvasagar has quit [Ping timeout: 250 seconds]
savage- has joined #ruby-lang
dhruvasagar has joined #ruby-lang
snorkdude has joined #ruby-lang
snorkdude has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 252 seconds]
dhruvasagar has joined #ruby-lang
lldong has joined #ruby-lang
setmeaway has joined #ruby-lang
chimkan has joined #ruby-lang
jimmy1980 has joined #ruby-lang
savage- has quit [Remote host closed the connection]
eboaz has quit [Quit: ircII EPIC4-2.10.1 -- Are we there yet?]
savage- has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 264 seconds]
jakko has joined #ruby-lang
Elihu5991 has joined #ruby-lang
savage- has quit [Remote host closed the connection]
<erikh>
man I really want to go to kaigi
NameName has joined #ruby-lang
Elihu5991775 has joined #ruby-lang
jtoy has joined #ruby-lang
NameName has quit [Ping timeout: 245 seconds]
outsmartin has joined #ruby-lang
knu has joined #ruby-lang
gregmore_ has joined #ruby-lang
ryanf has quit [Quit: leaving]
gregmoreno has quit [Ping timeout: 264 seconds]
dhruvasagar has joined #ruby-lang
heftig has quit [Ping timeout: 245 seconds]
Elihu5991775 has quit [Quit: irc2go]
jakko_ has joined #ruby-lang
heftig has joined #ruby-lang
jakko has quit [Ping timeout: 264 seconds]
Shvillr has quit [Read error: Connection reset by peer]
faces has joined #ruby-lang
facest has quit [Read error: Connection reset by peer]
ruurd has joined #ruby-lang
rhalff has joined #ruby-lang
jtoy has quit [Quit: jtoy]
Elihu5991 has quit [Ping timeout: 245 seconds]
ruurd has quit [Quit: Leaving...]
qwerxy has joined #ruby-lang
ruurd has joined #ruby-lang
Lux___ has quit []
towski has quit [Remote host closed the connection]
jakko_ has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 255 seconds]
jakko_ has joined #ruby-lang
dhruvasagar has joined #ruby-lang
rue has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 264 seconds]
fgomez has quit [Ping timeout: 255 seconds]
<erikh>
ha ha! my process manager is supervising daemons!!!!
chimkan has quit [Quit: chimkan]
<rue>
Yay for
chimkan has joined #ruby-lang
qwerxy has quit [Quit: offski]
<erikh>
now I just need to rig up a control socket and a control tool.
chimkan has quit [Client Quit]
paulp has quit [Remote host closed the connection]
<erikh>
rue: any chance I could get a code review from you?
<erikh>
well, it was worth as hot
outsmartin has quit [Quit: Leaving.]
Leeky_afk is now known as Leeky
solars has joined #ruby-lang
setmeaway has quit [Read error: Connection reset by peer]
nagato has joined #ruby-lang
shevy has joined #ruby-lang
qwerxy has joined #ruby-lang
Criztian has joined #ruby-lang
<tubbo>
ugh having a really frustrating issue over here... "cannot load such file -- vcr/cassette/persisters/file_system" is being thrown when i call VCR.configure
<tubbo>
doesn't happen on Travis-CI, only locally
<tubbo>
tried downgrading to 2.2.3 and 2.2.0 but I get the same error
diegoviola has quit [Quit: leaving]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
Criztian has quit [Remote host closed the connection]
cha1tanya has joined #ruby-lang
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby-lang
lupine_85 has quit [Excess Flood]
lupine_85 has joined #ruby-lang
cha1tanya has quit [Read error: Connection reset by peer]
igotnolegs has quit [Quit: Computer has gone to sleep.]
jakko_ has quit [Remote host closed the connection]
jakko_ has joined #ruby-lang
_AtheoS_ has left #ruby-lang [#ruby-lang]
cha1tanya has joined #ruby-lang
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby-lang
<burgestrand>
tubbo: are you using bundler?
<burgestrand>
I’ve had gems partially load when using bundler, and thus they fail to load their additional files once needed. It’s because you start the application and manage to load the gem before you load bundler, more or less.
<rhalff>
hi, how to dynamically create a module/namespace ?
<Mon_Ouie>
Module.new
<Mon_Ouie>
Which can be assigned to a constant
toretore has joined #ruby-lang
<rhalff>
Mon_Ouie, ok thanks.
setmeaway has joined #ruby-lang
<erikh>
heh; anyone want to review some code? :)
chimkan has joined #ruby-lang
jxie has quit [Quit: leaving]
yxhuvud has joined #ruby-lang
qwerxy has quit [Quit: offski]
<rhalff>
Mon_Ouie, If I have a file with something like Nested::Something::Bla, is there an easy way to let Nested::Something be defined ? (as empty modules)
<Mon_Ouie>
Nested::Something = Module.new
<Mon_Ouie>
or just module Nested::Something; end
<banisterfiend>
rhalff: u could hack together some monstrosity using const_missing
<erikh>
or const_set and inject
outsmartin has joined #ruby-lang
<rhalff>
it's just needed for some dumb loading during a unit test, ok thanks.
<outsmartin>
how can i make sure that an instance of my class has an uniq name? should i keep a list? or are there better solutions
chessguy has quit [Remote host closed the connection]
kvirani has joined #ruby-lang
havenn has joined #ruby-lang
dous has joined #ruby-lang
yugui_zzz is now known as yugui
benanne has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Remote host closed the connection]
mfolnovic has joined #ruby-lang
yugui is now known as yugui_zzz
banaan has joined #ruby-lang
benanne has quit [Read error: Connection reset by peer]
mfolnovic has quit [Quit: Leaving.]
mfolnovic has joined #ruby-lang
mfolnovic has quit [Client Quit]
mfolnovic has joined #ruby-lang
<mfolnovic>
hello! I have a string in specific format and regex which fully matches it. What I'm trying to do is changing string with other values, through named groups defined in regex. Something like https://gist.github.com/3199461. After debugging this, match in block is a string. This is confusing to me because http://stackoverflow.com/a/7278909/564442 works.
<Mon_Ouie>
mfolnovic: gsub doesn't yield the MatchData object, it yields a String
<Mon_Ouie>
Use the (IIRC) $~ variable
<Mon_Ouie>
(and I do recall correctly)
<Mon_Ouie>
And there's no #[]= method there actually, not that you need it
<mfolnovic>
Mon_Ouie: $~ variable? is it $1, $2 etc. ?
<mfolnovic>
Mon_Ouie: what would be the correct way to change values inside groups?
<Mon_Ouie>
No, just $~
<Mon_Ouie>
Try it in IRB: "foo" =~ /f/; $~
<Mon_Ouie>
And to change the value, you'd just return a string with those values changed
<Mon_Ouie>
Like do_stuff_with_group1(m[1]) + do_stuff_with_group2(m[2])
havenn has quit [Remote host closed the connection]
<Mon_Ouie>
(m[0] is the whole matched string, not the first captured group)
willdrew has joined #ruby-lang
<mfolnovic>
Mon_Ouie: cool, tnx. but I was aiming for changing through named groups, since I get to know regex at runtime. It could be /(?<group1>\d+)\/(?<group2>\d+)/, but it could also be /(?<group2>\d+)\/(?<group1>\d+)/, or even /(?<group1>\d+)----(?<group2>\d+)/ (string is pretty dynamic). and in my use case, I'd like to change value of group1
willdrew has quit [Remote host closed the connection]
<Mon_Ouie>
string[m.offset(1), m[1].length] = whatever; m
<Mon_Ouie>
string*
<Mon_Ouie>
where m is the MatchData object
Taranis has joined #ruby-lang
<mfolnovic>
Mon_Ouie: cool, tnx a lot
<mfolnovic>
Mon_Ouie: spent whole afternoon on this, still a newbie for ruby :(
corsican has quit [Quit: leaving]
<Mon_Ouie>
Nevermind what I said actually, offset doesn't return what I expected
corsican has joined #ruby-lang
<mfolnovic>
Mon_Ouie: I'm currently trying str[match.begin(:page)..match.end(:page)] = value
<Mon_Ouie>
[m.begin(1) - m.begin(0), m[1].length] would work
<Mon_Ouie>
begin/end are relative to the whole string, not the matched part
kristofferrr has joined #ruby-lang
<mfolnovic>
Mon_Ouie: str[(match.begin(:page))..(match.end(:page) - 1)] = '2', this works for me. I'm referencing match through group name because, as I said, I don't know index of group I want (it could be 1, 2 etc.)
<mfolnovic>
Mon_Ouie: still, tnx, gave me great idea
<mfolnovic>
Mon_Ouie: wouldn't be more useful if block in gsub received MatchData instead of String?
banaan has quit [Read error: Connection reset by peer]
<mfolnovic>
Mon_Ouie: and ability to change MatchData
<Mon_Ouie>
I disagree about the second part, it doesn't make sense to mutate a MatchData object
<mfolnovic>
Mon_Ouie: not even in a use case like I have now?
<Mon_Ouie>
Yes
benanne has joined #ruby-lang
<Mon_Ouie>
Because once you change it, it's no longer information about the string that has been matched
<mfolnovic>
Mon_Ouie: agree. but still, if it is in a block's scope, and you change in on purpose (in a block)...?
<Mon_Ouie>
Why would blocks matter for that?
macmartine has joined #ruby-lang
<mfolnovic>
Mon_Ouie: isn't it used (in gsub) to change matched string to other value?
<Mon_Ouie>
The matched string isn't a MatchData object
<mfolnovic>
Mon_Ouie: why not?
Nisstyre has quit [Ping timeout: 272 seconds]
havenn has joined #ruby-lang
<Mon_Ouie>
Because that's not what it represents. It includes the location of the match and its components, as well as the content of the initial string before and after the match
tomb_ has joined #ruby-lang
<mfolnovic>
Mon_Ouie: but you agree that there should be a cleaner way to do what I want. not through using matcher.begin(), matcher.end() and directly changing string?
<Mon_Ouie>
Sure, but just defining a method that returns the string with some matches changed to something else would be enough
cha1tanya has joined #ruby-lang
<mfolnovic>
Mon_Ouie: kk, because I thought doing this through blocks is more a ruby-way :)
benanne has quit [Read error: Connection reset by peer]
skipper has joined #ruby-lang
skipper has quit [Remote host closed the connection]
malev has joined #ruby-lang
havenn has quit [Ping timeout: 246 seconds]
sora_h is now known as s0ra_h
dreinull has joined #ruby-lang
havenn has joined #ruby-lang
dhruvasagar has joined #ruby-lang
havenn has quit [Remote host closed the connection]
cantonic has quit [Quit: cantonic]
Z33K|Lux has joined #ruby-lang
rushed has joined #ruby-lang
rushed has quit [Client Quit]
havenn has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby-lang
chimkan has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 264 seconds]
havenn has quit [Remote host closed the connection]
heftig has joined #ruby-lang
qwerxy has quit [Quit: offski]
ruurd has quit [Quit: Leaving...]
dhruvasagar has joined #ruby-lang
cantonic has joined #ruby-lang
havenn has joined #ruby-lang
jakko__ has joined #ruby-lang
chimkan has quit [Quit: chimkan]
savage- has joined #ruby-lang
jakko__ has quit [Remote host closed the connection]
jakko_ has quit [Ping timeout: 272 seconds]
rushed has joined #ruby-lang
rushed has quit [Quit: rushed]
voker57 has quit [Read error: Connection reset by peer]
dejongge has quit [Read error: Connection timed out]
lsegal has joined #ruby-lang
mars__ has joined #ruby-lang
havenn has quit [Remote host closed the connection]
gsav has quit [Ping timeout: 272 seconds]
chimkan has joined #ruby-lang
pemeon has joined #ruby-lang
havenn has joined #ruby-lang
s0ra_h is now known as sora_h
chimkan has quit [Client Quit]
tenderlove has joined #ruby-lang
mistym has joined #ruby-lang
sora_h is now known as s0ra_h
pemeon has quit [Remote host closed the connection]
s0ra_h is now known as sora_h
wallerdev has joined #ruby-lang
havenn has quit [Remote host closed the connection]
bytephilia has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
Nisstyre has joined #ruby-lang
cha1tanya has quit [Quit: आलोच..]
dhruvasagar has quit [Ping timeout: 252 seconds]
jtoy has joined #ruby-lang
jtoy has quit [Client Quit]
bytephilia has quit [Quit: Computer has gone to sleep.]
mistym has quit [Remote host closed the connection]
ruurd has joined #ruby-lang
sora_h is now known as s0ra_h
havenn has joined #ruby-lang
Keva161 has joined #ruby-lang
chimkan has joined #ruby-lang
tenderlove has joined #ruby-lang
bytephilia has joined #ruby-lang
savage- has quit [Remote host closed the connection]