love_color_text has quit [Remote host closed the connection]
<Noldorin>
oh right, that fnmatch
<Noldorin>
thought you meant the ruby version heh
<canton7>
well, the ruby fnmatch steals the same constants I believe
<Noldorin>
indeed
<canton7>
but the rubydoc page for File didn't list the constants, so I went hunting elsewhere :P
<Noldorin>
apeiros_, canton7 so that doesn't actually have what i want unfortunately. is there anyway to do Dir.glob(…) easily but only match directories?
samphippen has quit [Quit: Computer has gone to sleep.]
<apeiros_>
trail with /
<apeiros_>
Dir.glob('**/*/')
Xeago has quit [Remote host closed the connection]
alexspeller has quit [Read error: Connection reset by peer]
<canton7>
any difference between that and Dir.glob('**/') ?
<Noldorin>
apeiros_ oh that's too easy heh
cableray has joined #ruby
dsdeiz has quit [Remote host closed the connection]
<Noldorin>
canton7, i think his example only matches directories at the leaves within the search tree rooted on the current dir
<Noldorin>
rather than directories *or* files as leaves
<canton7>
I ran both in a test dir and they had the same number of hits
<apeiros_>
canton7: yes
<apeiros_>
'**/' is what I'd write if it wasn't 0200 :)
<Noldorin>
heh
<canton7>
and the arrays were equal :P heh
<canton7>
coolies, just making sure I'm not missing something important with globs
<matti>
;]
<Noldorin>
anyway thanks guys
<Noldorin>
that seems to work
alexspeller has joined #ruby
kirun has quit [Quit: Client exiting]
jonathanwallace has joined #ruby
alejandro_ has joined #ruby
_alejandro has quit [Ping timeout: 252 seconds]
alexspeller has quit [Ping timeout: 252 seconds]
zeade has joined #ruby
maddog_ has quit [Ping timeout: 252 seconds]
slash_nick has quit [Ping timeout: 255 seconds]
slash_nick has joined #ruby
nwertman has joined #ruby
<ner0x>
I've asked for a list of books but does anyone here have any other suggestions. I have "TDD Development, The Ruby Programming Language, Rails 3 in Action"
<Noldorin>
hrmm
<Noldorin>
apeiros_, canton7 actually i noticed some functions (e.g. system) seem to implicitly convert arguments that are arrays into strings
<Noldorin>
how can i do this?
reppard has joined #ruby
<apeiros_>
Noldorin: you want to use e.g. args = ['ls', '-la', '.'] with system to get system('ls', '-la', '.')?
<apeiros_>
that'd by system(*args)
cableray has quit [Quit: cableray]
<Noldorin>
no no
Jasko has quit [Read error: Connection reset by peer]
<Noldorin>
apeiros_, i'm saying i do something like:
Jasko has joined #ruby
<Noldorin>
system "which", Dir['foo.*']
<Noldorin>
(arbitrary example)
<Noldorin>
and this works
<Noldorin>
somehow the result of Dir, which is an array, gets converted into a string
<Noldorin>
how does this work exactly?
<Noldorin>
i.e. how can i reproduce such behaviour myself
<apeiros_>
it probably calls to_s on it
<Noldorin>
ah got it
joofsh has quit [Remote host closed the connection]
<Noldorin>
ta
taoru has joined #ruby
nwertman has quit [Ping timeout: 255 seconds]
Virunga has quit [Remote host closed the connection]
toekutr has joined #ruby
cableray has joined #ruby
jfl0wers has joined #ruby
havenn has quit [Remote host closed the connection]
havenn has joined #ruby
jfl0wers has quit [Client Quit]
tenmilestereo has joined #ruby
tommyvyo has quit [Quit: Computer has gone to sleep.]
havenn has quit [Ping timeout: 252 seconds]
reppard has quit [Ping timeout: 246 seconds]
havenn has joined #ruby
_alejandro has joined #ruby
_64k has quit [Quit: _64k]
gnul0ver has joined #ruby
alejandro_ has quit [Ping timeout: 250 seconds]
verto is now known as verto|off
Astral__ has joined #ruby
Steve1UK has quit []
icole has joined #ruby
<aedorn>
I have a headache. Now would be a good time to program something using C++ templates.
nomenkun has joined #ruby
Astral_ has quit [Ping timeout: 264 seconds]
swex_ has joined #ruby
swex has quit [Ping timeout: 252 seconds]
<matti>
lol
nerd has quit [Ping timeout: 265 seconds]
thufir_ has quit [Remote host closed the connection]
nomenkun has quit [Ping timeout: 244 seconds]
cableray has quit [Quit: cableray]
sepp2k has quit [Remote host closed the connection]
jibi has joined #ruby
SeySayux has quit [Ping timeout: 246 seconds]
sweet_kid has quit [Ping timeout: 246 seconds]
jibi has quit [Client Quit]
foohey has quit [Ping timeout: 246 seconds]
x42 has quit [Ping timeout: 246 seconds]
SeySayux has joined #ruby
foohey has joined #ruby
sweet_kid has joined #ruby
nyuszika7h has quit [Ping timeout: 246 seconds]
x42 has joined #ruby
widith has joined #ruby
widith has left #ruby ["WeeChat 0.3.9.2"]
Noldorin has quit [Quit: Computer has gone to sleep.]
nyuszika7h has joined #ruby
nerd has joined #ruby
kenneth has quit [Quit: kswizz.com]
aedorn has quit [Quit: Konversation terminated!]
ttt has joined #ruby
iamjarvo has joined #ruby
aedorn has joined #ruby
Noldorin has joined #ruby
Takehiro has joined #ruby
mrdtt has joined #ruby
x82_nicole has joined #ruby
Takehiro has quit [Ping timeout: 246 seconds]
nari_ has joined #ruby
Jasko has quit [Read error: Connection reset by peer]
taoru has quit [Ping timeout: 252 seconds]
Jasko has joined #ruby
mahmoudi_ has joined #ruby
slash_nick has quit [Ping timeout: 260 seconds]
slash_nick has joined #ruby
tommyvyo has joined #ruby
Noldorin has quit [Quit: Computer has gone to sleep.]
nomenkun has joined #ruby
x82_nicole has quit [Quit: Computer has gone to sleep.]
mahmoudi_ has quit [Quit: Computer has gone to sleep.]
tommyvyo has quit [Client Quit]
timur has left #ruby [#ruby]
nomenkun has quit [Ping timeout: 252 seconds]
eka has quit [Quit: Computer has gone to sleep.]
jenrzzz has joined #ruby
chord has joined #ruby
kidoz has quit [Quit: Ухожу я от вас]
jekotia has joined #ruby
Hanmac1 has joined #ruby
mercwithamouth has quit [Ping timeout: 255 seconds]
benlieb has quit [Quit: benlieb]
Hanmac has quit [Ping timeout: 250 seconds]
voodoofish has quit [Ping timeout: 252 seconds]
benlieb has joined #ruby
TheFuzzball has quit [Quit: Leaving...]
<shevy>
yeah
voodoofish has joined #ruby
<chord>
whats the difference between include and extend where Humor is a module and what does it mean when a class has both include and extend, for example: class Grouchy include Humor extend Humor end
jenrzzz has quit [Ping timeout: 246 seconds]
<apeiros_>
chord: do you know the `class <<self` construct? (singleton_class)
<chord>
no
<apeiros_>
ok. extend adds the (instance-)methods of the given module only to a single object
<apeiros_>
(the one you extend)
<chord>
so then what does include do
<apeiros_>
include adds the (again, instance-)methods of the given module to a class, and there as instance methods. i.e. they're not available on the class object itself, only instances of that class
atno has quit [Read error: Connection reset by peer]
<apeiros_>
(which is why include is Module#include, and extend is Object#extend - i.e., you can only use include on classes and modules, whereas you can use extend on [almost] every object)
atno has joined #ruby
<chord>
so include makes the methods part of the class object not part of instances of the class?
<zastern>
As I understand it, .include? operates on arrays. But I can do foo = "12"; foo.include? "1" and get true. Does it just convert to an array automatically for the purposes of the test or something?
<heftig>
zastern: no, include? is just a method name
<zastern>
actually never mind
<heftig>
both String and Array implement it
<zastern>
yeah i just realized that haha
icole has quit [Remote host closed the connection]
<apeiros_>
chord: um, no? that's quite the opposite of what I just said…
<chord>
so extend makes it part of the class object?
<chord>
does that mean it references instance variables makes no sense for them
_alejandro has quit [Remote host closed the connection]
<apeiros_>
can't make sense of your last question
<apeiros_>
but I think this helps:
<apeiros_>
classes are objects
<apeiros_>
all objects can have ivars
<apeiros_>
(almost all, at least)
<chord>
what happens if you reference instance variables from a method obtained through extend
<chord>
instance variables of the objects
ner0x has quit [Quit: Leaving]
<apeiros_>
self is relevant
<zastern>
I'm trying to check if a string includes any number in a range - e.g. next_move.include?(0..9) - but that's not right. Is there any way to do this simply?
<apeiros_>
in any method call, self will be the receiver of the method. ivars belong to that self.
<apeiros_>
zastern: a single digit only? or could the range also be multi-digit, e.g. 23..45 ?
<zastern>
uhhh basically I need to know if the string contains anything from 0-9, but it could be any combonation, e.g. yes 43, 67, etc
joshman_ has joined #ruby
<zastern>
so uh, im really checking that it's a base-10 number i guess
bitri has joined #ruby
<apeiros_>
zastern: then you'll have to extract the numbers, convert them to integer, and test that
<apeiros_>
03:59 zastern: so uh, im really checking that it's a base-10 number i guess
<apeiros_>
eh, that's an entirely different problem…
borkmouse has joined #ruby
<zastern>
i mean the issue is just to make sure the person typed in a number.
<apeiros_>
Integer(str, 10) # will raise if it isn't base10
<apeiros_>
wow, you keep changing your problem description fast :-p
<apeiros_>
can you make up your mind what you really want to test?
<zastern>
lol
<zastern>
did the person type in a number that is a combonation of the digits 0 through 9, or any single digit.
The_8473 has joined #ruby
The_8472 has quit [Ping timeout: 244 seconds]
Aqua has quit [Ping timeout: 244 seconds]
Aqua has joined #ruby
jonahR has joined #ruby
bitri has quit [Client Quit]
joshman_ has quit [Ping timeout: 265 seconds]
<zastern>
if next_move.to_i != 0 sort of works, except that now we fail if they actually do type in zero
<zastern>
ill figure it out eventually
jimeh has quit [Quit: Computer has gone to sleep.]
<apeiros_>
zastern: you can use a regex or Integer(str, 10)
phelps has joined #ruby
<apeiros_>
is chord pm'ing anybody else?
jenrzzz has joined #ruby
<havenn>
apeiros_: Yeah, has before. Troll, troll, troll.
chord was kicked from #ruby by apeiros_ [chord]
<apeiros_>
k, thx.
<zastern>
apeiros_: I figured out how to do the regex with ~= but how do you actually use Integer(str, 10)?
<apeiros_>
o0
<apeiros_>
Integer("14", 10) # => 14
<apeiros_>
Integer("hello", 10) # !> kaboom
<apeiros_>
if it goes kaboom, it's not a base10 integer
<zastern>
ah ok i get it
<zastern>
cool thanks
<zastern>
but that just returns the number
<zastern>
not true false
<apeiros_>
correct. the thing you want to look out for is the exception.
otters has joined #ruby
<zastern>
yeah i dont think im at the point of exception handling just yet
<zastern>
but ive got the regex working
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
<apeiros_>
you probably should show the regex
<apeiros_>
there's quite a bit of things one can do wrong there
benlieb has quit [Quit: benlieb]
Rym has quit [Quit: Rym]
jenrzzz has quit [Ping timeout: 264 seconds]
<zastern>
apeiros_: good thing this is just a test exercise then :)
benlieb has joined #ruby
gnul0ver has quit [Ping timeout: 252 seconds]
diegoviola has quit [Quit: WeeChat 0.3.9.2]
neurotech has quit [Remote host closed the connection]
mercwithamouth has quit [Ping timeout: 264 seconds]
ananthakumaran has quit [Quit: Leaving.]
zeade has quit [Ping timeout: 276 seconds]
jblack has quit [Ping timeout: 265 seconds]
cableray has joined #ruby
ryanf_ has quit [Quit: broken pipes |||]
Hanmac1 is now known as Hanmac
philips_ has quit [Excess Flood]
mercwithamouth has joined #ruby
zeade has joined #ruby
zeade has quit [Client Quit]
jenrzzz has joined #ruby
dr_neek has joined #ruby
philips_ has joined #ruby
ananthakumaran has joined #ruby
jxriddle has joined #ruby
philips_ has quit [Excess Flood]
jxriddle has quit [Ping timeout: 246 seconds]
ryanf has joined #ruby
havenn has joined #ruby
taoru has joined #ruby
philips_ has joined #ruby
eldariof has joined #ruby
borkmouse has quit [Remote host closed the connection]
tommyvyo has joined #ruby
kmurph has joined #ruby
xaq has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
ryanf has quit [Quit: broken pipes |||]
taoru has quit [Ping timeout: 252 seconds]
__class__ has joined #ruby
kokainepizza has quit [Quit: My pooter is sleep.]
berserkr has quit [Quit: Leaving.]
LouisGB has quit [Ping timeout: 246 seconds]
mercwithamouth has quit [Quit: Lost terminal]
cantonic has joined #ruby
bigmcq77 has joined #ruby
xaq has quit [Remote host closed the connection]
<aedorn>
I want to use postgres - I just don't know why.
<Hanmac>
you mean you dont know why you want to use postgres?
dvdwlsh has joined #ruby
dvdwlsh has quit [Client Quit]
<aedorn>
Exactly. It's like ... I want to eat that cookie, but I don't know why.
<tar_>
marketing
<aedorn>
mmm marketing is tasty
jekotia has quit [Ping timeout: 252 seconds]
jekotia_ has joined #ruby
taoru has joined #ruby
jekotia_ is now known as jekotia
jekotia has quit [Client Quit]
zastern has quit [Remote host closed the connection]
bigmcq77 has quit [Quit: Computer has gone to sleep.]
rippa has joined #ruby
rockets has joined #ruby
rockets has quit [Remote host closed the connection]
phelps has joined #ruby
taoru has quit [Ping timeout: 255 seconds]
LouisGB has joined #ruby
iamjarvo has quit [Quit: Leaving.]
nazty has quit [Read error: Connection reset by peer]
taoru has joined #ruby
Chronax has quit [Ping timeout: 264 seconds]
yacks has quit [Ping timeout: 252 seconds]
lenovodroid has quit [Ping timeout: 260 seconds]
wargasm has quit [Ping timeout: 252 seconds]
Guest9041 has quit [Read error: Connection reset by peer]
jsilver has joined #ruby
Guest9041 has joined #ruby
Guest9041 has quit [Read error: Connection reset by peer]
Guest9041 has joined #ruby
d2dchat has joined #ruby
taoru has quit [Ping timeout: 246 seconds]
dsdeiz has quit [Remote host closed the connection]
taoru has joined #ruby
cj3kim has joined #ruby
Takehiro has joined #ruby
d2dchat has quit [Remote host closed the connection]
medik has quit [Quit: medik has no reason]
jessta has quit [Ping timeout: 256 seconds]
JohnBat26 has joined #ruby
tommyvyo has quit [Quit: Computer has gone to sleep.]
eldariof has quit []
rdegraci has quit [Quit: rdegraci]
wargasm has joined #ruby
samuel02 has joined #ruby
yshh_ has joined #ruby
yshh has quit [Read error: No route to host]
wildcard0 has quit [Ping timeout: 250 seconds]
wildcard1 has joined #ruby
rippa has quit [Ping timeout: 240 seconds]
yshh_ has quit [Read error: No route to host]
yshh has joined #ruby
postmodern has joined #ruby
gregorg has quit [Ping timeout: 255 seconds]
taoru has quit [Ping timeout: 252 seconds]
robustus has quit [Ping timeout: 255 seconds]
gregorg has joined #ruby
h4mz1d has joined #ruby
robustus has joined #ruby
nerd has quit [Quit: WeeChat 0.3.9.2]
kmurph has quit [Quit: kmurph]
vlad_starkov has joined #ruby
io_syl has joined #ruby
slash_nick has quit [Quit: leaving]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby
gaze__ has joined #ruby
Asher has quit [Quit: Leaving.]
<gaze__>
hey guys. I'm having a difficult time understanding how the require path works. Say I'm using ruby1.9.1, and I have a.rb and b.rb in the same directory. In a.rb, I should be able to do " require 'b' " and it should work, correct?
<gaze__>
This happens to work on ruby 1.8, but not on 1.9.1
Takehiro has quit [Remote host closed the connection]
ddd1 has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_sta_ has joined #ruby
<gaze__>
It fails with -- in `require': no such file to load -- b (LoadError)
Takehiro has joined #ruby
keanehsiao has joined #ruby
ddd has quit [Ping timeout: 245 seconds]
<keanehsiao>
hihi
vlad_sta_ has quit [Remote host closed the connection]
<keanehsiao>
wondering how to convert chinese 彩虹橋 to /u5f69/u8679/u6a4b
havenn has quit [Ping timeout: 255 seconds]
<gaze__>
okay so why is "." in my LOAD_PATH on 1.8, and not on 1.9.1 by default?
<gaze__>
and where is this set?
xaq has joined #ruby
phelps has quit [Ping timeout: 260 seconds]
kmurph has joined #ruby
phelps has joined #ruby
<keanehsiao>
wondering how to convert chinese 彩虹橋 to /u5f69/u8679/u6a4b
gaze__ has quit [Quit: Page closed]
gregorg has quit [Read error: No route to host]
jxriddle has joined #ruby
gregorg has joined #ruby
jsilver has quit [Remote host closed the connection]
xaq has quit [Read error: Connection reset by peer]
moshee has quit [Ping timeout: 264 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
jxriddle has quit [Ping timeout: 252 seconds]
tar_ has quit [Quit: farewell]
jonahR has joined #ruby
sayan has joined #ruby
d3vic3 has joined #ruby
eldariof has joined #ruby
wallerdev has joined #ruby
jonahR has quit [Quit: jonahR]
ebouchut has joined #ruby
lordnaz has joined #ruby
havenn has joined #ruby
kmurph has quit [Quit: kmurph]
lordnaz has quit [Quit: Lost terminal]
h4mz1d has quit [Ping timeout: 245 seconds]
toekutr has quit [Remote host closed the connection]
kmurph has joined #ruby
rakl has joined #ruby
Gooder has joined #ruby
Takehiro has quit [Remote host closed the connection]
kmurph has quit [Client Quit]
topriddy has joined #ruby
LouisGB has quit [Ping timeout: 252 seconds]
gnul0ver has joined #ruby
topriddy has quit [Client Quit]
<Hanmac>
keanehsiao: are you still wondering? i think i solved it
Proshot has quit [Read error: Connection reset by peer]
thibauts has quit [Ping timeout: 256 seconds]
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
ebouchut has quit [Quit: This computer has gone to sleep]
GeekOnCoffee has joined #ruby
nemesit|osx has joined #ruby
statarb3 has quit [Read error: Connection reset by peer]
statarb3 has joined #ruby
emergion has joined #ruby
onibox has joined #ruby
thibauts has joined #ruby
Proshot has joined #ruby
nemesit has quit [Ping timeout: 245 seconds]
apeiros_ has joined #ruby
ikaros has joined #ruby
DevoPs has joined #ruby
statarb3 has quit [Ping timeout: 256 seconds]
GeekOnCoffee has quit [Ping timeout: 276 seconds]
Proshot has quit [Ping timeout: 264 seconds]
matrixise has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
matip has joined #ruby
_64k has joined #ruby
<matip>
is there a method to escape quotes and sanitize a string to execute it as a SQL query?
Jasko has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
<apeiros_>
matip: bad idea. use bind variables instead.
fowl has quit [Ping timeout: 252 seconds]
<apeiros_>
that's those ? in the queries.
emergion has quit [Quit: Computer has gone to sleep.]
<matip>
nop, I can't
<matip>
I'm executing this query because datamapper doesn't support bulk insert, so I'm creating the query by hand, apeiros_
jxriddle has joined #ruby
<apeiros_>
matip: BS, you still can
<matip>
how would you? it would be something like INSERT INTO foo(bar, xux) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), ...
<apeiros_>
just because you can't do it with datamapper doesn't mean you can't use sane mechanics at all
<matip>
apeiros_, what's your idea?
<apeiros_>
I don't see what's difficult about that
<apeiros_>
query = "INSERT INTO foo(bar, xux) VALUE "+'(?, ?), '*100
<apeiros_>
then prepare & execute the statement
<apeiros_>
well, chomp(', ') the trailing ', '
<matip>
hmn, let me see how to prepare it
<matip>
thanks
jsilver has joined #ruby
jxriddle has quit [Ping timeout: 244 seconds]
picca has joined #ruby
<Hanmac>
imo the Database wrapper should handle something like insert for you
<matip>
DM does handle insert, not bulk insert
timonv has quit [Remote host closed the connection]
<Hanmac>
imo that is worth a feature request
emmanuelux has joined #ruby
<matip>
I've found some messages from 2008 and 2010 asking for that, I wouldn't expect this feature anytime soon :P
tPl0ch has quit [Quit: Verlassend]
<matip>
Hanmac, actually even ActiveRecord doesn't support it ;)
<Hanmac>
is it soo important that its a bulk insert?
emergion has joined #ruby
<matip>
it's not a bulk insert because it's important.. actually all the opposite
<matip>
I'm inserting A LOT of -unimportant- rows
<apeiros_>
matip: if the reason is performance, you may want to go lower level. some db clients provide special means to deal with bulk data
<matip>
you're talking about COPY, right?
<apeiros_>
i.e. with oracle, I got a ~10x speed up using a specific API for bulk inserts
GeekOnCoffee has joined #ruby
EhyehAsherEhyeh has joined #ruby
<apeiros_>
no, I'm talking about how the db client interacts with the db. that's outside of sql.
<matip>
in pgsql there's a faster method called COPY TO/FROM
sepp2k has joined #ruby
<matip>
you don't have SQL at all there
<matip>
you basically send all the rows in a CSV style to pgsql's stdin
g_bleezy has joined #ruby
GeekOnCoffee has quit [Ping timeout: 248 seconds]
<matip>
look, prepared statements works like that in DM: repository.adapter.execute('INSERT INTO foo(bar, xux) VALUES '+('(?, ?), '*collection.length).chop.chop, ...collection...)
<matip>
I have to provide all the parameters to bind the variables like in ...chop, "bar1", "xux1", "bar2", "xux2", "bar3", "xux3")
<matip>
how would you do that?
darthdeus has joined #ruby
g_bleezy has quit [Ping timeout: 252 seconds]
mikekelly has quit [Ping timeout: 265 seconds]
nerd has joined #ruby
arturaz has joined #ruby
<matip>
<apeiros_> I don't see what's difficult about that
<matip>
:P
Xeago has joined #ruby
cantonic has joined #ruby
mikekelly has joined #ruby
<apeiros_>
I still don't
<apeiros_>
you know what an array is, do you?
nari_ has joined #ruby
<matip>
I don't think you can do "...chop, array)", but maybe there's a method like .call or .args or something like that (third day with ruby, don't ask me!)
eka has joined #ruby
Slivka has joined #ruby
<apeiros_>
*array
emmanuelux has quit [Remote host closed the connection]
<matip>
OMG
<matip>
I love ruby lol
<matip>
apeiros_, I didn't know that. thank you
Virunga has quit [Remote host closed the connection]
picca has quit [Ping timeout: 265 seconds]
_64k has quit [Quit: _64k]
emergion has quit [Quit: Computer has gone to sleep.]
emmanuelux has joined #ruby
iamjarvo has joined #ruby
toto-_ has joined #ruby
Nisstyre-laptop has quit [Ping timeout: 245 seconds]
apeiros_ has quit [Remote host closed the connection]
havenn has joined #ruby
lolmaus has quit []
VegetableSpoon has joined #ruby
EhyehAsherEhyeh has joined #ruby
JohnBat26 has quit [Read error: Connection reset by peer]
JohnBat26 has joined #ruby
banisterfiend has joined #ruby
love_color_text has joined #ruby
Takehiro has quit [Remote host closed the connection]
lkba has joined #ruby
timonv has joined #ruby
JohnBat26 has quit [Read error: Connection reset by peer]
nomenkun has quit [Remote host closed the connection]
<matip>
I've a strange bug that seems to be a race condition due to a couple of threads that are pushing elems into an array continuously. should it be a problem? I don't know how it's implemented internally, maybe the bug is not there.. what's your opinion?
nomenkun has joined #ruby
JohnBat26 has joined #ruby
slainer68 has joined #ruby
_64k has quit [Quit: _64k]
Takehiro has joined #ruby
slainer68 has quit [Read error: Operation timed out]
markit has joined #ruby
nerd has quit [Quit: WeeChat 0.3.9.2]
nerd has joined #ruby
<markit>
hi, ruby 1.8. If I have a string, 'this is a string' and I want to match with a regular expression and search for 'string' and get back only the part BEFORE that match?
<markit>
i.e. in that example I would like to have back 'this is a'
<markit>
and '' if does not match
<markit>
or nil..
<Hanmac>
markit maybe somethnig like this? /(.+)\sstring/ =~ 'this is a string';$1
<Hanmac>
or like 'this is a string'.scan(/(.+)\sstring/).flatten[0]
<markit>
Hanmac: magic!
<markit>
Hanmac: thanks a lot (also did not thought of swap regex - string position)
karakedi has quit [Ping timeout: 252 seconds]
<Hanmac>
markit or the best way: 'this is a string'[/(.+)\sstring/,1]
arkiver has quit [Quit: Leaving]
Guest9041 has quit [Ping timeout: 252 seconds]
<matip>
> ('foo bar xux'.match /xux/).pre_match
<matip>
=> "foo bar "
Guest9041 has joined #ruby
<Hanmac>
matip you are wrong, when it does not match it does fail
banisterfiend has quit [Ping timeout: 252 seconds]
jianmeng3 has left #ruby [#ruby]
banisterfiend has joined #ruby
<matip>
come on... first match, then compare, then call pre_match
phelps has quit [Read error: Connection reset by peer]
stayarrr has joined #ruby
foohey has quit [Client Quit]
Morkel has joined #ruby
tommyvyo has joined #ruby
nomenkun has joined #ruby
zastern has quit [Remote host closed the connection]
nomenkun has quit [Ping timeout: 252 seconds]
tommyvyo has quit [Quit: Computer has gone to sleep.]
Noldorin has quit [Quit: Computer has gone to sleep.]
d3vic3_ has joined #ruby
moshee has quit [Ping timeout: 245 seconds]
jonathanwallace has quit [Quit: WeeChat 0.3.9.2]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
d3vic3 has quit [Ping timeout: 244 seconds]
`0x00 has joined #ruby
`0x00 has left #ruby [#ruby]
benlieb has joined #ruby
banister_ has joined #ruby
nomenkun has joined #ruby
slainer68 has joined #ruby
jxriddle has joined #ruby
tommyvyo has joined #ruby
banisterfiend has quit [Ping timeout: 260 seconds]
foohey has joined #ruby
banister_ has quit [Ping timeout: 252 seconds]
banisterfiend has joined #ruby
cousine has joined #ruby
arya has quit [Ping timeout: 244 seconds]
havenn has joined #ruby
arya has joined #ruby
foohey has quit [Changing host]
foohey has joined #ruby
d3vic3 has joined #ruby
nomenkun has quit [Remote host closed the connection]
foohey has quit [Quit: Reconnecting]
philips_ has quit [Excess Flood]
foohey has joined #ruby
d3vic3_ has quit [Ping timeout: 265 seconds]
eldariof has joined #ruby
nerd has quit [Quit: WeeChat 0.3.9.2]
akemrir has joined #ruby
_64k has joined #ruby
philips_ has joined #ruby
nomenkun has joined #ruby
arya has quit []
foohey has quit [Quit: Lost terminal]
philips_ has quit [Excess Flood]
banisterfiend has quit [Ping timeout: 252 seconds]
d3vic3 has quit [Ping timeout: 246 seconds]
d3vic3 has joined #ruby
bigmac has quit [Quit: Leaving]
arya has joined #ruby
nomenkun has quit [Remote host closed the connection]
foohey has joined #ruby
foohey has quit [Changing host]
foohey has joined #ruby
arkiver has quit [Ping timeout: 255 seconds]
nerd has joined #ruby
foohey has quit [Quit: Reconnecting]
foohey has joined #ruby
foohey has quit [Changing host]
foohey has joined #ruby
foohey has quit [Client Quit]
foohey has joined #ruby
foohey has quit [Changing host]
foohey has joined #ruby
slainer68 has quit [Remote host closed the connection]
cakehero has joined #ruby
Neomex has joined #ruby
Neomex has quit [Client Quit]
slainer68 has joined #ruby
foohey has quit [Client Quit]
Neomex has joined #ruby
foohey has joined #ruby
foohey has quit [Client Quit]
icole has quit [Remote host closed the connection]
foohey has joined #ruby
eka has joined #ruby
foohey has quit [Client Quit]
dyrot has joined #ruby
crackfu has joined #ruby
foohey has joined #ruby
baphled has joined #ruby
_64k has quit [Quit: _64k]
SiliconDon has joined #ruby
jgrevich has joined #ruby
SiliconDon has quit [Client Quit]
schaerli has quit [Remote host closed the connection]
nomenkun has joined #ruby
ccooke has quit [Ping timeout: 252 seconds]
philips_ has joined #ruby
nerd has quit [Quit: WeeChat 0.3.9.2]
EhyehAsherEhyeh has quit [Ping timeout: 252 seconds]
Virunga has joined #ruby
nwertman has joined #ruby
scruple has joined #ruby
arya has quit [Ping timeout: 244 seconds]
scruple has quit [Ping timeout: 255 seconds]
banisterfiend has joined #ruby
scruple has joined #ruby
Nisstyre-laptop has joined #ruby
h4mz1d has joined #ruby
benlieb has quit [Quit: benlieb]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby
ccooke has joined #ruby
havenn has quit [Read error: No route to host]
nerd has joined #ruby
havenn has joined #ruby
arya has joined #ruby
banisterfiend has quit [Ping timeout: 260 seconds]
h4mz1d has quit [Ping timeout: 264 seconds]
arya has quit [Ping timeout: 244 seconds]
jonahR has joined #ruby
wallerdev has joined #ruby
nwertman has quit [Ping timeout: 244 seconds]
akemrir has quit [Quit: WeeChat 0.3.9.2]
alexspeller has joined #ruby
arya has joined #ruby
foohey has quit [Quit: leaving]
akemrir has joined #ruby
yfeldblum has quit [Ping timeout: 252 seconds]
_64k has joined #ruby
ewag has joined #ruby
elico has joined #ruby
_64k has quit [Quit: _64k]
yacks has joined #ruby
<TTilus>
the way ruby libs are usually written almost guarantees youll have namespace collisions when you use a lot of libs
iamjarvo has quit [Quit: Leaving.]
<TTilus>
and reopening classes makes collisions subtle
foohey has joined #ruby
foohey has quit [Changing host]
foohey has joined #ruby
jimeh has joined #ruby
jimeh has quit [Client Quit]
seanwash has joined #ruby
seanwash has quit [Remote host closed the connection]
Aqua has quit [Ping timeout: 252 seconds]
Aqua has joined #ruby
slainer68 has quit [Remote host closed the connection]
<TTilus>
the one thing ive wished more than once is the ability to wrap stuff inside a namespace
dr_neek has quit [Quit: dr_neek]
<TTilus>
just to be able to separate two colliding libs
Agbeladem has joined #ruby
jimeh has joined #ruby
_whitelogger has joined #ruby
ewag has quit [Read error: Connection reset by peer]
Jasko has joined #ruby
<TTilus>
within JailModule require "global-namespace-polluting-lib"
<TTilus>
and im fully aware thet in ruby that feature is far from being trivial to implement
dr_neek has joined #ruby
<Agbeladem>
Okay guys I'm losing it here
wallerdev has quit [Quit: wallerdev]
<Agbeladem>
I got "." in my classpath. If I do "series" I'm getting ": No such file or directory", and the first line is #!/usr/bin/env ruby but "ruby series" works just fine
<reactormonk>
Agbeladem, "." in your loadpath is always a security issue
lenovodroid has quit [Ping timeout: 245 seconds]
icole has joined #ruby
<Agbeladem>
reactormonk: okay, now why doesn't this work considering I got other ruby scripts in the same folder with the same first-line header ?
Jackneill has quit [Remote host closed the connection]
Chronax has joined #ruby
Fezzler has joined #ruby
arya has quit [Ping timeout: 244 seconds]
Fezzler has quit [Client Quit]
bricker has quit [Ping timeout: 265 seconds]
rakl has joined #ruby
arya has joined #ruby
felipe_Brz has joined #ruby
mengu has quit [Quit: Konversation terminated!]
iamjarvo has joined #ruby
<felipe_Brz>
right now I need to do a simple container for a few methods... in other languages I would perhaps write static methods in a class... what's the best way to do this in ruby?
<lupine>
well, what are the methods to do?
lenovodroid has joined #ruby
bricker has joined #ruby
<lupine>
you could stick them in a module (rails helpers are like this, for instance)
jenrzzz has quit [Ping timeout: 260 seconds]
Slivka has quit [Remote host closed the connection]
<felipe_Brz>
well i'm making a few helper methods for my own use
g_bleezy has joined #ruby
<lupine>
I'd generally stick to instance methods, rather than class methods, if you do, though
<felipe_Brz>
hmm can I call instance methods on a class without instantiating it?
<felipe_Brz>
like foo = MyClass.someMethod()
<lupine>
a module isn't a class ^^. you'd need to include the module on something before being able to call them
<lupine>
one trick would be to extend the module with itself, so you can call MyModule.my_method or include MyModule ; my_method
<lupine>
but don't forget, you can reopen any existing class. maybe your method more properly belongs on String, or Fixnum, or some other already-existing class
<lupine>
whatever makes its intent clearest
<felipe_Brz>
yes you're talking about partial classes
<felipe_Brz>
it's a real clever concept
<lupine>
?
<felipe_Brz>
isn't that what partial classes are?
<felipe_Brz>
like you add a method to class Array at runtime
<felipe_Brz>
you define a class called Array and add a method to it
<lupine>
well, ruby doesn't have class definitions, as such
toekutr has quit [Read error: Connection reset by peer]
<lupine>
so the idea of a partial class definition (dot-net, right?) doesn't exactly apply
<felipe_Brz>
no, not dot net
<felipe_Brz>
i learnt about it on a rails web course