apeiros changed the topic of #ruby-lang to: Ruby 2.1.0-p0; 2.0.0-p353; 1.9.3-p484: http://ruby-lang.org|| Paste >3 lines of text on http://gist.github.com || RubyConf 2013 at http://www.justin.tv/confreaks
jsullivandigs has joined #ruby-lang
brianpWi1s has quit [Quit: leaving]
elia has joined #ruby-lang
brianpWi1s has joined #ruby-lang
brianpWi1s has quit [Client Quit]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
havenwood has joined #ruby-lang
jonahR has quit [Quit: jonahR]
brianpWi1s has joined #ruby-lang
brianpWi1s has quit [Client Quit]
arooni-mobile has joined #ruby-lang
brianpWi1s has joined #ruby-lang
jayne has quit [Quit: Quit]
breakingthings has quit []
jayne has joined #ruby-lang
brianpWi1s has quit [Client Quit]
brianpWi1s has joined #ruby-lang
sandbags has quit []
benanne has quit [Quit: kbai]
kiwnix has joined #ruby-lang
stonerfish has quit [Quit: Leaving.]
brianpWi1s has quit [Quit: leaving]
jonahR has joined #ruby-lang
wallerdev has joined #ruby-lang
arooni-mobile has quit [Remote host closed the connection]
ender has joined #ruby-lang
ender_ has joined #ruby-lang
|jemc| has quit [Ping timeout: 272 seconds]
vlad_starkov has joined #ruby-lang
Onixs_ has quit [Read error: Connection reset by peer]
jay_m has quit [Remote host closed the connection]
fijimunkii has quit [Ping timeout: 265 seconds]
jay_m has joined #ruby-lang
Onixs has joined #ruby-lang
ender has quit [Ping timeout: 252 seconds]
jay_m has quit [Remote host closed the connection]
jay_m has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
jsullivandigs has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 272 seconds]
apeiros has quit [Remote host closed the connection]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
apeiros has joined #ruby-lang
fijimunkii has joined #ruby-lang
tylersmith has quit [Remote host closed the connection]
fijimunkii has quit [Ping timeout: 260 seconds]
seanlinsley has joined #ruby-lang
danijoo_ has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
atmosx has quit [Quit: Lost in trance]
jay_m has quit [Quit: Leaving...]
ivanskie has quit [Ping timeout: 272 seconds]
jay_m has joined #ruby-lang
Xuisce has joined #ruby-lang
jay_m has quit [Client Quit]
Xuisce is now known as jay_m
diegoviola has joined #ruby-lang
tom025 has joined #ruby-lang
vpretzel has quit [Quit: Adios!]
cnivolle has quit [Remote host closed the connection]
lfox has quit [Quit: ZZZzzz…]
marr has quit [Ping timeout: 246 seconds]
RobertBi_ has joined #ruby-lang
kiwnix has quit [Read error: Connection reset by peer]
workmad3 has quit [Ping timeout: 252 seconds]
RobertBi_ has quit [Client Quit]
RobertBirnie has quit [Ping timeout: 252 seconds]
mistym has quit [Remote host closed the connection]
benlovell has joined #ruby-lang
achru has joined #ruby-lang
pabloh has joined #ruby-lang
jerrytgarcia has quit [Quit: WeeChat 0.4.2]
benlovell has quit [Ping timeout: 252 seconds]
achru has quit [Ping timeout: 272 seconds]
jtw has quit []
dwknoxy has quit [Quit: Computer has gone to sleep.]
bzalasky has joined #ruby-lang
bottico has quit [Quit: Leaving.]
quizzicol has joined #ruby-lang
symm- has quit [Ping timeout: 252 seconds]
dik_dak has quit [Quit: Leaving]
MrZYX is now known as MrZYX|off
bzalasky has quit [Remote host closed the connection]
jsullivandigs has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
mannyt has joined #ruby-lang
VTLob has quit [Quit: VTLob]
Johz has quit [Quit: Leaving]
deens has joined #ruby-lang
presidentbeef has joined #ruby-lang
tom025 has quit [Remote host closed the connection]
deens has quit [Ping timeout: 264 seconds]
bzalasky has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
|jemc| has joined #ruby-lang
deens has joined #ruby-lang
deens has quit [Read error: Connection reset by peer]
deens has joined #ruby-lang
mistym has joined #ruby-lang
deens has quit [Read error: Connection reset by peer]
kurko__ has joined #ruby-lang
deens has joined #ruby-lang
amclain has joined #ruby-lang
jsullivandigs has quit [Remote host closed the connection]
io_syl has quit [Ping timeout: 246 seconds]
deens has quit [Ping timeout: 252 seconds]
diegoviola has quit [Quit: WeeChat 0.4.2]
diegoviola has joined #ruby-lang
jsullivandigs has joined #ruby-lang
dorei has quit []
kurko__ has quit [Quit: Computer has gone to sleep.]
daikan_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby-lang
jtw has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby-lang
kotk has quit [Ping timeout: 252 seconds]
yatish27 has joined #ruby-lang
kfpratt has quit [Remote host closed the connection]
kfpratt has joined #ruby-lang
kfpratt has quit [Ping timeout: 272 seconds]
Barrin6 has joined #ruby-lang
<|jemc|> anyone have a pattern for setting up a string for interpolation, but delaying the interpolation until later (without using eval)
<bougyman> "%s" % aProc
io_syl has joined #ruby-lang
<|jemc|> and the proc returns an interpolation string in single quotes or something?
<|jemc|> aProc = proc{'my string that uses #{x}'} ?
<|jemc|> or were you just suggesting using format strings?
brettweavnet has joined #ruby-lang
io_syl has quit [Read error: Connection reset by peer]
chouhoulis has quit [Remote host closed the connection]
jay_m is now known as zz_jay_m
<|jemc|> looks like there may be no simple facilities for doing what I want
brianpWins has joined #ruby-lang
brettweavnet has quit [Client Quit]
brianpWins has quit [Client Quit]
brettweavnet has joined #ruby-lang
r0bgleeson has quit [Ping timeout: 272 seconds]
diegoviola has quit [Ping timeout: 260 seconds]
yatish27 has quit [Remote host closed the connection]
diegoviola has joined #ruby-lang
deens has joined #ruby-lang
<|jemc|> I was hoping to do arbitrary operations on objects in the string interpolations, which is more than format strings can do. But any kind of delayed interpolation that evaluates an expression based on a string is already a conceptual kind of eval. So because I'm not comfortable using eval here, I shouldn't be comfortable with that either.
yfeldblum has quit [Remote host closed the connection]
presidentbeef has quit [Quit: Page closed]
deens has quit [Ping timeout: 265 seconds]
jeff_r has joined #ruby-lang
ledestin has joined #ruby-lang
cored has quit [Ping timeout: 252 seconds]
diegovio1 has joined #ruby-lang
jeff_r has quit [Client Quit]
diegovio1 has quit [Changing host]
diegovio1 has joined #ruby-lang
diegoviola has quit [Ping timeout: 248 seconds]
kurko__ has joined #ruby-lang
amerine has quit [Ping timeout: 260 seconds]
kurko______ has joined #ruby-lang
amerine has joined #ruby-lang
mistym has quit [Remote host closed the connection]
diegovio1 is now known as diegoviola
lsegal has joined #ruby-lang
kurko__ has quit [Ping timeout: 260 seconds]
quizzicol has quit [Quit: Leaving.]
yatish27 has joined #ruby-lang
amerine has quit [Ping timeout: 248 seconds]
amerine has joined #ruby-lang
quizzicol has joined #ruby-lang
simi has joined #ruby-lang
tylersmith has joined #ruby-lang
quizzicol has quit [Ping timeout: 252 seconds]
mistym has joined #ruby-lang
yatish27 has quit [Remote host closed the connection]
daikan has joined #ruby-lang
quizzicol has joined #ruby-lang
tylersmith has quit []
tylersmith has joined #ruby-lang
daikan has quit [Ping timeout: 265 seconds]
mannyt has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yfeldblum has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
deens has joined #ruby-lang
chouhoulis has joined #ruby-lang
kylo has quit [Quit: ZNC - http://znc.in]
Cakey has joined #ruby-lang
simi has quit [Ping timeout: 272 seconds]
chouhoulis has quit [Ping timeout: 252 seconds]
deens has quit [Ping timeout: 252 seconds]
kurko______ has quit [Ping timeout: 260 seconds]
kurko__ has joined #ruby-lang
deens has joined #ruby-lang
spuk has quit [Quit: Human beings were created by water to transport it uphill.]
bzalasky has joined #ruby-lang
mykoweb has quit [Remote host closed the connection]
mykoweb has joined #ruby-lang
deens has quit [Ping timeout: 252 seconds]
jonahR has quit [Quit: jonahR]
mistym has quit [Remote host closed the connection]
<Lewix> def blank?
<Lewix> respond_to?(:empty?) ? empty? : !self
<Lewix> end
<Lewix> how does it take care of " ".blank?
<|jemc|> well,
<|jemc|> " ".respond_to? :empty? #=> true
<|jemc|> and
<|jemc|> " ".empty? #=> false
<|jemc|> so with that construction of :blank?, the return value would be false
diegoviola has quit [Quit: WeeChat 0.4.2]
diegoviola has joined #ruby-lang
daikan has joined #ruby-lang
styped has joined #ruby-lang
styped has quit [Max SendQ exceeded]
daikan has quit [Ping timeout: 246 seconds]
<Lewix> |jemc|: exactly
<Lewix> |jemc|: the doc got it wrong,
<Lewix> the rails doc
pablo__ has joined #ruby-lang
<|jemc|> ah, I'm not familiar with it because I don't do rails
<Lewix> |jemc|: in rails '" ".blank? returns true
<Lewix> and the source code on the doc is what i posted earlier
<|jemc|> ah
<|jemc|> well, if you want to see the real source, pry's show-source command is nifty for that sort of thing
<|jemc|> so that you don't have to wade through the source code to find it
pabloh has quit [Ping timeout: 264 seconds]
pablo__ has quit [Ping timeout: 252 seconds]
yatish27 has joined #ruby-lang
fingerprint_ has joined #ruby-lang
fingerprint has quit [Read error: Connection reset by peer]
fingerprint_ is now known as fingerprint
<Lewix> any idea what's going on?
<|jemc|> yeah, you're running your :deserialized_users method before @customers is initialized as an empty array
<|jemc|> so your traceback tells you you're calling the :<< method on nil, because @customers is still nil at that point
<|jemc|> so you need to swap lines 28 and 29
<Lewix> |jemc|: thanks god for your eyes
<Lewix> weird
<|jemc|> you need to paste the traceback too for me
mykoweb has quit [Remote host closed the connection]
<|jemc|> ah, sorry, I missed a more fundamental flaw there although my first point was also important
<|jemc|> so, yes, in ruby, the object can call methods on itself by omitting the "self" as you've done
mykoweb has joined #ruby-lang
<Lewix> ah
<Lewix> that
<Lewix> thanks!
<|jemc|> so 'self.empty?' can be called with simply: 'empty?'
deens has joined #ruby-lang
<|jemc|> but the same is _not_ true for attr_writer methods
<|jemc|> or more generally, methods that end in =
<|jemc|> so you can't leave off the self on self.customers=[]
<|jemc|> because ruby thinks you're trying to create a local var called customers
bzalasky has quit [Remote host closed the connection]
<Lewix> that
<Lewix> that's right. i was aware of it. thanks for pointing that out
<|jemc|> no problem
<Lewix> |jemc|: any suggestion on how to refactor it
<|jemc|> well, you can use self.customers = []
<|jemc|> or you can use @customers = []
<|jemc|> some people prefer to use the self. route because they like to make sure it goes through their writer method in case they ever want to replace attr_accessor with something nontrivial
<|jemc|> like something that validates before setting, for example
<|jemc|> they could override the customers= method with something nontrivial without changing any other code
<Lewix> i meant the code in general
<Lewix> =)
<|jemc|> ha
<Lewix> im sure theres a fair amount of refactoring that can be done. it smells metaprograming?
<|jemc|> well it looks like you're not rearranging or validating the row values at all before passing them to the Customer.new method, is that right?
deens has quit [Ping timeout: 264 seconds]
<|jemc|> if so, you can forego unpacking all of them by name just to pack them back in
<|jemc|> customers << Customers.new(*row)
<|jemc|> then you could do your one unpacking of the array in the Customers#initialize method
<|jemc|> def initialize *values
<|jemc|> @cust_id, @elect_or_gas, ... = values
<|jemc|> end
<Lewix> omg
<Lewix> why dont i see those things as fast
<Lewix> thanks =)
<|jemc|> no problem
<|jemc|> good luck :)
<Lewix> one more thing
<Lewix> theres a way to grap data without naming the variable and not knowing the data im grabbing.
<Lewix> 1.Is it a good thing? 2.How would you go about it?
<|jemc|> I don't quite follow your description
<Lewix> |jemc|: ok just give me a few minutes, I'll try to implement it
huma has joined #ruby-lang
diegovio1 has joined #ruby-lang
diegovio1 has quit [Changing host]
diegovio1 has joined #ruby-lang
diegoviola has quit [Ping timeout: 260 seconds]
daikan has joined #ruby-lang
hahuang61 has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
r0bgleeson has joined #ruby-lang
vlad_starkov has joined #ruby-lang
rippa has joined #ruby-lang
daikan has quit [Ping timeout: 272 seconds]
sepp2k has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Read error: Connection reset by peer]
havenwood has joined #ruby-lang
rahul_j has joined #ruby-lang
havenwood has quit [Read error: Connection reset by peer]
<Lewix> |jemc|: I was trying to think of way to dynamically set my variables name
<|jemc|> maybe you're thinking of instance_variable_set(:@my_var, value)
diegovio1 is now known as diegoviola
hahuang61 has quit [Ping timeout: 252 seconds]
kurko__ has quit [Quit: Computer has gone to sleep.]
hahuang61 has joined #ruby-lang
charlies_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yfeldblum has quit [Remote host closed the connection]
<Lewix> |jemc|: is there a local_variable_set()
jtw has quit []
bzalasky has joined #ruby-lang
<|jemc|> there is in the binding object
<|jemc|> but unless it was a pre-existing variable, it doesn't outlive the inner binding
<|jemc|> also, did not exist before 2.1, if you're using something earlier
<|jemc|> in other words, you probably can't do what you were hoping to do
<|jemc|> you also can't create local vars from an eval
<|jemc|> same issue - they do not outlive the inner binding that eval uses
yfeldblum has joined #ruby-lang
hahuang65 has joined #ruby-lang
hahuang61 has quit [Ping timeout: 245 seconds]
Cakey has quit [Ping timeout: 260 seconds]
Cakey has joined #ruby-lang
mistym has joined #ruby-lang
spuk has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
d4rkr4i has joined #ruby-lang
mistym has quit [Ping timeout: 272 seconds]
jsullivandigs has quit [Remote host closed the connection]
Barrin6 has quit [Quit: Leaving]
yatish27 has quit [Remote host closed the connection]
AKASkip has joined #ruby-lang
yatish27 has joined #ruby-lang
daikan has joined #ruby-lang
daikan has quit [Read error: Connection reset by peer]
daikan has joined #ruby-lang
jerrytgarcia has joined #ruby-lang
<Lewix> |jemc|: still here?
wallerdev has quit [Quit: wallerdev]
vlad_starkov has joined #ruby-lang
<|jemc|> heh, yeah
mitchty_ has joined #ruby-lang
<Lewix> |jemc|: here is what i did so far, im working on line 45: https://gist.github.com/6ewis/f0c0069f277fcf6b0e9b
mitchty has quit [Ping timeout: 240 seconds]
vlad_starkov has quit [Read error: Connection reset by peer]
daikan has quit [Ping timeout: 252 seconds]
hgdt has joined #ruby-lang
hgdt has left #ruby-lang [#ruby-lang]
ledestin has quit [Ping timeout: 272 seconds]
hahuang61 has joined #ruby-lang
<Lewix> |jemc|: any idea how i can refactor line 45?
hahuang65 has quit [Ping timeout: 272 seconds]
<|jemc|> what are you wanting the value passed to dump to look like?
<|jemc|> an array of only values?
<Lewix> [c.cust_id, c.elect_or_gas, c.disconnect_doc, c.move_in_date, c.move_out_date, c.bill_year, c.bill_month, c.span_days, c.meter_read_date, c.meter_read_type, c.consumption, c.exception_code])
<Lewix> they all have the same pattern (for lack of a better word) c.foo ---> i can get foo from c.custom_methods.keys.each
hahuang61 has quit [Ping timeout: 245 seconds]
<Lewix> so yes an array of any values |jemc|
<|jemc|> is the order important?
achru has joined #ruby-lang
<|jemc|> if not, then use c.custom_methods.values
<Lewix> |jemc|: nope
<|jemc|> that's your array already
<Lewix> ah! thanks
<Lewix> yaouu
yatish27 has quit [Remote host closed the connection]
<Lewix> i managed to do it. I knew it was possible
yatish27 has joined #ruby-lang
ledestin has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
<Lewix> Is it better to use the mode 'a' for File.open rather than 'w'
<Lewix> for efficiency
yatish27_ has joined #ruby-lang
<r0bgleeson> i wouldnt worry about efficiency for that, just if you want to overwrite a file or not
yatish27 has quit [Ping timeout: 272 seconds]
mykoweb has quit [Remote host closed the connection]
yatish27_ has quit [Ping timeout: 272 seconds]
mykoweb has joined #ruby-lang
mykoweb has quit [Read error: No route to host]
mykoweb has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
rahul_j has left #ruby-lang [#ruby-lang]
JohnBat26 has joined #ruby-lang
AKASkip has quit [Ping timeout: 253 seconds]
yfeldblum has joined #ruby-lang
yfeldblu_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 272 seconds]
yfeldblu_ has quit [Ping timeout: 252 seconds]
daikan has joined #ruby-lang
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
_TheRev_ has joined #ruby-lang
daikan has quit [Ping timeout: 264 seconds]
hahuang61 has joined #ruby-lang
<toretore> any fiber experts willing to have a look at something for me?
mykoweb has quit [Remote host closed the connection]
mykoweb has joined #ruby-lang
mykoweb has quit [Ping timeout: 272 seconds]
arBmind has joined #ruby-lang
mistym has joined #ruby-lang
<Lewix> r0bgleeson: any good eye?
mistym has quit [Ping timeout: 260 seconds]
relix has joined #ruby-lang
mistym has joined #ruby-lang
phansch has joined #ruby-lang
phansch has quit [Ping timeout: 248 seconds]
yfeldblum has joined #ruby-lang
phansch has joined #ruby-lang
yatish27 has joined #ruby-lang
vlad_starkov has joined #ruby-lang
yfeldblum has quit [Ping timeout: 260 seconds]
daikan has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
daikan has quit [Ping timeout: 265 seconds]
tylersmith has quit [Remote host closed the connection]
tylersmith has joined #ruby-lang
apeiros has quit [Read error: Connection reset by peer]
apeiros has joined #ruby-lang
tylersmith has quit [Ping timeout: 252 seconds]
marr has joined #ruby-lang
prc has quit [Ping timeout: 248 seconds]
face has joined #ruby-lang
Cakey has quit [Ping timeout: 252 seconds]
rsl has quit [Ping timeout: 272 seconds]
linc01n has quit [Ping timeout: 272 seconds]
levifig has quit [Ping timeout: 272 seconds]
rahul_j has joined #ruby-lang
|jemc| has quit [Ping timeout: 260 seconds]
canton7 has quit [Ping timeout: 272 seconds]
ozzloy has quit [Ping timeout: 272 seconds]
llakey has quit [Ping timeout: 272 seconds]
DEac- has quit [Remote host closed the connection]
ozzloy has joined #ruby-lang
ozzloy has joined #ruby-lang
DEac- has joined #ruby-lang
Rubennn has quit [Ping timeout: 272 seconds]
jtperreault has quit [Ping timeout: 272 seconds]
mihar_ has quit [Ping timeout: 272 seconds]
Rickmasta has quit [Ping timeout: 272 seconds]
Rubennn has joined #ruby-lang
linc01n has joined #ruby-lang
igalic has quit [Remote host closed the connection]
Phoop has joined #ruby-lang
igalic has joined #ruby-lang
igalic has quit [Changing host]
igalic has joined #ruby-lang
anekos__ has quit [Ping timeout: 272 seconds]
fallenhitokiri has quit [Remote host closed the connection]
fallenhitokiri has joined #ruby-lang
Phoop has quit [Client Quit]
jtperreault has joined #ruby-lang
llakey has joined #ruby-lang
Rickmasta has joined #ruby-lang
anekos__ has joined #ruby-lang
mihar has joined #ruby-lang
Cakey has joined #ruby-lang
snk has quit [Read error: Operation timed out]
igalic has quit [Ping timeout: 272 seconds]
igalic has joined #ruby-lang
levifig has joined #ruby-lang
snk has joined #ruby-lang
Dernise has quit [Quit: Leaving]
amclain has quit [Quit: Leaving]
Dernise has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
_TheRev_ has quit []
diegoviola has quit [Quit: WeeChat 0.4.2]
yfeldblum has joined #ruby-lang
mehlah has joined #ruby-lang
vlad_starkov has joined #ruby-lang
yfeldblum has quit [Ping timeout: 252 seconds]
daikan has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
quizzicol has quit [Quit: Leaving.]
elia has joined #ruby-lang
benanne has joined #ruby-lang
daikan has quit [Ping timeout: 260 seconds]
vlad_starkov has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
kitak has joined #ruby-lang
bin7me has joined #ruby-lang
quizzicol has joined #ruby-lang
michael_mbp has quit [Quit: ZNC - http://znc.sourceforge.net]
marr has quit [Ping timeout: 252 seconds]
tylersmith has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
michael_mbp has joined #ruby-lang
diegoviola has joined #ruby-lang
tylersmith has quit [Ping timeout: 272 seconds]
face has quit []
ender_ has quit [Ping timeout: 272 seconds]
face has joined #ruby-lang
ender_ has joined #ruby-lang
MrZYX|off is now known as MrZYX
ender_ has quit [Ping timeout: 252 seconds]
hahuang61 has quit [Ping timeout: 276 seconds]
daikan has joined #ruby-lang
robmiller has joined #ruby-lang
jperry has quit [Ping timeout: 264 seconds]
Lewix has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
workmad3 has joined #ruby-lang
yfeldblum has quit [Ping timeout: 246 seconds]
mbj has joined #ruby-lang
quizzicol has quit [Quit: Leaving.]
Dernise has quit [Quit: This computer has gone to sleep]
jerrytgarcia has quit [Quit: WeeChat 0.4.2]
francisfish has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
mistym has quit [Remote host closed the connection]
francisfish has joined #ruby-lang
achru_ has joined #ruby-lang
achru has quit [Ping timeout: 272 seconds]
VTLob has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
ahmedelgabri has joined #ruby-lang
kitak has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 246 seconds]
Johz has joined #ruby-lang
hahuang61 has joined #ruby-lang
marr has joined #ruby-lang
ahmedelg_ has joined #ruby-lang
dragonnkh has joined #ruby-lang
ahmedelgabri has quit [Ping timeout: 246 seconds]
hahuang61 has quit [Ping timeout: 264 seconds]
dragonkh has quit [Ping timeout: 245 seconds]
mbj has quit [Ping timeout: 246 seconds]
quizzicol has joined #ruby-lang
symm- has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
workmad3 has quit [Read error: Connection reset by peer]
Cakey has quit [Ping timeout: 252 seconds]
elia has quit [Quit: (IRC Client: textualapp.com)]
simi has joined #ruby-lang
yfeldblum has joined #ruby-lang
d4rkr4i has left #ruby-lang [#ruby-lang]
yfeldblum has quit [Ping timeout: 252 seconds]
quizzicol has quit [Quit: Leaving.]
mbj has joined #ruby-lang
rahul_j has joined #ruby-lang
<imperator> good morning
Cakey has joined #ruby-lang
benlovell has joined #ruby-lang
charliesome has joined #ruby-lang
JoshuaPaling has joined #ruby-lang
Cakey has quit [Ping timeout: 260 seconds]
symm- has quit [Ping timeout: 272 seconds]
JoshuaPaling has quit [Quit: Textual IRC Client: www.textualapp.com]
ahmedelgabri has joined #ruby-lang
hopkins83 has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
ahmedelg_ has quit [Ping timeout: 252 seconds]
<hopkins83> Hi
<hopkins83> So is chruby the new rvm?
<apeiros> no. chruby is an alternative to rvm.
<hopkins83> apeiros: An alternative you guys prefer over rvm or?
<apeiros> I'm on rvm.
<hopkins83> Yeah me too.
<hopkins83> Plus the rvm author is always so nice and helpful if I encounter a bug or need help in general
vlad_sta_ has joined #ruby-lang
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
cnivolle has joined #ruby-lang
<postmodern> hopkins83, far simpler than rvm
<hopkins83> postmodern: That's always a compelling argument :)
vlad_starkov has quit [Ping timeout: 252 seconds]
<apeiros> the implementation complexity bothers me little. and usage of rvm is about as simple as it can get IMO.
<MrZYX> I think RVM could get rid of gemsets these days
<postmodern> by simple i don't just mean LoC, but also less features and less workflow optimization
<postmodern> er i should use the word "minimal" instead of "simple"
mehlah has quit [Quit: Leaving...]
<hopkins83> hmmm
<hopkins83> The community is divided
<hopkins83> I think the community still needs more time to figure out which one is the best one
<yorickpeterse> depends on your need
<hopkins83> yorickpeterse: Rails apps on cloud VPSes
dorei has joined #ruby-lang
<yorickpeterse> no strict requirement for RVM there
<yorickpeterse> Also what I meant was in terms of the features you'd require
<postmodern> hopkins83, it is a fallacy that the entire community should use one and only one tool
yfeldblum has joined #ruby-lang
<yorickpeterse> e.g. do you need gemsets, do you need a complex mounting sytstem, etc
<yorickpeterse> or do you just want to install a Ruby and be done with it?
<postmodern> also do you use a old/odd OS that needs help compiling ruby on?
quizzicol has joined #ruby-lang
<hopkins83> yorickpeterse: Yes I need one gemset per app. What do you mean by complex mounting system?
* imperator guesses separate filesystem
<hopkins83> postmodern: I use OpenBSD. It's been a lot of compile issue but the RVM author took care of everything.
mbj has quit [Read error: Operation timed out]
<hopkins83> Well, OpenBSD is split up into multiple partitions with different permissions, but all of my apps are in /home/some_app1/, /home/some_app2/ etc.
<yorickpeterse> hopkins83: `rvm mount`
<postmodern> hopkins83, you should consider using bundler, if you have one gemset per app
danijoo has quit [Read error: Connection reset by peer]
<postmodern> hopkins83, gemsets are more for global sets of gems you switch between
<hopkins83> postmodern: Cool thanks
<postmodern> hopkins83, plus rubygems 2.2.0 now supports installing from the Gemfile
yfeldblum has quit [Ping timeout: 272 seconds]
danijoo has joined #ruby-lang
<hopkins83> Sweet
vlad_sta_ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
quizzicol has quit [Ping timeout: 252 seconds]
<imperator> joast, ping
<darix> postmodern: is 2.2.0 in ruby 2.1?
Johz has quit [Quit: Leaving]
Johz has joined #ruby-lang
mistym has joined #ruby-lang
ItSANg___ has quit [Quit: Leaving...]
mbj has joined #ruby-lang
mucker has joined #ruby-lang
mistym has quit [Ping timeout: 272 seconds]
Cakey has joined #ruby-lang
quizzicol has joined #ruby-lang
quizzicol1 has joined #ruby-lang
quizzicol has quit [Read error: Connection reset by peer]
ItSANgo has joined #ruby-lang
Cakey has quit [Ping timeout: 260 seconds]
ItSANgo has quit [Client Quit]
diegoviola has quit [Quit: WeeChat 0.4.2]
quizzicol1 has quit [Ping timeout: 260 seconds]
<Jacky> \o/
ItSANgo has joined #ruby-lang
Dernise has joined #ruby-lang
huma has quit [Ping timeout: 260 seconds]
yatish27 has quit [Remote host closed the connection]
quizzicol has joined #ruby-lang
patriciomacadden has joined #ruby-lang
Dernise has quit [Quit: This computer has gone to sleep]
bin7me has quit [Quit: Leaving]
mbj has quit [Read error: Connection reset by peer]
Dernise has joined #ruby-lang
yfeldblum has joined #ruby-lang
<postmodern> darix, why yes it is
<darix> postmodern: was just curios. thank you
quizzicol has quit [Quit: Leaving.]
canton7 has joined #ruby-lang
yfeldblum has quit [Ping timeout: 246 seconds]
vlad_sta_ has joined #ruby-lang
daikan has quit [Read error: Connection reset by peer]
daikan_ has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 260 seconds]
jerrytgarcia has joined #ruby-lang
dernise_ has joined #ruby-lang
simi has quit [Ping timeout: 246 seconds]
Dernise has quit [Ping timeout: 252 seconds]
mbj has joined #ruby-lang
quizzicol has joined #ruby-lang
mykoweb has joined #ruby-lang
quizzicol has quit [Ping timeout: 272 seconds]
dernise_ has quit [Quit: This computer has gone to sleep]
Cakey has joined #ruby-lang
dernise_ has joined #ruby-lang
Cakey has quit [Ping timeout: 248 seconds]
quizzicol has joined #ruby-lang
fijimunkii has joined #ruby-lang
sepp2k has joined #ruby-lang
red_menace has joined #ruby-lang
dernise_ has quit [Quit: This computer has gone to sleep]
francisfish has quit [Remote host closed the connection]
quizzicol1 has joined #ruby-lang
mbj has quit [Ping timeout: 248 seconds]
quizzicol has quit [Read error: Connection reset by peer]
DEac- has quit [Read error: Connection reset by peer]
thmzlt has joined #ruby-lang
achru_ has quit [Remote host closed the connection]
simi has joined #ruby-lang
quizzicol1 has quit [Ping timeout: 260 seconds]
mbj has joined #ruby-lang
kotk has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
Lewix has joined #ruby-lang
marcel has joined #ruby-lang
brettweavnet has quit [Read error: Connection reset by peer]
fijimunkii has quit [Ping timeout: 260 seconds]
fijimunkii has joined #ruby-lang
rahul_j has joined #ruby-lang
yfeldblum has joined #ruby-lang
patriciomacadden has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
foucist has joined #ruby-lang
<foucist> any idea how to handle multiple regexp w/ diff substitutions on a string? can't chain gsubs
patriciomacadden has joined #ruby-lang
yfeldblum has quit [Ping timeout: 272 seconds]
<MrZYX> pass a hash
<MrZYX> >> "foobar".gsub(/foo|bar/, "foo" => "one", "bar" => "two")
<eval-in> MrZYX => "onetwo" (https://eval.in/91515)
<foucist> MrZYX: if the hash is { regexp1 => subst1, regexp2 => subst2) it doesn't work
<foucist> s/)/}/
<MrZYX> see my example
<foucist> i suppose i could build a hash from the matches and pass that in
<foucist> MrZYX: "foobar".gsub(Regexp.union(/foo/,/bar/), /foo/ => "one", /bar/ => "two") doesn't work
<MrZYX> afaik there's no way to index by regex, you have to chain. the hash trick only works on matches
<Lewix> hey folks
<Lewix> i need a pair of fresh eye
mykoweb_ has joined #ruby-lang
<Lewix> MrZYX: ?
<MrZYX> well, you insert nils
<MrZYX> if customers_with_electricity.include? customer returns false
mykoweb has quit [Ping timeout: 272 seconds]
<MrZYX> try customers.select {|customer| customers_with_electricity.include? customer }.map
<Lewix> MrZYX: True thanks. that was for my first question. What about the second.
jerrytgarcia has quit [*.net *.split]
canton7 has quit [*.net *.split]
GaelanAintAround has quit [*.net *.split]
m6n has quit [*.net *.split]
knu has quit [*.net *.split]
TheMoonMaster has quit [*.net *.split]
perry has quit [*.net *.split]
go|dfish has quit [*.net *.split]
pbjorklund has quit [*.net *.split]
lianj has quit [*.net *.split]
dbussink has quit [*.net *.split]
yellow5 has quit [*.net *.split]
zenspider has quit [*.net *.split]
mistym has joined #ruby-lang
hagabaka has quit [Remote host closed the connection]
jerrytgarcia has joined #ruby-lang
GaelanAintAround has joined #ruby-lang
m6n has joined #ruby-lang
canton7 has joined #ruby-lang
knu has joined #ruby-lang
perry has joined #ruby-lang
TheMoonMaster has joined #ruby-lang
go|dfish has joined #ruby-lang
pbjorklund has joined #ruby-lang
lianj has joined #ruby-lang
dbussink has joined #ruby-lang
yellow5 has joined #ruby-lang
zenspider has joined #ruby-lang
<MrZYX> you don't memorize which ones you already printed
<MrZYX> uniq takes a block
<MrZYX> so do something like def uniq_customers; customers.uniq {|customer| customer.cust_id }; end; ... uniq_customers.map ....
mistym has quit [Ping timeout: 260 seconds]
fijimunkii has quit [Read error: Connection reset by peer]
jerrytgarcia has quit [*.net *.split]
canton7 has quit [*.net *.split]
GaelanAintAround has quit [*.net *.split]
m6n has quit [*.net *.split]
knu has quit [*.net *.split]
TheMoonMaster has quit [*.net *.split]
perry has quit [*.net *.split]
go|dfish has quit [*.net *.split]
pbjorklund has quit [*.net *.split]
lianj has quit [*.net *.split]
dbussink has quit [*.net *.split]
yellow5 has quit [*.net *.split]
zenspider has quit [*.net *.split]
wallerdev has joined #ruby-lang
<Lewix> MrZYX: customers.map { |customer| customer.cust_id}.uniq! - I thought it would do the trick but nope
<MrZYX> ?
<MrZYX> I gave you the code basically...
<MrZYX> and calling uniq! on the result of a .map rarely makes sense
<MrZYX> (the bang version)
jerrytgarcia has joined #ruby-lang
GaelanAintAround has joined #ruby-lang
canton7 has joined #ruby-lang
m6n has joined #ruby-lang
TheMoonMaster has joined #ruby-lang
knu has joined #ruby-lang
perry has joined #ruby-lang
pbjorklund has joined #ruby-lang
lianj has joined #ruby-lang
go|dfish has joined #ruby-lang
dbussink has joined #ruby-lang
yellow5 has joined #ruby-lang
zenspider has joined #ruby-lang
hagabaka has joined #ruby-lang
marcel has quit [Quit: ZNC - http://znc.in]
marcel has joined #ruby-lang
<Lewix> MrZYX: why?
<Lewix> MrZYX: thanks for the answer; I'm also trying to understand few basics stuff i might not understand
<MrZYX> map creates a new object, uniq! is self modifying and returns nil if it does not modification
<Lewix> MrZYX: right, but doesn't it return the new modified object
<MrZYX> so dooing foo = bar.map {}.uniq! might put nil into foo
symm- has joined #ruby-lang
<Lewix> if modified*
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
<MrZYX> as said, you rarely want that
rsl has joined #ruby-lang
<MrZYX> doing foo = bar.map {}.uniq!; foo ||= bar.map {} is just ugly
patriciomacadden has quit [Quit: Textual IRC Client: www.textualapp.com]
diegoviola has joined #ruby-lang
<Lewix> MrZYX: I see . thanks a lot!
<Lewix> MrZYX: how would you refactor line 86, 93, 99
mbj has quit [Read error: Operation timed out]
<Lewix> MrZYX: ah stupid i. ill show you how i updated it
<MrZYX> I'd probably start by splitting that into three classes
<MrZYX> one for IO, one for processing and one for printing
mbj has joined #ruby-lang
<MrZYX> some naming seems of for my taste
<MrZYX> class Customer # it represents a single one
quizzicol has joined #ruby-lang
mykoweb_ has quit [Remote host closed the connection]
<MrZYX> and actually nothing more than a Customer = Struct.new(*fields)
mykoweb has joined #ruby-lang
<MrZYX> deserialized_users -> deserialize_users, you do it, you don't just access the result, same for serialized -> serialize
<MrZYX> I'd probably cache all the computations
mbj has quit [Ping timeout: 260 seconds]
quizzicol has quit [Ping timeout: 246 seconds]
mykoweb has quit [Ping timeout: 245 seconds]
<Lewix> MrZYX: class customers has a data attribute that takes the arg and is later use for computation
<MrZYX> Customer = Struct.new(*fields, :data)
thisirs has joined #ruby-lang
<MrZYX> now your outer maps in 85, 92, 98 want to be eachs (and get some newlines)
<MrZYX> and customer.data.map { |item| item.to_s.center 15}.join'|' is redundant, make it a method
<MrZYX> def format_customer customer
mykoweb has joined #ruby-lang
<MrZYX> customer.elect_or_gas == "1" && customer.elect_or_gas != "2" feels redundant too, it can't be "2" if it's "1" already
thmzlt has quit [Remote host closed the connection]
thmzlt has joined #ruby-lang
yfeldblum has joined #ruby-lang
<MrZYX> and a good technique is to extract magic values into constants
yorickpeterse has quit [Read error: Connection reset by peer]
godman has joined #ruby-lang
godman has quit [Remote host closed the connection]
<MrZYX> like the 15 you pass to center but also the "1" and "2" for elect_or_gas
yorickpeterse has joined #ruby-lang
<Lewix> MrZYX: thanks that's a lot of information and certainly help. I'm reading about struct.new atm
wallerdev has quit [Quit: wallerdev]
<MrZYX> though another way to make those more obvious is to map them to :electricity and :gas and name the attribute type or something
thmzlt has quit [Remote host closed the connection]
<MrZYX> or even just adding gas? and electricity? to your customer class
daikan has joined #ruby-lang
thmzlt has joined #ruby-lang
daikan_ has quit [Read error: Connection reset by peer]
<MrZYX> line 57 is just yaml.puts YAML.dump(c.data), no? (we use . to call methods. always)
yfeldblum has quit [Ping timeout: 272 seconds]
<Lewix> MrZYX: you're faster than a speeding bullet. thank you ill make the fix you recommended and get back at you
<MrZYX> also having a yaml file consisting of multiple yaml files seems odd, just build a nested array and dump it in one go, or yet better build an array of hashes
thmzlt has quit [Ping timeout: 252 seconds]
<MrZYX> finally just a style thing: customers.uniq {|customer| customer.cust_id } can be written as customers.uniq(&:cust_id), if you decide to have gas? and electricity? methods on your customer class you can then also do customers.select(&:gas?) etc
<ddd> mrzyx TIL. didn't know that myself
<Lewix> MrZYX: you also mentioned something about the code - that it should be more modular. You would create three classes, or 2 modules and one class
<MrZYX> I see three concerns, so three classes
<ddd> never seen that access style for methods on an object (@obj.select(&:gas)
<MrZYX> well four in total since you already have two classes
<ddd> how would you push params to the called method?
<MrZYX> ddd: you don't
<ddd> so you would use that for methods not taking params then. ok good to know
<ddd> how does that differ from, and does it involve method_missing at all, calling send
<MrZYX> it works this way: the & operator calls .to_proc on the argument before trying to convert it to a block, Symbol#to_proc is implemented much like this: proc {|e| e.send(self) }
AKASkip has joined #ruby-lang
hahuang61 has joined #ruby-lang
Onixs has quit [Read error: Connection reset by peer]
vlad_sta_ has quit [Remote host closed the connection]
<Lewix> MrZYX: here is another version of my code ill have to update too after making the changes your recommended
<ddd> self being the proc obj, or e. there? (I get confoozled occasionally on what object would be in scope when self is called)
<Lewix> MrZYX: the dynamic version
<MrZYX> ddd: Symbol#to_proc, so it's the symbol ;)
<ddd> got it. thanks for the explanation.
Onixs has joined #ruby-lang
<ddd> interesting way to call it. i don't think i'd have ever thought of calling in that manner, myself, if i hadn/t seen it done
<ddd> any particular use cases for this particular style of method calling?
<MrZYX> File.readlines.map(&:strip)
<MrZYX> for example
<MrZYX> stuff like that
<ddd> sorry for drilling, i've not seen this before like i said, so trying to educate myself while someone who knows this usage pattern is around :)
<MrZYX> no worries
<ddd> yeah i've seen map
<ddd> well seen its use *with* map
<MrZYX> inject even does the & for you: sum = [1,2,3].inject(:+)
<ddd> implied with the :+ then?
<Lewix> does the channel have a logger
<ddd> hehe hope so. this is a tidbit i'd like to keep, and i don't log on this client
<Lewix> me neither
<ddd> totally a throwaway shell so i don't waste time with logs on here
hahuang61 has quit [Ping timeout: 264 seconds]
<ddd> nice!
<ddd> thanks mrzyx
vlad_starkov has joined #ruby-lang
<Lewix> thanks
benlovell has quit [Ping timeout: 264 seconds]
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
<Lewix> MrZYX: thanks a lot im off to eat. ill get back to you after all the updates are done to have feedbacks
AKASkip has quit [Ping timeout: 252 seconds]
diegoviola has quit [Quit: WeeChat 0.4.2]
Yuuvee has joined #ruby-lang
tbuehlmann has joined #ruby-lang
imperator has quit [Quit: Valete!]
francisfish has joined #ruby-lang
gix has quit [Quit: Client exiting]
francisfish has quit [Ping timeout: 264 seconds]
quizzicol has joined #ruby-lang
jtw has joined #ruby-lang
kith has quit [Quit: kith]
kith has joined #ruby-lang
quizzicol has quit [Ping timeout: 260 seconds]
DEac- has joined #ruby-lang
saarinen has joined #ruby-lang
postmodern has quit [Quit: Leaving]
relix has joined #ruby-lang
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gix has joined #ruby-lang
chouhoulis has joined #ruby-lang
enebo has joined #ruby-lang
yfeldblum has joined #ruby-lang
guns has joined #ruby-lang
ender_ has joined #ruby-lang
ender__ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 265 seconds]
dernise_ has joined #ruby-lang
hamiljs has joined #ruby-lang
dernise_ has quit [Client Quit]
benlovell has joined #ruby-lang
ender_ has quit [Ping timeout: 260 seconds]
mucker has quit [Remote host closed the connection]
mucker has joined #ruby-lang
MrZYX is now known as MrZYX|off
MrZYX|off is now known as MrZYX
wallerdev has joined #ruby-lang
mucker has quit [Ping timeout: 260 seconds]
saarinen has quit [Quit: saarinen]
simi has quit [Ping timeout: 272 seconds]
benlovell has quit [Ping timeout: 265 seconds]
tom025 has joined #ruby-lang
<Mon_Ouie> ddd: No, it's the inject method that checks if its argument is a symbol and then uses it as a method
<Mon_Ouie> It does so because it was implemented before people came up with the idea of defining Symbol#to_proc
<ddd> ahh
<ddd> still does the same sensible ruby fallback where if no method by that name it looks for a variable?
<ddd> or is it scoped to method calling only?
sepp2k has quit [Quit: Leaving.]
jtw has quit []
mistym has joined #ruby-lang
sepp2k has joined #ruby-lang
yatish27 has joined #ruby-lang
<Mon_Ouie> It doesn't have access to the scope of where you call it, since it's a method defined in the Symbol class
vlad_sta_ has joined #ruby-lang
<Mon_Ouie> class Symbol; def to_proc; proc { |recv, *args| recv.send(self, args) }; end is essentially what it does
mistym has quit [Ping timeout: 252 seconds]
<ddd> got it
vlad_starkov has quit [Ping timeout: 265 seconds]
foucist has quit [Ping timeout: 265 seconds]
francisfish has joined #ruby-lang
coca_rails has joined #ruby-lang
huma has joined #ruby-lang
benlovell has joined #ruby-lang
achru has joined #ruby-lang
|jemc| has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yfeldblum has joined #ruby-lang
quizzicol has joined #ruby-lang
zz_jay_m is now known as Xuisce
tom025 has quit [Remote host closed the connection]
dorei has quit [Remote host closed the connection]
coca_rails has quit [Remote host closed the connection]
foucist has joined #ruby-lang
ahmedelgabri has quit []
quizzicol has quit [Ping timeout: 252 seconds]
foucist has left #ruby-lang [#ruby-lang]
kurko_ has joined #ruby-lang
thmzlt has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
guns has quit [Quit: guns]
mykoweb has quit [Remote host closed the connection]
mykoweb has joined #ruby-lang
abf has joined #ruby-lang
MrZYX is now known as MrZYX|off
mykoweb has quit [Ping timeout: 272 seconds]
yatish27 has quit [Remote host closed the connection]
yatish27 has joined #ruby-lang
mykoweb has joined #ruby-lang
yatish27 has quit [Ping timeout: 252 seconds]
jsullivandigs has joined #ruby-lang
mykoweb has quit [Ping timeout: 272 seconds]
achru has quit [Remote host closed the connection]
saarinen has joined #ruby-lang
basiliothecat has joined #ruby-lang
<Lewix> MrZYX|off: https://gist.github.com/6ewis/81364d83f7cd9b3a3726 where's my mistake
<Lewix> line 75, 82, 88 dont behave as expected. the output is empty
tbuehlmann has quit [Remote host closed the connection]
<lianj> puts retuns nil
vlad_sta_ has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
mykoweb has joined #ruby-lang
jsullivandigs has quit [Remote host closed the connection]
Nilium has quit [Ping timeout: 252 seconds]
stonerfish has joined #ruby-lang
basiliothecat has quit [Quit: Page closed]
Nilium has joined #ruby-lang
<Lewix> lianj: The bug is linked to my Struct class. The code was working when i was using class -
<lianj> ok then the .map call there is just useless. but if that not the issue ok.
snarfmason has quit [Quit: Textual IRC Client: www.textualapp.com]
nvll has joined #ruby-lang
yfeldblum has quit [Ping timeout: 272 seconds]
saarinen has quit [Quit: saarinen]
Nilium has quit [Ping timeout: 252 seconds]
daikan has quit [Remote host closed the connection]
stonerfish has quit [Quit: Leaving.]
quizzicol has joined #ruby-lang
chouhoulis has joined #ruby-lang
shinnya has quit [Ping timeout: 248 seconds]
<Lewix> lianj: what map are you talking about
Barrin6 has joined #ruby-lang
quizzicol has quit [Ping timeout: 252 seconds]
saarinen has joined #ruby-lang
Nilium has joined #ruby-lang
<r0bgleeson> Lewix: why do you define #initialize?
<canton7> yeah, don't do that
<canton7> oops, ignore me
chouhoulis has quit [Remote host closed the connection]
saarinen has quit [Client Quit]
yfeldblum has joined #ruby-lang
<Lewix> r0bgleeson: i had this before https://gist.github.com/6ewis/3e5ac6b5a91515d2ffd2. then I decided to refactor it in a more modular way, make the code cleaner
MrZYX|off is now known as MrZYX
jerrytgarcia has quit [Quit: WeeChat 0.4.2]
<r0bgleeson> Lewix: I see, you shouldn't have to do anything special there. X = Struct.new(:foo, :bar); X.new(*["1", "2"]).foo => "1"
<r0bgleeson> Lewix: what is the problem you are having?
achru has joined #ruby-lang
<r0bgleeson> Lewix: I don't know why I made that so complicated, sorry, X.new(1,2)
<Lewix> r0bgleeson: after refactoring, it is not working properly. The output of the show_ methods is blank
<r0bgleeson> okay
<r0bgleeson> the first gist is the code thats not working?
<Lewix> r0bgleeson: that's right. And the second gist is the old code that works
<r0bgleeson> 'w' is going to overwrite the file everytime
<r0bgleeson> are you creating the file on every run of this script?
<r0bgleeson> i don't see serialize_users being called.
kurko_ has quit [Quit: Computer has gone to sleep.]
<Lewix> r0bgleeson: I'm not calling it yet.
<r0bgleeson> alright, is the file you're reading populated?
MrZYX is now known as MrZYX|off
<r0bgleeson> this: ./pulse_data.txt
<Lewix> it is =)
<Lewix> give me a sec. i paste the output
MrZYX|off is now known as MrZYX
<r0bgleeson> dont do that
<r0bgleeson> it looks like you dont want to share that data
<r0bgleeson> can you remove your implementation of #initialize on Struct?
<r0bgleeson> its not neccessary
MrZYX is now known as MrZYX|off
<r0bgleeson> all of your fields are nil
<r0bgleeson> the only one you populate is 'data'
<r0bgleeson> cust_id etc are never given values
<r0bgleeson> because you override #initialize to ignore everything but 'data'
<Lewix> ahhhh
<Lewix> r0bgleeson: I needed to do that because i use data later in the code
<Lewix> it makes sense now - it's overwritting
<r0bgleeson> yeah, none of your other fields are set
<r0bgleeson> everything would be nil but 'data'
GaelanAintAround has quit [Ping timeout: 252 seconds]
zz_dlu has quit [Ping timeout: 245 seconds]
<Lewix> r0bgleeson: is there a good way to still initialize an instance variable data with struct at initialization time or I should just go back to using class
<Lewix> (without overwritting anything else)
zz_dlu has joined #ruby-lang
<r0bgleeson> when you pass data, is there a single argument to the struct?
<r0bgleeson> what are you using data for?
benlovell has quit [Ping timeout: 264 seconds]
<r0bgleeson> you can super(*fields) on the following line
<r0bgleeson> i just dont understand what 'data' is or why youre using that in place of populating the fields on the struct
<Lewix> r0bgleeson: everything after line 70 use data to output
<r0bgleeson> okay
GaelanAintAround has joined #ruby-lang
<r0bgleeson> data looks like a regular field
<r0bgleeson> why are you treating it differently?
<Lewix> r0bgleeson: i just needed a variable that contains all the fields
mykoweb has quit [Remote host closed the connection]
<r0bgleeson> i see
<r0bgleeson> you dont need to do that
<r0bgleeson> do you want the fields name?
mykoweb has joined #ruby-lang
achru has quit [Remote host closed the connection]
hahuang61 has joined #ruby-lang
<r0bgleeson> or their values?
<r0bgleeson> looks like the values
<Lewix> values
<r0bgleeson> hang on
<Lewix> and by the way super(*fields) is not working either (weird)
bzalasky has quit [Remote host closed the connection]
mykoweb_ has joined #ruby-lang
mykoweb has quit [Read error: Connection reset by peer]
atmosx has joined #ruby-lang
mistym has joined #ruby-lang
<r0bgleeson> Lewix: just use to_a for that
<r0bgleeson> remove data
<r0bgleeson> X = Struct.new(:foo, :bar); X.new(*["1", "2"]).to_a
<r0bgleeson> (pry):7: warning: already initialized constant X
<r0bgleeson> => ["1", "2"]
daikan has joined #ruby-lang
hahuang61 has quit [Ping timeout: 245 seconds]
<r0bgleeson> then you can remove initialize altogether
<r0bgleeson> and just use to_a when you need what was 'data'
<Lewix> r0bgleeson: wow
<Lewix> r0bgleeson: you guys never cease to impress me
<Lewix> r0bgleeson: thank you
<r0bgleeson> ok cool, no problem
<Xuisce> hi Lewix
<Lewix> r0bgleeson: was there another way to do it with def initialize - out of curiosity
<Lewix> hi Xuisce
<Xuisce> heya
<Xuisce> I think your a op in ##english right?
<Xuisce> hm
mistym has quit [Ping timeout: 272 seconds]
<r0bgleeson> Lewix: yeah, you could have said: Customer.new(*fields, fields)
<Xuisce> c/lear
toretore has quit [Quit: This computer has gone to sleep]
<r0bgleeson> you wouldn't have needed #initialize for that case either
<yorickpeterse> Today is a slow day
<yorickpeterse> not nearly enough happening on the Githubs
<r0bgleeson> it is indeed a slow day
<Lewix> r0bgleeson: I don't understand, it's not quite clear
<Lewix> Xuisce: more or less
francisfish has joined #ruby-lang
<r0bgleeson> Lewix: 'fields' is all the values of the struct, except 'data', the last value is an array of every value, or data, or the last member of the struct
<r0bgleeson> so you could have just passed all the values as the last argument
<Lewix> r0bgleeson: lol
<Xuisce> Lewix: care for a pm ?
<Lewix> r0bgleeson: that's ridiculous. thank you
<Lewix> Xuisce: ok?
<Xuisce> thanks
jerrytgarcia has joined #ruby-lang
mehlah has joined #ruby-lang
mbj has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
<Lewix> r0bgleeson: why is that storing an array of hashes better than a list of arrays?
vlad_starkov has joined #ruby-lang
<Lewix> (more efficient)
<r0bgleeson> where do you see an array of hashes?
<r0bgleeson> to_a should return every value
<r0bgleeson> in the struct
<r0bgleeson> if its returning hash's then you may be using that as the value
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<Lewix> 11:39 MrZYX: also having a yaml file consisting of multiple yaml files seems odd, just build a nested array and dump it in one go, or yet better build an array of hashes
<Lewix> r0bgleeson: ^^
<r0bgleeson> i don't know how the YAML file looks, it seems fine to me
<r0bgleeson> if you are trying to represent multiple documents in a single document then an array of hashes may make sense.
<Lewix> r0bgleeson: would you consider deflation part of parsing
<r0bgleeson> oh i see
<r0bgleeson> yeah
<r0bgleeson> thats not very good
<r0bgleeson> there's a few strange things going on there
<r0bgleeson> you're using CSV to wrie a file called .yaml
<r0bgleeson> if you were to use YAML, it can represent your struct just fine
hamiljs has quit [Ping timeout: 246 seconds]
<r0bgleeson> so you could dump an array of customers
<r0bgleeson> but, that means if someone ever compromised your YAML file, they may be able to load code into your program
<r0bgleeson> so a plain-text format that isnt as powerful as YAML could be better
<r0bgleeson> maybe JSON
<r0bgleeson> so an array of hashes
<Lewix> I'm thinking about moving my method serialize_users to the reporting class
quizzicol has joined #ruby-lang
<r0bgleeson> yeah
<r0bgleeson> id rename the file you create as well, its not yaml atm
<r0bgleeson> probably better to not be yaml as well
<Lewix> oh that was an oversight of my part. I used yaml until MrZYX|off suggested txt
<ljarvis> hi
<r0bgleeson> yeah
<r0bgleeson> good call
<r0bgleeson> CSV seems fine
<r0bgleeson> works well for creating new struct's
<r0bgleeson> very little work to do for read/write
<r0bgleeson> ljarvis: hello
<yorickpeterse> m8
<ljarvis> hi
<ljarvis> yorickpeterse: da fuc m&
<ljarvis> lol mand
<ljarvis> stupid 7
<r0bgleeson> makes sense
quizzicol has quit [Ping timeout: 246 seconds]
<yorickpeterse> savages
<Lewix> r0bgleeson: thanks. However, csv stores it as a list of strings of arrays https://gist.github.com/6ewis/616e70766bf162625760
<ljarvis> god damn ruby and memory
hamiljs has joined #ruby-lang
<yorickpeterse> I can confirm that
<r0bgleeson> Lewix: it shouldn't, every customer should be a row, which is an array of strings. you can read the file, map through each, and create an instance of Customer. write is just iterate and call to_a for each row
Barrin6 has quit [Read error: Connection reset by peer]
<r0bgleeson> Lewix: so your write should be something like, csv << customer.to_a
<ljarvis> gotta rewrite everything
<r0bgleeson> read is something like, rows.map { |row| Customer.new(row) }
<Lewix> r0bgleeson: thanks. ill work on it again after lunch
<r0bgleeson> cool
daikan has quit [Remote host closed the connection]
mistym has joined #ruby-lang
jstemmer has quit [Ping timeout: 252 seconds]
jstemmer has joined #ruby-lang
<ljarvis> in node js
tsou has joined #ruby-lang
<r0bgleeson> thats wise
<apeiros> /kick ljarvis no hipsters allowed
chouhoulis has joined #ruby-lang
<ljarvis> apeiros: you might want to kick *
<r0bgleeson> i wear blue jeans
<r0bgleeson> cuz i like to generalize
MrZYX|off is now known as MrZYX
lsegal has joined #ruby-lang
<yorickpeterse> node.js is so 2013
<yorickpeterse> Elixir is the next big thing
<ljarvis> I played with elixir
<r0bgleeson> elixir looks interesting
<yorickpeterse> I run a startup that focuses on disrupting the cat litter industry by providing cat litter in the cloud
<yorickpeterse> we use Elixir for it
<ljarvis> derp
<ljarvis> better use haskell
<r0bgleeson> i think it's probably a bad idea because it has too much familiarity (in syntax) with ruby, and in that case it may just be better to learn erlang
<r0bgleeson> thats just for me, an erlang programmer may find the inverse to be true
<ljarvis> i dunno, i think it's far enough from ruby once you dive into it
<yorickpeterse> ljarvis: nobody uses Haskell
<ljarvis> erlang is horrible on the eyes
<ljarvis> yorickpeterse: TELL THAT TO MATHGAMMERS
<yorickpeterse> functional brogramming doesn't scale
chouhoulis has quit [Ping timeout: 272 seconds]
<r0bgleeson> haskell is one fish in the pond
daikan has joined #ruby-lang
<yorickpeterse> but it has monads!
<ljarvis> SOLD
* apeiros goes back to write some ada
<r0bgleeson> i didnt learn haskell, but banister did or tried to
<yorickpeterse> apeiros: except Ada is actually used
<r0bgleeson> in the course of that i learnt about partial application
<r0bgleeson> which is cool to learn about and apply in ruby
<apeiros> yorickpeterse: s/except//
<ljarvis> ima be writing f# over here
<r0bgleeson> so even if you cant use it for anything real, it can be nice to steal ideas from
heftig has quit [Ping timeout: 245 seconds]
<r0bgleeson> Ada is as niche as haskell, id guess
mykoweb_ has quit [Remote host closed the connection]
<yorickpeterse> I believe Ada is quite heavily used in the aero/space industry
mykoweb has joined #ruby-lang
<r0bgleeson> it is
<r0bgleeson> thats where i heard it being used as well
<r0bgleeson> military/army/embedded devices
<r0bgleeson> pretty niche
francisfish has quit [Remote host closed the connection]
mykoweb has quit [Ping timeout: 260 seconds]
jerrytgarcia has quit [Ping timeout: 272 seconds]
francisfish has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
achru has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
Lewix_ has joined #ruby-lang
stonerfish has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
vlad_sta_ has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 252 seconds]
anekos__ has quit [*.net *.split]
Rickmasta has quit [*.net *.split]
x0f has quit [*.net *.split]
Senjai has quit [*.net *.split]
rue has quit [*.net *.split]
Jacky has quit [*.net *.split]
hopkins83 has quit [*.net *.split]
wmoxam has quit [*.net *.split]
eval-in has quit [*.net *.split]
soahccc has quit [*.net *.split]
joast has quit [*.net *.split]
hachiya has quit [*.net *.split]
djinni` has quit [*.net *.split]
tpope has quit [*.net *.split]
drollwit has joined #ruby-lang
quizzicol has joined #ruby-lang
hopkins83 has joined #ruby-lang
anekos__ has joined #ruby-lang
Rickmasta has joined #ruby-lang
x0f has joined #ruby-lang
Senjai has joined #ruby-lang
Jacky has joined #ruby-lang
rue has joined #ruby-lang
wmoxam has joined #ruby-lang
eval-in has joined #ruby-lang
soahccc has joined #ruby-lang
joast has joined #ruby-lang
hachiya has joined #ruby-lang
djinni` has joined #ruby-lang
tpope has joined #ruby-lang
x0f_ has joined #ruby-lang
quizzicol has quit [Ping timeout: 269 seconds]
Jacky has quit [Excess Flood]
x0f has quit [Ping timeout: 272 seconds]
phansch has quit [Quit: Leaving]
robbyoconnor has quit [Ping timeout: 252 seconds]
MrZYX is now known as MrZYX|off
jtw has joined #ruby-lang
Jacky has joined #ruby-lang
<yorickpeterse> whitequark: OPEN SAUCE FOUNDRY ALREADY
<yorickpeterse> I know you're reading this because you're on Github
<yorickpeterse> also fuck me now I sound like a creeper
MrZYX|off is now known as MrZYX
hamiljs has quit [Ping timeout: 264 seconds]
hachiya has quit [Ping timeout: 272 seconds]
hachiya has joined #ruby-lang
VTLob has quit [Read error: Operation timed out]
sepp2k has quit [Read error: Connection reset by peer]
mykoweb has joined #ruby-lang
achru_ has joined #ruby-lang
achru has quit [Ping timeout: 252 seconds]
mykoweb has quit [Ping timeout: 260 seconds]
robbyoconnor has joined #ruby-lang
mucker has joined #ruby-lang
kotk has quit [Read error: Connection reset by peer]
Minimalist has joined #ruby-lang
mistym has quit [Remote host closed the connection]
vlad_sta_ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
DouweM has quit [Read error: Connection reset by peer]
enebo has quit [Quit: enebo]
AKASkip has joined #ruby-lang
VTLob has joined #ruby-lang
achru_ has quit []
elia has joined #ruby-lang
arBmind has quit [Ping timeout: 260 seconds]
quizzicol has joined #ruby-lang
quizzicol has quit [Ping timeout: 252 seconds]
Minimalist has quit [Read error: Connection reset by peer]
CodeBunny has joined #ruby-lang
zer0ne has joined #ruby-lang
imjacobclark has joined #ruby-lang
<imjacobclark> Can anybody give me any better insights into what the Rake file is for? For example, could I use the Rake file to automate the setup of an application, ie, demonise a service or configure a database, etc?
<|jemc|> yeah, the Rakefile csn br used for any any automated task
<|jemc|> but usually for building, testing, deploying, etc
<imjacobclark> Ah I see cool, thanks!
<imjacobclark> Could I get the rakefile to run 'bundle install'?
vlad_sta_ has joined #ruby-lang
<|jemc|> of course
<CodeBunny> absolutely
<|jemc|> task :bundinst do
<|jemc|> exec "bundle install"
<|jemc|> end
<imjacobclark> Ah! I see, so you run shell commands through exec?
<imjacobclark> Fantastic!
vlad_sta_ has quit [Read error: Connection reset by peer]
huma has quit [Ping timeout: 252 seconds]
<|jemc|> yeah, or through backticks
<|jemc|> `bundle install`
<|jemc|> or there are other options too
<|jemc|> it's worth reading about the differences
<imjacobclark> Yeah I think I will
<CodeBunny> any cucumber or pageObject wiz's around
vlad_starkov has quit [Ping timeout: 264 seconds]
<|jemc|> imjacobclark: running shell commands is a general ruby thing
<|jemc|> rake is just a convenient way to specify a set of interdependent tasks
<imjacobclark> Yeah, so I can specify a number of 'tasks' for example 'test' 'setup' 'deploy'
<imjacobclark> For 'setup' I may have 'exec bundle install'
Elico has quit [Quit: Elico]
Elico has joined #ruby-lang
<CodeBunny> dont you mean bundle exec install?
heftig has joined #ruby-lang
<|jemc|> neh, he means exec "bundle install"
<imjacobclark> yeah sorry
<imjacobclark> I mean id run the command
<CodeBunny> oh... right
<imjacobclark> ruby = exec
<imjacobclark> then
<imjacobclark> bundle install
<imjacobclark> > exec "bundle install"
<|jemc|> and your tasks can call eachother by specifying prerequisite tasks
<|jemc|> task :c => [:a, :b] do ... end
<|jemc|> so c will also run a and b first
<imjacobclark> I see, okay cool!
zer0ne has left #ruby-lang [#ruby-lang]
vlad_starkov has joined #ruby-lang
piyo has joined #ruby-lang
jerrytgarcia has joined #ruby-lang
hahuang61 has joined #ruby-lang
francisfish has joined #ruby-lang
_TheRev_ has joined #ruby-lang
drollwit has quit []
hahuang61 has quit [Ping timeout: 264 seconds]
francisfish has quit [Ping timeout: 272 seconds]
thmzlt has quit [Remote host closed the connection]
thmzlt has joined #ruby-lang
prc has joined #ruby-lang
sepp2k has joined #ruby-lang
<imjacobclark> Whats the best way to execute RSpec tests from Rake?
Wardrop has joined #ruby-lang
jaska has joined #ruby-lang
jaska has left #ruby-lang [#ruby-lang]
piyo has left #ruby-lang ["ERC Version 5.3 (IRC client for Emacs)"]
MrZYX is now known as MrZYX|off
<Wardrop> I want to inject local variables into a proc using Proc#binding.local_variable_set
quizzicol has joined #ruby-lang
gix has quit [Quit: Client exiting]
<Wardrop> The problem is that Proc#binding is a copy of the binding, not the original binding, hence any changes made to it are not set against the proc
<Wardrop> Can anyone think of any other creative ways of defining a local variable within a Proc AFTER it's been defined.
<apeiros> I can't think of any reasonable use case
<apeiros> the only one I can think of is templating, and that doesn't bother that you're using a copy
<Wardrop> It's for a DSL
<apeiros> yeah, well, let me put it this way: if you dynamically f'ck with lvars, you're doing it wrong™
gix has joined #ruby-lang
<Wardrop> apeiros: I would almost always be of the same opinion. However, in this case the user is actually choosing the name of the local variable, it's just they're not putting it between the |a,b| portion of the block definition.
<Wardrop> They're defining a "named capture" in the content of a web framework.
<Wardrop> Any collisions with other local variables is of their own doing.
<Wardrop> context* not content
<apeiros> Wardrop: and how could the user potentially use the actual *local variable*?
<apeiros> can the user inject code?
<Wardrop> E.g. proc { puts hello }
<Wardrop> I would then inject the local `hello` variable later before the proc is actually executed.
quizzicol has quit [Ping timeout: 260 seconds]
<Wardrop> d
<Wardrop> Here's a full example: get('/::id/::title') { p id, title }
<Wardrop> Otherwise, the user either needs to repeat themselves: get('/::id/::title') { |id, title| p id, title }
MrZYX|off is now known as MrZYX
<Wardrop> Or they need to use an accessor: get('/::id/::title') { p captures[:id], captures[:title] }
<apeiros> Wardrop: id/title can also be methods
<apeiros> maybe that helps
<Wardrop> Indeed they could, but in this case the user deals with them in the same way they'd deal with Proc argument that collide with methods: `self.id` and `self.title`
<Wardrop> Consider more like I'm defining the Proc arguments on behalf of the user
<Wardrop> Consider it* more...
<Wardrop> Oh sorry, you were suggesting a solution
<Wardrop> The problem with that is that can legitimately override methods in the context the Proc is executed in.
<apeiros> IMO the better solution would be to provide a proper object as argument: get(…) { |req| req.id, req.title }
<Wardrop> Local variables is the nicest solution believe it or not
kotk has joined #ruby-lang
<apeiros> I don't believe it
<Wardrop> apeiros: Actually that's how it's currently done.
<Wardrop> But in that case, it's generally easier to define anonymous captures like this: get('/*/*') { |id, title| p id, title }
<Wardrop> I'm trying to make named captures less verbose
<Wardrop> This is what I'm working on anyway: http://scorchedrb.com/docs/fundamentals/routing
<apeiros> Wardrop: you're trying to abuse lvar system as a hash. don't.
<apeiros> it may be convenient in a small number of cases. it's quite probably headache inducing in many more.
<apeiros> if you really must - instance_eval or _exec the proc and provide the captures as methods
<apeiros> but I find it ugly beyond reason
<Wardrop> apeiros: It's probably not possible anyway :)
<apeiros> well, what I suggested is definitively possible (and trivial).
<apeiros> but just to repeat myself: it's not the solution I'd choose.
<pipecloud> Wardrop: Why do you want to do this?
<pipecloud> Wardrop: Why would I use scorched over an even less magical sinatra?
<pipecloud> It appears to be some junk and glue that build on what I'd expect from sinatra.
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
lsegal has joined #ruby-lang
lsegal has quit [Client Quit]
atmosx has quit [Quit: Lost in trance]
lsegal has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
elia has quit [Read error: Connection reset by peer]
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
MrZYX is now known as MrZYX|off
lsegal has joined #ruby-lang
MrZYX|off is now known as MrZYX
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
elia has joined #ruby-lang
duckinator has quit [Ping timeout: 264 seconds]
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
saarinen has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
daikan has quit [Remote host closed the connection]