havenwood changed the topic of #ruby to: Rules & more: http://ruby-community.com || Ruby 2.3.1; 2.2.5; 2.1.9: https://ruby-lang.org || Paste >3 lines of text on https://gist.github.com || logs @ http://irclog.whitequark.org/ruby/
grs has joined #ruby
tgeeky has joined #ruby
jgt1 has quit [Ping timeout: 240 seconds]
<tgeeky> can someone with a bit of experience help me understand where "LoadError" is defined
<tgeeky> I am getting "LoadError: 193: %1 is not a valid Win32 application" (from tiny_tds)
<tgeeky> but the problem is, it is a valid Win32 application.
<tgeeky> The .so file is where it should be, and it's fine, and it runs fine normally but it's screwing up when I start with rake
kareeoleez has quit [Ping timeout: 240 seconds]
<tgeeky> I know this is a 64-bit versus 32-bit problem
leitz has joined #ruby
austinprog has quit [Ping timeout: 240 seconds]
mbreedlove has joined #ruby
whathappens has quit [Remote host closed the connection]
ellistaa has quit [Quit: ellistaa]
<shevy> sounds like a custom error
<shevy> normal LoadErrors tend to look like this: "LoadError: cannot load such file -- foo"
chipotle has quit [Ping timeout: 265 seconds]
mosh has quit [Changing host]
mosh has joined #ruby
mosh has joined #ruby
<tgeeky> it's like something is a 32-bit application calling a 64-bit one
cdg has quit [Remote host closed the connection]
<tgeeky> but i can't see any of that
<tgeeky> shevy: yes, I agree
sepp2k has quit [Read error: Connection reset by peer]
<tgeeky> is there any more output I can get other than trace?
cdg has joined #ruby
solars has quit [Ping timeout: 240 seconds]
ellistaa has joined #ruby
mbreedlove has quit [Client Quit]
kareeoleez has joined #ruby
SilverKey has quit [Quit: Halted.]
sinkensa_ has quit [Remote host closed the connection]
marr has quit [Remote host closed the connection]
cdg has quit [Ping timeout: 250 seconds]
kus has joined #ruby
kus has quit [Max SendQ exceeded]
mbreedlove has joined #ruby
nando294021 has joined #ruby
nando293921 has quit [Read error: Connection reset by peer]
kareeole_ has joined #ruby
nankyokusei has joined #ruby
skingsbu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kareeol__ has joined #ruby
kareeoleez has quit [Ping timeout: 260 seconds]
<claw> http://paste.debian.net/683952/ how would i do this so can use a block on it ?
<claw> i am currently confused about the &block and yield things
<claw> i wnant to be able to do: Foo.open("/tmp/bar", "w") { |f| f.write "HELLO" }
kareeoleez has joined #ruby
chepoweon has quit [Ping timeout: 252 seconds]
kareeole_ has quit [Ping timeout: 244 seconds]
nankyokusei has quit [Ping timeout: 246 seconds]
<mherold> You want `f` to be the Foo or the File in that block?
<claw> i want it to be the File
saneax is now known as saneax_AFK
kareeol__ has quit [Ping timeout: 246 seconds]
diego1 has joined #ruby
ur5us has joined #ruby
<mherold> You don't need the temporary variable if you don't want to have one
diego1 has joined #ruby
diego1 has quit [Changing host]
diegoviola is now known as Guest96266
pawnbox has joined #ruby
diego1 is now known as diegoviola
bruno- has joined #ruby
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bruno- is now known as Guest91387
Guest96266 has quit [Ping timeout: 260 seconds]
moeabdol has joined #ruby
Ocratech has quit [Read error: Connection reset by peer]
diego1 has joined #ruby
diego1 has quit [Changing host]
diego1 has joined #ruby
diegoviola is now known as Guest408
diego1 is now known as diegoviola
<claw> mherold: that works thank you
<mherold> You're welcome
<claw> actually i already got it right but my testing was wrong -.-
<mherold> Whoops :)
pawnbox has quit [Ping timeout: 260 seconds]
Guest408 has quit [Ping timeout: 260 seconds]
Avinty-L has joined #ruby
moeabdol has quit [Ping timeout: 260 seconds]
ixti has quit [Quit: WeeChat 1.5]
Avinty-L has quit [Read error: Connection reset by peer]
Avinty-L_ has joined #ruby
Avinty-L_ has quit [Read error: Connection reset by peer]
kareeoleez has quit [Remote host closed the connection]
codecop has quit [Remote host closed the connection]
Devalo has joined #ruby
dstarh has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
Devalo has quit [Ping timeout: 250 seconds]
blackmesa has quit [Ping timeout: 240 seconds]
davedev24 has quit []
yaw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jancel has joined #ruby
yqt has quit [Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/]
halfamind has joined #ruby
halfamind has quit [Read error: Connection reset by peer]
halfamind has joined #ruby
ur5us has joined #ruby
Nanuq has joined #ruby
yfeldblum has joined #ruby
jancel has quit [Ping timeout: 240 seconds]
stardiviner has joined #ruby
ellistaa has quit [Quit: ellistaa]
ellistaa has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
CloCkWeRX1 has joined #ruby
CloCkWeRX1 has quit [Client Quit]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xall has quit [Ping timeout: 240 seconds]
ur5us has quit [Read error: Connection reset by peer]
InfraRuby has quit [Remote host closed the connection]
ur5us has joined #ruby
startupality has joined #ruby
Yzguy has joined #ruby
nawn has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
blaxter has quit [Read error: Connection reset by peer]
banister has joined #ruby
nawn has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
nawn has joined #ruby
<zacts> yo rubyists
pawnbox has joined #ruby
karmatr0n has joined #ruby
bronson has joined #ruby
<nawn> :D
startupality has quit [Quit: startupality]
liulantao has joined #ruby
neanderslob has quit [Remote host closed the connection]
mbreedlove has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 260 seconds]
ur5us has quit [Remote host closed the connection]
sdothum has quit [Read error: Connection reset by peer]
bronson has quit [Ping timeout: 252 seconds]
noobsu has joined #ruby
nawn has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
nawn has joined #ruby
AnoHito_ has joined #ruby
neanderslob has joined #ruby
sdothum has joined #ruby
Gasher has quit [Quit: Leaving]
feyn has joined #ruby
Miron has quit [Ping timeout: 250 seconds]
xMopxShell has quit [Ping timeout: 250 seconds]
feyn has quit [Client Quit]
noobsu has quit [Ping timeout: 244 seconds]
eljimmy has quit [Ping timeout: 250 seconds]
jtdowney has quit [Ping timeout: 250 seconds]
AnoHito has quit [Ping timeout: 250 seconds]
statelesscode has quit [Ping timeout: 250 seconds]
djbkd has joined #ruby
statelesscode_ has joined #ruby
jaguarmagenta has quit [Ping timeout: 250 seconds]
am55 has quit [Ping timeout: 250 seconds]
nullFxn has quit [Ping timeout: 250 seconds]
surrounder has quit [Ping timeout: 250 seconds]
cybrside has quit [Ping timeout: 250 seconds]
ellistaa has quit [Quit: ellistaa]
surrounder has joined #ruby
devyn has quit [Ping timeout: 250 seconds]
Miron has joined #ruby
ellistaa has joined #ruby
am55 has joined #ruby
jaguarmagenta has joined #ruby
diegoviola has quit [Ping timeout: 260 seconds]
cybrside has joined #ruby
nullFxn has joined #ruby
eljimmy has joined #ruby
kam270 has quit [Ping timeout: 276 seconds]
devyn has joined #ruby
devyn has quit [Changing host]
devyn has joined #ruby
jtdowney has joined #ruby
jtdowney has joined #ruby
<ellistaa> what is the best way to make an HTTP get request? is there a gem everyone uses or something in standard library?
twintail has quit [Ping timeout: 250 seconds]
oetjenj has quit [Ping timeout: 265 seconds]
<Radar> ellistaa: I like HTTParty
<ellistaa> Radar: i remember using that & i liked it. do you think its secure enough for me to use @ work?
<ellistaa> like would most corporations OK it
speakingcode has quit [Ping timeout: 250 seconds]
oetjenj has joined #ruby
<Radar> I don't understand the question.
<ellistaa> Radar: some companies dont let devs use any gem they want, do you think HTTParty is secure / credible enough that most corporations would be like ‘ok use that'
hiddenloop has quit [Ping timeout: 250 seconds]
hiddenloop has joined #ruby
<Radar> Depends on the corporation
akiTendo has quit [Quit: akiTendo]
<ellistaa> Radar: lets say google
austinprog has joined #ruby
houhouli_ has joined #ruby
<Radar> You're asking me
xMopxShell has joined #ruby
speakingcode has joined #ruby
<Radar> What a corporation's opinion is
<Radar> about a gem
<Radar> Yes?
<ellistaa> yes
<Radar> Does this not seem ridiculous to you too?
<ellistaa> no not at all
<Radar> Why do you think I can speak on behalf of a corporation?
houhoulis has quit [Ping timeout: 250 seconds]
<Radar> That I don't even work for!
<Radar> ?try
<ruby[bot]> Why don't you try it and see for yourself?
grs has quit [Ping timeout: 250 seconds]
<ellistaa> do u not have the ability to discern weather a gem is relatively credible or absolutely not, why is this such a difficult question for u
araujo_ has quit [Quit: Leaving]
<Radar> Are you asking yourself that?
<Radar> 19 million downloads
<Radar> Is that not credible enough?
<ellistaa> if its so obvious why did u make it so difficult
<Radar> It's a popular HTTP gem. If it wasn't secure / good, why would it have so many downloads?
<Radar> Because I expect people to do their due diligence before coming here.
<ellistaa> thats my thought, just getting a second opinion perhaps there’s something im not aware of
LoneHermit has joined #ruby
ekinmur has joined #ruby
twintail has joined #ruby
ellistaa has left #ruby [#ruby]
grs has joined #ruby
<rubyrubyruby> 19 million downloaders can't be wrong
leitz has quit [Quit: Nappy time]
janebootydoe has joined #ruby
ReK2 has quit [Remote host closed the connection]
dikaio has joined #ruby
LaT0rtue has joined #ruby
LaT0rtue has quit [Client Quit]
ReK2 has joined #ruby
ReK2 has joined #ruby
ReK2 has quit [Changing host]
LaT0rtue has joined #ruby
halfamind has quit [Quit: Leaving.]
matp has quit [Ping timeout: 252 seconds]
djbkd has quit [Remote host closed the connection]
rkoller has quit [Ping timeout: 265 seconds]
wldcordeiro has joined #ruby
halfamind has joined #ruby
yfeldblum has quit [Ping timeout: 250 seconds]
halfamind has quit [Client Quit]
nawn has left #ruby ["ERC (IRC client for Emacs 24.5.1)"]
akiTendo has joined #ruby
arescorpio has joined #ruby
domgetter has joined #ruby
brianpWins_ has joined #ruby
<domgetter> Is there a way to have a ruby script run in the background from within the script?
<bougyman> define 'background'
brianpWins has quit [Ping timeout: 246 seconds]
brianpWins_ is now known as brianpWins
xall has joined #ruby
<domgetter> bougyman: so as to keep running but release control back to the shell.
<domgetter> that is, do the same thing as calling it with a trailing &, but I don't want the whole thing to run in the background from the get go
<bougyman> there are solid mechanisms to do that without going into some spooky daemon or background space.
<domgetter> just from a certain point on
<bougyman> I use runit, personally.
chip_ has joined #ruby
<bougyman> it sounds like what you want is a special case, though.
Azure has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bougyman> see the daemons gem
moeabdol has joined #ruby
<domgetter> bougyman: To add more info, what I want is to know that a ruby script has gotten to a certain state (ready to accept client connections) before I start trying to connect to it
<bougyman> ok that does sound like something runit could do.
smathy is now known as smathy_afk
betafive has joined #ruby
moeabdol has quit [Ping timeout: 276 seconds]
betafive has quit [Client Quit]
coffeecupp has joined #ruby
matp has joined #ruby
<postmodern> with the ffi gem, how do you define enum types where in the C equivalent you have "FOO = 1, ..., BAR = FOO"?
SCHAAP137 has quit [Quit: Leaving]
chip_ has quit [Ping timeout: 276 seconds]
trinaldi has quit [Quit: WeeChat 1.5-rc1]
halfamind has joined #ruby
arescorpio has quit [Read error: Connection reset by peer]
<postmodern> er nevermind
rocfig has joined #ruby
oetjenj has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Devalo has joined #ruby
Guest91387 has quit [Read error: Connection reset by peer]
Devalo has quit [Ping timeout: 250 seconds]
rocfig has quit [Quit: This computer has gone to sleep]
liulantao has quit []
liulantao has joined #ruby
bruno- has joined #ruby
halfamind has quit [Quit: Leaving.]
Madplatypus has joined #ruby
domgetter has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
skolman_ has joined #ruby
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
stardiviner has quit [Ping timeout: 244 seconds]
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karmatr0n has quit [Ping timeout: 240 seconds]
halfamind has joined #ruby
|2701 has quit [Quit: Connection closed for inactivity]
stardiviner has joined #ruby
aharlan has joined #ruby
halfamind has quit [Client Quit]
karmatr0n has joined #ruby
braincrash has quit [Quit: bye bye]
cdg has joined #ruby
liulantao has quit []
mr_robot_ has joined #ruby
pat_ has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
halfamind has joined #ruby
gix has quit [Ping timeout: 250 seconds]
johnny56_ has quit [Quit: WeeChat 1.4-dev]
moeabdol has joined #ruby
houhoulis has joined #ruby
bruno- has quit [Ping timeout: 260 seconds]
braincrash has joined #ruby
Yzguy has quit [Quit: Zzz...]
sneakerhax has quit [Ping timeout: 260 seconds]
Yiota has joined #ruby
LaT0rtue has quit [Read error: Connection reset by peer]
pawnbox has joined #ruby
gix has joined #ruby
houhouli_ has quit [Ping timeout: 246 seconds]
sp4rrow has joined #ruby
sp4rrow has quit [Client Quit]
elifoster has joined #ruby
zast has joined #ruby
mr_robot_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
oetjenj has joined #ruby
m_antis has joined #ruby
arescorpio has joined #ruby
bronson has joined #ruby
halfamind has quit [Quit: Leaving.]
pawnbox has joined #ruby
wigust has quit [Remote host closed the connection]
SilverKey has joined #ruby
alex88 has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
<alex88> hi there, I'm trying to parse this csv https://gist.github.com/alex88/0f0693e217dd8dba24be9b3dd0db4010 but I get the error you can find in the gist, however I don't see anything special on that line
sneakerhax has joined #ruby
LoneHermit has quit [Remote host closed the connection]
<alex88> I know it's a weird csv, but this is what the customer can do... :(
m_antis has quit [Quit: Leaving]
LoneHerm_ has joined #ruby
m_antis has joined #ruby
m_antis has quit [Remote host closed the connection]
m_antis has joined #ruby
Nice_BikeMaN has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
Xaitec has joined #ruby
rorra_ has joined #ruby
<monoprotic> alex88 it seems to work for me
rorra has quit [Ping timeout: 240 seconds]
idefine has joined #ruby
moeabdol has quit [Ping timeout: 252 seconds]
<alex88> monoprotic: damn... let me see if I can make a reproducible link on repl.it
oetjenj has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aeterne has quit [Read error: Connection reset by peer]
<alex88> copy pasted the file content and it works, but reading from file doesn't..
karmatr0n has quit [Ping timeout: 265 seconds]
<alex88> File.read with the same filename i use for CSV parse shows the file
moeabdol has joined #ruby
<alex88> maybe there are some special characters or s*** like that
zzak has quit [Remote host closed the connection]
<monoprotic> might be
<monoprotic> what a pain
halfamind has joined #ruby
<alex88> yeah a lot, and this is an output from a "tech guy for that company", he might never have seen a csv
<alex88> one empty line after each data line...
zzak has joined #ruby
<alex88> well even gist complains about stuff on the csv file
moeabdol has quit [Ping timeout: 240 seconds]
<monoprotic> yeah i tried to figure that out
rbennacer has joined #ruby
<monoprotic> might be a weird quote character
<monoprotic> two diffrent quote characters which were both coerced into &quot; on the website
<alex88> in atom if I type " in the search field it correctly highlights the quotes in the file, so they should be fine
<alex88> is there a way to see all the other chars? like \r \n etc?
<alex88> so, by default it gives error on line 3, if I remove the first line it says error is on 4th line :S
<alex88> if I remove 2 lines, error on line 6
<alex88> wtf
<monoprotic> hrm.
diegoaguilar has quit [Remote host closed the connection]
<alex88> here we go
<alex88> so maybe there were some dirty stuff on the file
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
johnny56 has joined #ruby
<monoprotic> weird
<monoprotic> i dont see any weird line endings in the raw file i downloaded
<monoprotic> just \n\n
hk238 has joined #ruby
<alex88> monoprotic: how do you check that?
<alex88> so I can test the same on my input file
<monoprotic> many text editors let you see line endings
<monoprotic> i was looking at a hexdump
<alex88> oh way better
<monoprotic> not sure if uploading to gist does anything to the file, though
ferr has quit [Quit: WeeChat 1.4]
skolman_ has quit [Remote host closed the connection]
<alex88> monoprotic: oh no, the file was copy pasted, since the original file is much larger
<alex88> maybe copy-paste does something
skolman_ has joined #ruby
<monoprotic> how much larger? too large to upload?
<alex88> oh nope, but I thought it was something different so I just copied the last 10 lines instead of the 11k lines
<alex88> also because csv said error was on line 3
skolman_ has quit [Ping timeout: 265 seconds]
<alex88> monoprotic: anyway, thanks a lot for helping
<monoprotic> np
<monoprotic> good luck
jaguarmagenta has joined #ruby
halfamind has quit [Quit: Leaving.]
Biopandemic has quit [Ping timeout: 252 seconds]
jancel has joined #ruby
m_antis has quit [Ping timeout: 246 seconds]
bruno- has joined #ruby
SyncYourDogmas has joined #ruby
Xaitec has quit [Remote host closed the connection]
bruno- has quit [Ping timeout: 265 seconds]
djbkd has joined #ruby
DanyC has joined #ruby
aharlan has quit [Quit: Textual IRC Client: www.textualapp.com]
ffs has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
<ffs> what's a good source for learning ruby if i'm already very comfortable with other related languages like python, c, and lisp? i'm terrible at learning from docs/manpages
halfamind has joined #ruby
<ffs> "There are some enforced case-conventions (ex. class names start with a capital letter, variables start with a lowercase letter)." does this mean classes are not first-class objects?
<nofxx> ffs, it is from start, but for you it'll be 15 min: "learn to program by chris pine"
<nofxx> ffs, oh boy, no idea how they ARE =D hehe
<nofxx> python OO isn't truly OO. You see what I mean.
<nofxx> ffs, actually, Constants need capital, and classes are constants
jancel has quit [Remote host closed the connection]
<nofxx> but usually you'll see constants in upcase
<ffs> but can you then assign a variable to that class?
<nofxx> yup, instance and class variables
<ffs> or the other way around, whatever the correct order of words is
hilo has quit [Ping timeout: 265 seconds]
<ffs> so in python, the underlying philosophy is that everything is really just a dict and most of the "design decisions" are really just consequences of that. is there a similar philosophy in ruby?
agent_white has joined #ruby
shakes has quit [Quit: Leaving]
<nofxx> ffs, only philosophy is have fun... and make things readable
<nofxx> ruby ppl hate when you need to comment stuff, it should be *english* readable ;)
darkxploit has quit [Ping timeout: 246 seconds]
coffeecupp has quit [Quit: WeeChat 1.5]
<nofxx> ffs, next unless array.include? 3 what's comment for that? "Go to next unless array include 3"? =D
<rubyrubyruby> ffs: in ruby everything is chunky bacon
<ffs> if what you're doing doesn't require comments you aren't working on anything interesting
dikaio has joined #ruby
<nofxx> you missed the point
m_antis has joined #ruby
<nofxx> and yes, a 50 lines mathematical equation for rocket fuel analysis won't be much readable... even in english
rbennacer has quit [Remote host closed the connection]
<nofxx> ffs, but as a tip from python: everything is object here... so expect foo to respond methods
<ffs> ?
<nofxx> ffs, eg: count a string: python count(str) ruby: str.count
<nofxx> don't remember the python command tho*
<ffs> python has str.count
<nofxx> in 3? didn't have when I coded, can swear
<nofxx> but anyways, you got it
<ffs> 2.7 >>> "abbbc".count("b")
RegulationD has joined #ruby
<ffs> outputs 3
<nofxx> damn... can swear I lost some time with this char counting... hence why I remember heh
<nofxx> but there's a functional counterpart as I said: count(str) right?
<ffs> i think it had count since at least 2.5
akiTendo has quit [Quit: akiTendo]
<ffs> there's len()
<nofxx> yup, that one
<ffs> i don't think there's count
<ffs> but there's technically str.__len__(), too
halfamind has quit [Quit: Leaving.]
janebootydoe2 has joined #ruby
<ffs> len(x) <-> x.__len__()
<nofxx> yeah.. in ruby there's #count and #size
janebootydoe has quit [Ping timeout: 265 seconds]
RegulationD has quit [Ping timeout: 276 seconds]
crystal77 has joined #ruby
Devalo has joined #ruby
janebootydoe2 has quit [Client Quit]
rorra_ has quit [Quit: Leaving...]
<alex88> monoprotic: anyway, problem is back, actually I've seen that just opening/saving file with atom changes it and makes it readable by csv
<monoprotic> annoying
<alex88> yeah, well, I don't care, I'll ask them to get some better made csv
<nofxx> alex88, I think I know, csv utf8 issues... wait a sec!
<nofxx> is it utf8?
<alex88> nofxx: file -I shows charset=us-ascii
<alex88> not 100% sure how to check
<nofxx> well, worth a try... trying to find here the code... just a sec
<alex88> nofxx: error was "CSV - Unquoted fields do not allow \r or \n" and after a chomp seems it's fixed but now error was back...
<alex88> sure thank you!
<nofxx> alex88, now I don't remember what the issue was, but this been working since.. with some ill formatted csvs:
<nofxx> CSV.parse(File.open(file, 'rb:UTF-16:UTF-8'), { col_sep: "\t" })
<alex88> nofxx: oh I've also read to use rb when opening file
Devalo has quit [Ping timeout: 250 seconds]
austinprog has quit [Quit: Leaving]
<nofxx> yeah, and maybe change the encodings... iirc its rb:FROM:TO
smathy_afk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<alex88> nofxx: here I have to do https://gist.github.com/alex88/00f8e54e0d45f98fc5bba0eb6c6513c3 to clear lines and remove metacharacters that were creating that issue
<alex88> anyway let me try that :D
<nofxx> cool.. going to eat, let me know later =D
<alex88> sure, enjoy :)
nawn has joined #ruby
blackgoat has joined #ruby
mr_robot_ has joined #ruby
ta_ has quit [Remote host closed the connection]
`tim` has joined #ruby
<alex88> nofxx: nothing, same error, I've still to rely on .chomp on every line :D
<alex88> the funny part was that csv was saying error on line 3, then I removed line 1 and it said error on line 4 :D
kareeoleez has joined #ruby
mynameisbrian has joined #ruby
<bazzy> I want to programatically add to a class definition from an instance of a closely related class
<bazzy> BUT
tax has joined #ruby
<bazzy> I want to be able to use its instance variables in the addition to the class definition
<bazzy> or local variable
<bazzy> I tried using class_eval, but the local variable's meaning immediately disappears in the block
ffs has left #ruby ["Leaving"]
mr_robot_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
arescorpio has quit [Quit: Leaving.]
<bazzy> I fixed it .. it was a name clash .. (the class had a method or variable/accessor/etc of the same name)
djbkd has quit []
<mynameisbrian> https://gist.github.com/brianbower/04001c8573da358ada1f70a1dde87e84 why would we call it: greet['hello'] and not: greet.['hello'] ?
<mynameisbrian> since [] is basically the method name
<mynameisbrian> also, do people actually use this?
<mynameisbrian> I'm just learning about it since I'm reading about Hash[1,2,3,4]
<mynameisbrian> wait, I mean... greet.[]('hello')
eljimmy has quit [Ping timeout: 276 seconds]
<mynameisbrian> well, we can call it that way. But I don't know why greet['hello'] works in this case.
idefine has quit [Remote host closed the connection]
<zacts> hi
<bazzy> mynameisbrian, because that is an operator overloader (I assume)
karmatr0n has joined #ruby
<mynameisbrian> yeah I figured its something like that
<mynameisbrian> at first I thought greet.[]('hello') wasn't working so I was confused
mr_robot_ has joined #ruby
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bazzy> you are just customizing what the [] operator does.. but it's always after the name .. like with arrays
<bazzy> or string elements ...
<mynameisbrian> I think I did: greet.['hello'] instead of greet.[]('hello') so it just made me confused about the entire thing.
dikaio has joined #ruby
elifoster has quit [Ping timeout: 244 seconds]
<mynameisbrian> yeah that's what I was thinking
dikaio has quit [Max SendQ exceeded]
<mynameisbrian> Do you see people using it? I think it could be useful as some default way like Hash and Array work
<bazzy> I'm a ruby n00b, this is my first time even acknowleding that ruby has operator overloading .. Look what i found, all the operators apparently that ruby can overload: http://stackoverflow.com/questions/3331962/list-of-ruby-operators-that-can-be-overridden-implemented
bruno- has joined #ruby
<mynameisbrian> awesome
<mynameisbrian> I forgot what the term was so I couldn't look it up
nanoz has joined #ruby
elaptics`away is now known as elaptics
<mynameisbrian> I"m having a lot of fun learning ruby
<mynameisbrian> haven't learned a language in awhile
karmatr0n has quit [Ping timeout: 250 seconds]
<mynameisbrian> well actually I think "operator overload" doesn't work in this case, since [] is a method name and not being used as an operator
<mynameisbrian> but since [] commonly follows without the dot operator it looks like they just made it work that way
<mynameisbrian> just like 1 + 1 works and we don't have to do 1.+(1) every time
zast has quit [Remote host closed the connection]
bruno- has quit [Ping timeout: 244 seconds]
dionysus69 has joined #ruby
idefine has joined #ruby
<alex88> mmhh https://repl.it/CQvu what's wrong here? date seems correct to me
<alex88> format shouldn't be the same as strftime?
lxsameer has joined #ruby
<monoprotic> are those dashes valid?
Es0teric has quit [Quit: Computer has gone to sleep.]
idefine has quit [Ping timeout: 246 seconds]
<dionysus69> any ideas why I might be getting this error when launching middleman? https://gist.github.com/anonymous/07f0f08755935c133fdeb56a3245dbb6
SilverKey has quit [Quit: Halted.]
nawn has quit [Remote host closed the connection]
nawn has joined #ruby
raeoks has joined #ruby
<mynameisbrian> Why do we need splat operator when I can simply do: c = 1, 2, 3 ?
<mynameisbrian> and then c is an array
<bazzy> You can use a splat in a method definition to gather up any remaining arguments
LoneHerm_ has joined #ruby
TomPeed has joined #ruby
SilverKey has joined #ruby
<alex88> monoprotic: seems they're valid only when formatting a date to a string, not when parsing
<alex88> nevermind, removed them and seems to work
<alex88> thanks
<mynameisbrian> I know what the splat operator does, but I don't know why the last parameter wouldn't eat up the rest of the arguments, when you can do that with a variable: c = 1, 2, 3
bronson has joined #ruby
`tim` has quit [Ping timeout: 260 seconds]
<mynameisbrian> >> c = (1, 2, 3)
<ruby[bot]> mynameisbrian: # => /tmp/execpad-255545bcd18b/source-255545bcd18b:2: syntax error, unexpected ',', expecting ')' ...check link for more (https://eval.in/571696)
<mynameisbrian> >> c = 1, 2, 3
<ruby[bot]> mynameisbrian: # => [1, 2, 3] (https://eval.in/571697)
<mynameisbrian> okay, I see now
TomPeed is now known as justbleed
bronson has quit [Ping timeout: 252 seconds]
<mynameisbrian> well, I still don't see
LoneHerm_ has quit [Ping timeout: 260 seconds]
tmtwd has joined #ruby
rocfig has joined #ruby
<mynameisbrian> I guess I picture 1,2,3,4 as a datatype, such as a list, and so if I can pass it to a variable, it seems like it should work that way in a method invocation too
ItSANgo has quit [Quit: Leaving...]
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
SyncYourDogmas has quit [Ping timeout: 265 seconds]
<kareeoleez> has someone been involved with FFI 's?
nawn has quit [Remote host closed the connection]
alex88 has quit [Quit: Page closed]
symm- has quit [Ping timeout: 260 seconds]
ItSANgo has joined #ruby
karmatr0n has joined #ruby
kareeole_ has joined #ruby
kareeoleez has quit [Ping timeout: 260 seconds]
moeabdol has joined #ruby
DanyC has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 265 seconds]
moeabdol has quit [Client Quit]
justbleed has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
halfamind has joined #ruby
kareeole_ is now known as kareeoleez
dionysus69 has quit [Ping timeout: 276 seconds]
eliand has joined #ruby
moeabdol has joined #ruby
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ruby
Ishido has joined #ruby
dsea has joined #ruby
karmatr0n has quit [Ping timeout: 260 seconds]
lessless has joined #ruby
minimalism has quit [Quit: minimalism]
the_drow has joined #ruby
d0lph1n98 has joined #ruby
rocfig has quit [Quit: This computer has gone to sleep]
Nice_BikeMaN has quit [Quit: Leaving]
bruno- has joined #ruby
lessless has quit [Ping timeout: 276 seconds]
agent_white has quit [Quit: backinabit]
pablod has joined #ruby
<pablod> anyone around?
<pablod> I got a question about alias_method
shortdudey123 has quit [Ping timeout: 260 seconds]
pablod has quit [Client Quit]
raeoks has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pabloh has joined #ruby
bruno- has quit [Ping timeout: 276 seconds]
nankyokusei has joined #ruby
tildes has joined #ruby
spider-mario has joined #ruby
nawn has joined #ruby
patrick_star_3 has joined #ruby
darkxploit has joined #ruby
nankyokusei has quit [Ping timeout: 250 seconds]
p1k has joined #ruby
<p1k> how correctly preserve a grep command in a ruby string ?
patrick_star_2 has quit [Ping timeout: 265 seconds]
<p1k> e.g. grep -R "[\"']" will become escaped as "grep -R \"[\"']\""
<p1k> which cannot be executed correctly after that
<p1k> I guess gsub('\', '\\') but that can have unwanted consequences..
mynameisbrian has quit [Quit: Leaving]
bronson has joined #ruby
crdpink has quit [Quit: q term]
yfeldblum has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
crdpink has joined #ruby
roamingdog has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
idefine has joined #ruby
Mia has quit [Read error: Connection reset by peer]
the_drow has joined #ruby
<pabloh> p1k, use simple commas
<pabloh> instead of doubles
tildes has quit [Ping timeout: 260 seconds]
<p1k> simple commas ?
idefine has quit [Ping timeout: 252 seconds]
tildes has joined #ruby
RegulationD has joined #ruby
rocfig has joined #ruby
<p1k> did you mean single quote e.g. grep -R '["\']' ?
<pabloh> yeap
<pabloh> that single quote
<rubyrubyruby> what should I use for the "platform" attribute in a gemspec for a gem that runs on all windows platforms (mswin{32,64}, mingw{32,64}, etc.)
eliand has quit [Quit: Leaving]
halfamind has quit [Quit: Leaving.]
SilverKey has quit [Quit: Halted.]
jaguarmagenta has quit [Remote host closed the connection]
wnd has quit [Excess Flood]
wnd has joined #ruby
<pabloh> single quote won't apply escaping except for the single quote itself
<pabloh> or to '//'
RegulationD has quit [Ping timeout: 265 seconds]
<pabloh> sorry to '\\'
braincrash has quit [Ping timeout: 265 seconds]
Devalo has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
ropeney has quit [Remote host closed the connection]
Devalo has quit [Ping timeout: 250 seconds]
Tempesta has joined #ruby
LoneHerm_ has joined #ruby
ropeney has joined #ruby
tildes has quit [Ping timeout: 244 seconds]
rocfig has quit [Quit: This computer has gone to sleep]
noobsu has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
LoneHerm_ has quit [Ping timeout: 276 seconds]
raeoks has joined #ruby
raeoks has quit [Client Quit]
elaptics is now known as elaptics`away
tildes has joined #ruby
karmatr0n has joined #ruby
<p1k> pabloh: but the <<-SCRIPT <script> SCRIPT syntax breaks the single quote escaping =/
<pabloh> oh, I didn't know you wanted to use multiline string
<pabloh> s
<pabloh> heredoc always escapes I think
antgel has joined #ruby
clifford_ has joined #ruby
bronson has joined #ruby
<pabloh> plk, do u have a gist with what u are trying to do?
<p1k> pabloh: but you won't be able to use an unscaped double quote in a regular string
Caerus|Away is now known as Caerus
karmatr0n has quit [Ping timeout: 240 seconds]
<p1k> pabloh: I just used .gsub('\', '\\') but I was wondering if there was a more consistent way
dostoyevsky has quit [Quit: leaving]
<pabloh> apparently you can use HEREODOCS with single quote semantics, see the link
<pabloh> although I'm not 100% sure I understand what you are trying to do, do you have a gist/pastie?
nando294021 has quit [Ping timeout: 246 seconds]
mr_robot_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
raeoks has joined #ruby
raeoks has quit [Client Quit]
clifford_ has quit [Ping timeout: 260 seconds]
clifford_ has joined #ruby
bruno- has joined #ruby
bronson has quit [Remote host closed the connection]
d0lph1n98 has quit [Ping timeout: 265 seconds]
<Caerus> evening #ruby
Vile` has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
clifford_ has quit [Ping timeout: 246 seconds]
chip_ has joined #ruby
bruno- has quit [Ping timeout: 276 seconds]
ur5us has joined #ruby
<pabloh> who's #ruby-lang admin?
the_drow has joined #ruby
v0dro has joined #ruby
m_antis has quit [Ping timeout: 250 seconds]
<Caerus> I suppose the ones with op access are the ones with ruby/staff cloak but I'm not sure who's the actual admin (if there
<Caerus> if there's any.
monoprotic has quit [Read error: Connection reset by peer]
<pabloh> I think theres a lot more plp that can access, since it's access by invitation
<v0dro> SciRuby is inviting applications for a TensorFlow Ruby wrapper. 1800$ stipend over 3 months. See this post: http://www.somatic.io/blog/tensorflow-is-coming-to-ruby
<v0dro> Join sciruby at #sciruby if you need more details.
nawn has quit [Remote host closed the connection]
mercerist has joined #ruby
idefine has joined #ruby
<Caerus> kareeoleez, my ruby woke up defaulted to 1.8.7 after doing rvm --default use ruby-1.8.7-head going to try to set it back to 2.3 and see if it works after reboot(the find out why).
pawnbox_ has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
skade has joined #ruby
idefine has quit [Ping timeout: 244 seconds]
Caerus is now known as Caerus|Away
Caerus|Away is now known as Caerus
yfeldblum has quit [Ping timeout: 276 seconds]
mercerist has quit [Ping timeout: 276 seconds]
Devalo has joined #ruby
Devalo has quit [Remote host closed the connection]
tax has quit [Quit: Leaving]
Devalo has joined #ruby
blackgoat has quit [Quit: WeeChat 1.4]
clifford_ has joined #ruby
ropeney has quit [Read error: Connection reset by peer]
mercerist has joined #ruby
firstdayonthejob has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
zenlot has quit [Ping timeout: 244 seconds]
rippa has joined #ruby
clifford_ has quit [Ping timeout: 252 seconds]
Dimik has quit [Ping timeout: 244 seconds]
uranellus has quit [Quit: ZNC 1.6.1 - http://znc.in]
skade has quit [Quit: Computer has gone to sleep.]
zenlot has joined #ruby
uranellus has joined #ruby
uranellus has joined #ruby
karmatr0n has joined #ruby
skade has joined #ruby
CloCkWeRX has joined #ruby
karmatr0n has quit [Ping timeout: 276 seconds]
SCHAAP137 has joined #ruby
agent_white has joined #ruby
roamingdog has quit [Remote host closed the connection]
nadir has quit [Quit: Connection closed for inactivity]
jgt1 has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
bronson has joined #ruby
ruskie has quit [Excess Flood]
ur5us has quit [Remote host closed the connection]
ruskie has joined #ruby
wigust has joined #ruby
Fransen has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
ur5us has joined #ruby
nankyokusei has joined #ruby
toretore has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
solars has joined #ruby
Fransen has quit [Client Quit]
nankyokusei has quit [Ping timeout: 276 seconds]
jenrzzz has quit [Ping timeout: 276 seconds]
skade has joined #ruby
skade has quit [Client Quit]
grassass has quit [Remote host closed the connection]
houhoulis has quit [Remote host closed the connection]
chipotle has joined #ruby
ferr has joined #ruby
grassass has joined #ruby
skade has joined #ruby
jaguarmagenta has joined #ruby
minimalism has joined #ruby
yfeldblum has joined #ruby
darkxploit has quit [Ping timeout: 260 seconds]
blaxter has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
jaguarmagenta has quit [Ping timeout: 265 seconds]
yaw has joined #ruby
tildes has quit [Ping timeout: 240 seconds]
yaw has quit [Max SendQ exceeded]
Mon_Ouie has joined #ruby
pabloh has quit [Ping timeout: 246 seconds]
astrobun_ has joined #ruby
astrobunny has quit [Read error: Connection reset by peer]
xall has quit [Ping timeout: 252 seconds]
raeoks has joined #ruby
karmatr0n has joined #ruby
ur5us has quit [Remote host closed the connection]
<p1k> so is there anyting I can do for tracing all called ruby functions by a process ?
kareeoleez has quit [Remote host closed the connection]
<p1k> jhass: ty
karmatr0n has quit [Ping timeout: 260 seconds]
roamingdog has joined #ruby
startupality has joined #ruby
blackmesa has joined #ruby
roamingdog has quit [Ping timeout: 240 seconds]
xall has joined #ruby
bruno- has joined #ruby
clifford_ has joined #ruby
clifford_ has quit [Remote host closed the connection]
mooe has quit [Quit: Connection closed for inactivity]
bruno- has quit [Ping timeout: 276 seconds]
saneax_AFK is now known as saneax
urine535 has joined #ruby
<urine535> burn all jews in oven
<urine535> death to infidels
startupality has quit [Quit: startupality]
<squigz> Really
<urine535> allahu akhbar
<p1k> what's the name of the feature that let's you scope changes to a class on a module level ?
<squigz> op plz
<urine535> burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all
<[ace]> !op
<urine535> jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ### burn all jews in oven ###
<squigz> !op
<squigz> Oh god
<Mon_Ouie> !troll urine535
urine535 was kicked from #ruby by ruby[bot] [trolling is a bannable offense, see http://ruby-community.com/pages/user_rules]
<apeiros> Mon_Ouie: beat me to it
<squigz> Mon_Ouie: you're my new best friend
<apeiros> squigz: it's !ops, but I guess I'll make an alias for !op
nankyokusei has joined #ruby
v0dro1 has joined #ruby
oetjenj has joined #ruby
v0dro has quit [Ping timeout: 246 seconds]
<Mon_Ouie> p1k: They're called refinements
<p1k> Mon_Ouie: that was it, thanks
<p1k> it's odd that google searches don't give me that =/
ferr has quit [Ping timeout: 276 seconds]
raeoks has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
raeoks has joined #ruby
skade has joined #ruby
yaw has joined #ruby
tildes has joined #ruby
yaw has quit [Max SendQ exceeded]
pabloh has joined #ruby
skade has quit [Client Quit]
* pabloh is lost
<apeiros> pabloh: I hope you have a "return to owner" tag on you then ;-p
d0lph1n98 has joined #ruby
braincrash has joined #ruby
skade has joined #ruby
yfeldblum has quit [Ping timeout: 244 seconds]
pawnbox_ has quit [Remote host closed the connection]
<squigz> lol
skingsbu has joined #ruby
p1k has quit [Ping timeout: 240 seconds]
saneax is now known as saneax_AFK
skade has quit [Quit: Computer has gone to sleep.]
xall has quit [Ping timeout: 252 seconds]
startupality has joined #ruby
pawnbox has joined #ruby
<pabloh> apeiros, hahah
v0dro1 has quit [Ping timeout: 260 seconds]
karmatr0n has joined #ruby
pawnbox has quit [Ping timeout: 246 seconds]
mercerist has quit [Remote host closed the connection]
TomyLobo has joined #ruby
raeoks has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karmatr0n has quit [Ping timeout: 276 seconds]
raeoks has joined #ruby
Labaleine has joined #ruby
stardiviner has quit [Ping timeout: 252 seconds]
jgt1 has quit [Ping timeout: 240 seconds]
roamingdog has joined #ruby
roamingdog has quit [Ping timeout: 276 seconds]
jaguarmagenta has joined #ruby
Devalo has quit [Remote host closed the connection]
shinnya has joined #ruby
Ocratech has joined #ruby
tildes has quit [Ping timeout: 260 seconds]
stardiviner has joined #ruby
jaguarmagenta has quit [Ping timeout: 250 seconds]
mr_robot_ has joined #ruby
idefine has joined #ruby
araujo has joined #ruby
aries_liuxueyang has quit [Quit: No Ping reply in 180 seconds.]
yeukkf has joined #ruby
aries_liuxueyang has joined #ruby
startupality has quit [Quit: startupality]
idefine has quit [Ping timeout: 260 seconds]
d0nn1e has quit [Ping timeout: 265 seconds]
d0nn1e has joined #ruby
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
BTRE has quit [Ping timeout: 276 seconds]
yeukkf has quit [Remote host closed the connection]
BTRE has joined #ruby
al2o3-cr has joined #ruby
yfeldblum has joined #ruby
pxwpst has joined #ruby
RegulationD has joined #ruby
madgen has joined #ruby
pawnbox has joined #ruby
gizmore has joined #ruby
RegulationD has quit [Ping timeout: 252 seconds]
nankyokusei has quit [Remote host closed the connection]
nankyokusei has joined #ruby
KikoSalguero123 has joined #ruby
<KikoSalguero123> Hello, im trying to do a Hash that has a "ç" in the keys. When a puts that hash it didn't shows th"ç", its shows "\u00E7". That i need to do?
KikoSalguero2 has joined #ruby
<KikoSalguero2> Hello, im trying to do a Hash that has a "ç" in the keys. When a puts that hash it didn't shows th"ç", its shows "\u00E7". That i need to do?
<toretore> KikoSalguero2: what is the problem with it?
<KikoSalguero2> I just need to print the ç intead of u00E7
<apeiros> KikoSalguero2: \u00e7 is ç
<KikoSalguero2> But when i print the hash i want to show ç
<apeiros> if it prints it like that it iirc means that a) you're printing an inspect and b) the encoding for your output is not set to utf-8
<toretore> KikoSalguero2: why?
<apeiros> how do you print the hash?
<KikoSalguero2> puts hashname
<apeiros> yeah, that'll print an inspect
<apeiros> what's the result of `$stdout.external_encoding || Encoding.default_external`?
jenrzzz has joined #ruby
jenrzzz has joined #ruby
nanoz has quit [Ping timeout: 265 seconds]
<KikoSalguero2> I put it, nothing happens
<KikoSalguero2> i will try something here...
<apeiros> if you're not in an interactive session (pry/irb), you have to print the result. preferably using Kernel#p:
<apeiros> `p $stdout.external_encoding || Encoding.default_external`
<toretore> KikoSalguero2: what exactly is it you're trying to do?
KikoSalguero123 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<apeiros> lovely, they left
raeoks has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<KikoSalguero2> A supermarket list
<KikoSalguero2> a exercise program
<apeiros> or they joined twice...
<KikoSalguero2> i create a hash with products in the key, and quantity in the value
<toretore> gist your code
<toretore> ?gist
<ruby[bot]> https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
jenrzzz has quit [Ping timeout: 276 seconds]
yfeldblum has quit [Ping timeout: 250 seconds]
<toretore> you sound like you're confused about the actual contents of a string and its representation when you inspect it
<KikoSalguero2> Im really noob... sorry... I will see how to use github and than i get back
stardiviner has quit [Ping timeout: 260 seconds]
<shevy> you copy/paste your existing code and paste it there
<apeiros> `puts hash` is the wrong tool for that, as that'll inspect the hash (inspects are for debugging).
<apeiros> but regardless, you should still tell me the result of that expression I gave you
<apeiros> because inspect too will show ç with encodings set properly
karmatr0n has joined #ruby
d0lph1n98 has quit [Ping timeout: 276 seconds]
KikoSalguero2 has quit [Ping timeout: 250 seconds]
<jhass> now they left :P
karmatr0n has quit [Ping timeout: 276 seconds]
<Caerus> you guys have become my personal heroes, other channels are SO not newbie friendly
roamingdog has joined #ruby
<shevy> I could swear that newbies were more durable some years ago
sneakerhax has quit [Ping timeout: 265 seconds]
<Labaleine> Hello ! I don't get why my code is doing an infinite loop since I am using until. When the condition is met it should go to the other part of my code ?
<apeiros> shevy: I'd concur
<apeiros> there's a ton of entitlement in so many nowadays
<Labaleine> user_input = gets.chomp
<Labaleine> until user_input == "q" do prompt(show)
<Labaleine> end
bronson has joined #ruby
roamingdog has quit [Ping timeout: 240 seconds]
<apeiros> Labaleine: yes, that should terminate upon the user entering q
<Labaleine> yes but it is not I don't understand why
stardiviner has joined #ruby
<apeiros> can you gist the full code?
bruno- has joined #ruby
<Labaleine> Aperos: Yes thank you for your kind help
<apeiros> ?tabnick Labaleine
<ruby[bot]> Labaleine: pro-tip - use tab completion for nicks. avoids typos in nicks.
<shevy> you can call him apieros!
* apeiros ain't a snack ;-p
<Caerus> ^
thomas has quit [Changing host]
thomas has joined #ruby
<shevy> lol
Labaleine is now known as labaleine
<apeiros> oy, tabs for indent…
sepp2k has joined #ruby
nadir has joined #ruby
<apeiros> anybody want to write a piece of code to repaste a gist with proper formatting? :) I'd add it to ruboto
<shevy> labaleine btw you can save with .rb as file end on gist.github, then you get colour highlighting for free there
<apeiros> labaleine: oh
<apeiros> you actually get the userinput only once
<apeiros> so your loop will only end (or actually never run) if the very first user input is "q"
<apeiros> you probably want to assign the return value of `prompt` to `user_input` in that loop.
agent_white has quit [Ping timeout: 276 seconds]
<Caerus> I need some help molding my brain to the ruby ways, been practicing with string manipulation and I'm looking for suggestions (not solution please) as to how could I go about formatting a text file.
bronson has quit [Ping timeout: 252 seconds]
<shevy> Caerus with already existing methods? or do you want to build them on your own :D
bruno- has quit [Ping timeout: 260 seconds]
<Caerus> I reckon doing either of these are bad to begin with: lines_array = File.readlines(ARGV.first), txt_file = File.open(ARGV.first, "r") { |iofile| iofile.gets(nil)}
<shevy> are they bad?
<labaleine> Apeiros: more something like this > until ['q'].include?(user_input = prompt(show).downcase)
<shevy> I'd use methods though
labaleine has quit [Read error: Connection reset by peer]
<shevy> and a class. for reformatting, look at .center .ljust .rjust, also % / sprintf for String, and also .gsub
<Caerus> is it possible to do file.new and work on the file itself?
skade has joined #ruby
<apeiros> Caerus: I think that's the entire point of File.new?
labaleine has joined #ruby
<jhass> Caerus: how to best read it depends on what exact operations you want to do to it and what to do with the result(s)
tildes has joined #ruby
<labaleine> Apeiros > just got a problem on IRC. So my code looks better like this apparently > until ['q'].include?(user_input = prompt(show).downcase)
duncannz has quit [Remote host closed the connection]
<apeiros> labaleine: you can reduce that to just: `until "q" == prompt(show)` (move the downcase into the prompt)
flughafen_ has joined #ruby
<Caerus> so my reasoning behind calling the File.open approaches wrong is correct? I should be using File.new for this along with +w mode yes?
<apeiros> File.new == File.open iirc
<jhass> I don't see any reasoning nor my question answered
<labaleine> Oh it works ! thank you very much !
the_drow has quit [Quit: This computer has gone to sleep]
<Caerus> oh yeah. reasoning being coping whole file to memory is not healthy?
<flughafen_> hello everybody
gizmore has quit [Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/]
<shevy> flughafen_!
<Caerus> and I want to format it so it has either a set amount of words per line or max characters
<flughafen_> hi shevy
<apeiros> Caerus: copying the whole file into memory can be convenient and make things easier. but it doesn't scale.
<Caerus> whatever happens first.
<flughafen_> shevy: i still havent taken off
<shevy> flughafen_ yeah, even some dude from brazil made fun of the flughafen
<Caerus> I stand corrected, not w
<flughafen_> shevy: that jerk!
<jhass> Caerus: write it to a new file, replace contents?
<Caerus> *'wrong' per se, but not scalable.
<apeiros> Caerus: and with regards to in-place modification of files: that's considered unsafe. if your app crashes mid-process you end up with a corrupt file.
<jhass> also given you'll be inserting \n's you'll overwrite stuff before you read it unless you're very careful
<Caerus> apeiros, good point, hand't thought of that.
DanyC has joined #ruby
<flughafen_> is github.com/vim-ruby/vim-ruby already in vim?
<Caerus> jhass, yeah thats why first thought of copying the file to memory. That also brought me to the question of whether to use .readlines or .read
<jhass> if you want to avoid temporary loading all into memory you could write to a tempfile and move that one over the original once done
<jhass> do you want to preserve existing newlines?
<apeiros> Caerus: both .read and .readlines will consume the whole file
<apeiros> so both with regards to "not read the whole file into memory", they're equal.
DanyC has quit [Remote host closed the connection]
<Caerus> but with readlines I get an Array and with read the way I tried it I got a big String
<apeiros> File#each_* or File::foreach
<apeiros> Caerus: so? it's still the full file in memory
<apeiros> and a big string chunked into an array of smaller strings is larger than the big string itself
DanyC has joined #ruby
<jhass> another note though, you don't have like gigabyte sized text files, right?
<Caerus> jhass, I was looking to transform the actual file, your suggestion of duplicating the file is awesome
<jhass> all of this will hardly be relevant considerations for text files
neanderslob has quit [Remote host closed the connection]
ponga has quit [Quit: Connection closed for inactivity]
<Caerus> and apeiros being past the memory issue, I wondered which would be better for actually manipulating the String to match the desired formatting
<Caerus> yeah jhass nothing mission critical just overall practice hehe
grassass has quit [Quit: I go bye bye!]
pawnbox has quit [Ping timeout: 260 seconds]
DanyC has quit [Ping timeout: 276 seconds]
pawnbox has joined #ruby
d0lph1n98 has joined #ruby
<shevy> Caerus is on his way to ruby mastery
<apeiros> from ruby mystery to ruby master
<Caerus> thanks for the suggestions I'll on another approach based on them
<Caerus> ! there is a book name
nankyokusei has quit [Remote host closed the connection]
<flughafen_> shevy: im a ruby master, i can open files in ruby
<apeiros> that lacked a "y" :(
stardiviner has quit [Ping timeout: 252 seconds]
<apeiros> flughafen_: yeah, but will it fly?
jgt1 has joined #ruby
noService has quit [Ping timeout: 244 seconds]
jgt1 has quit [Read error: Connection reset by peer]
<flughafen_> apeiros: flying files i have no mastered
<Caerus> apeiros, what lacked a "y"?
<Caerus> oh mastery
<Caerus> nvm
<apeiros> "from ruby mystery to ruby master"
<apeiros> :)
skade has quit [Quit: Computer has gone to sleep.]
nischay_ has joined #ruby
dionysus69 has joined #ruby
<Caerus> I'd read that you should write it apeiros
<apeiros> the list of things I should write is sadly quite long :(
hanmac has quit [Ping timeout: 250 seconds]
<Caerus> start with ruby multicore? ;)
<apeiros> why'd I write a single line book?
<apeiros> ruby multicore, page 1: just use jruby.
<shevy> to fight against those pesky newlines
<Caerus> hah
nischay_ has quit [Ping timeout: 244 seconds]
<Caerus> do you all use jruby?
<shevy> not me! I am in the resistance fighters group
<apeiros> … "alternatively, use Process.fork, but be aware that this will not work on windows."
<apeiros> Caerus: not at the moment. but that's mostly due to me being slow at changing things which work.
dionysus69 has quit [Ping timeout: 276 seconds]
<Caerus> is it that different from official interpreter?
kam270 has joined #ruby
<apeiros> it's very close. the biggest issue I'm aware of is native extensions.
<apeiros> but that's an issue which depends entirely on your context and might not be an issue at all.
AzzA has joined #ruby
AzzA has quit [Client Quit]
noService has joined #ruby
<Caerus> wow 2.2 compatible
patrick_star_3 has quit [Ping timeout: 240 seconds]
<apeiros> ah, yeah, that might also be an issue - it's usually lagging a bit behind MRI. e.g. now 2.3 is out and jruby is at 2.2, so no &. for you f.ex.
<Caerus> is that the lonely operator?
patrick_star_3 has joined #ruby
noService has quit [Ping timeout: 276 seconds]
<shevy> hehe yeah
<shevy> dude staring at a dot on the floor
hanmac has joined #ruby
pawnbox has quit [Ping timeout: 276 seconds]
flughafen_ has quit [Ping timeout: 260 seconds]
skade has joined #ruby
karmatr0n has joined #ruby
Yiota has joined #ruby
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
<Caerus> Oh wow the sun is up, that's my cue. See ya later #ruby | thanks for the input apeiros, jhass. U too shevy. Have a good day.
nankyokusei has joined #ruby
flughafen_ has joined #ruby
nadir has quit [Ping timeout: 260 seconds]
Caerus is now known as Caerus|Away
karmatr0n has quit [Ping timeout: 240 seconds]
m_antis has joined #ruby
wldcordeiro has quit [Ping timeout: 252 seconds]
nadir has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
shinnya has quit [Ping timeout: 276 seconds]
pabloh has quit [Quit: Leaving]
pawnbox has joined #ruby
bruno- has joined #ruby
sdothum has joined #ruby
jaguarmagenta has joined #ruby
bruno- has quit [Ping timeout: 252 seconds]
nanoz has joined #ruby
jaguarmagenta has quit [Ping timeout: 260 seconds]
roamingdog has joined #ruby
pawnbox has quit [Ping timeout: 240 seconds]
the_drow has joined #ruby
p1k has joined #ruby
Azure has joined #ruby
roamingdog has quit [Ping timeout: 246 seconds]
lubekpl has joined #ruby
blur3d has joined #ruby
pxwpst has quit [Ping timeout: 260 seconds]
DanyC has joined #ruby
postmodern has quit [Quit: Leaving]
skade has quit [Quit: Computer has gone to sleep.]
eagduw has joined #ruby
DanyC has quit [Ping timeout: 260 seconds]
dstarh has quit [Quit: Textual IRC Client: www.textualapp.com]
blackmesa has quit [Ping timeout: 252 seconds]
RegulationD has joined #ruby
trinaldi has joined #ruby
diegoviola has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
rubyrubyruby has quit [Ping timeout: 250 seconds]
flughafen_ has quit [Ping timeout: 265 seconds]
shakes has joined #ruby
qasaur has joined #ruby
<shevy> oh yes the sun
<shevy> our old nemesis
arpegius has joined #ruby
<apeiros> praise the sun
davedev24 has joined #ruby
chipotle has quit [Quit: cheerio]
jenrzzz has joined #ruby
Madplatypus has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
flashpoint9 has joined #ruby
m_antis has quit [Remote host closed the connection]
jgt1 has joined #ruby
karmatr0n has joined #ruby
qasaur has quit [Read error: Connection reset by peer]
BTRE has quit [Ping timeout: 260 seconds]
m_antis has joined #ruby
qasaur has joined #ruby
karmatr0n has quit [Ping timeout: 265 seconds]
the_drow has quit [Quit: This computer has gone to sleep]
antgel has quit [Ping timeout: 276 seconds]
kam270 has quit [Ping timeout: 265 seconds]
giz|work has joined #ruby
antgel has joined #ruby
qasaur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hk238 has quit [Quit: http://www.kvirc.net/ 4.9.1 Aria]
thomas has quit [Quit: leaving]
thomas has joined #ruby
thomas has quit [Client Quit]
BTRE has joined #ruby
marchelzo has joined #ruby
<marchelzo> hi
<marchelzo> why does 'foo' === /foo/ yield false, but /foo/ === 'foo' yield true?
flughafen_ has joined #ruby
<apeiros> because String#=== is different from Regexp#===
<apeiros> === is still a method and its behavior depends on the object you call the method on
<marchelzo> that's cool
<marchelzo> it seems like === is a bad name though
<apeiros> note that you should not (or only rarely) use === in code. it exists for case/when and some rare methods like Enumerable#grep
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
<marchelzo> it's confusing, since in most languages, === means the same as == without any implicit type conversions
The_Phoenix has joined #ruby
<marchelzo> why not call it match? or something
<apeiros> in other words: the name === is poorly chosen in those other languages because it's confusing me coming from ruby?
<marchelzo> no
<apeiros> "other languages use X differently" makes for a poor argument. there's probably >1k languages out there by now.
<marchelzo> intuitively, === would be a stricter version of ==. also, it would be symmetric, like equality operators usually are.
<marchelzo> ruby's === behaves nothing like ==, which is confusing, even if you don't compare it to other languages.
<apeiros> I don't think so. this isn't instinct, it's learned (from those other languages)
<apeiros> ruby's == doesn't behave like other languages' == either.
arpegius has quit [Quit: arpegius]
<apeiros> so stop using other languages as a reference for how ruby should behave.
<marchelzo> i'm not
flughafen_ has quit [Ping timeout: 240 seconds]
<apeiros> and yeah, === is a different method than ==, so *obviously* it will behave differently
<apeiros> otherwise there'd be no point in having it
<marchelzo> right, but their behavior isn't even remotely related
<marchelzo> which is confusing
<apeiros> that's what you think now
<apeiros> === is the "case equality operator"
<marchelzo> even if you've never programmed before, you would see === and think it's a symmetric relation
antgel has quit [Ping timeout: 276 seconds]
<apeiros> again, learned
<apeiros> == isn't symmetric either
<apeiros> in ruby
<apeiros> it's all methods, so no symmetry.
Biopandemic has joined #ruby
<apeiros> also things like +, -, *, / -- they're all not symmetric. they're all methods.
AlexRussia has joined #ruby
hk238 has joined #ruby
skade has joined #ruby
<apeiros> also the term you're looking for is actually commutative, not symmetric
<marchelzo> of course, but usually when defining the + method, you'd make sure it's associative. when defining an == method, you'd make sure it's symmetric and reflexive, etc. whereas with ===, you almost never want those properties
minimalism has quit [Quit: minimalism]
roamingdog has joined #ruby
<marchelzo> symmetry and commutativity are the same in this case, basically
rbennacer has joined #ruby
DanyC has joined #ruby
czerasz has quit [Ping timeout: 240 seconds]
rbennacer has quit [Read error: Connection reset by peer]
<apeiros> anyway, you've now learned that it's not the way you expected it. you can either accept it and try to also learn why it makes sense, or you can pretend to know better despite being new to the language and lament how bad it is.
rbennacer has joined #ruby
crystal77 has joined #ruby
<apeiros> I see no reason for me to participate in the latter
<marchelzo> i do accept it, but i still think it's a poor name. i think most people would agree. no need to be so defensive.
kus has joined #ruby
kus has quit [Max SendQ exceeded]
<shevy> did you make a poll to establish that most people would agree
skade has quit [Quit: Computer has gone to sleep.]
<marchelzo> no, that's why i said "i think".
<apeiros> i think most people would disagree. there. turned your point moot.
<shevy> I think most people would not agree
bluOxigen_ has quit [Ping timeout: 265 seconds]
Oclair_ has quit [Quit: Bye Bye]
<apeiros> "most people would agree" is probably an authority fallacy anyway.
<shevy> you can try to file at https://bugs.ruby-lang.org/projects/ruby-trunk to see whether they will change the name
<apeiros> (even without the "I think")
<marchelzo> "most people" doesn't mean "most ruby programmers"
<shevy> yeah I'll ask my barber about programming
DanyC has quit [Ping timeout: 276 seconds]
<marchelzo> most programmers, then
<apeiros> "please choose your preferred set of biases"
<apeiros> it's a pointless statement, aiming to improve your argument, while it actually does nothing of that sort. you can just leave it away.
piliplaker has joined #ruby
<marchelzo> actually, the goal when naming things is to make their meaning clear and concise. if most people agree that a name is poor, then you've failed.
<marchelzo> it's not an "authority fallacy"
<apeiros> I guess you failed to understand why it's pointless.
<apeiros> yes, clear and concise - to the target audience.
<apeiros> now guess who the target audience of ruby is. hint, it's not "programmers".
<apeiros> if it was, I'd suggest to go to haskell and complain about all their "poorly named operators"
flashpoint9 has quit [Remote host closed the connection]
crameth has quit [Quit: crameth]
<shevy> he may have done so already!
<apeiros> and we're back at "I'm new and pretend I know better". and back at "I'm out of this". but this time for real :)
<marchelzo> a programming language whose target audience is not programmers?
<marchelzo> how did ruby every become popular if its target audience is only people who already know ruby?
<shevy> because the language is better than xyz perhaps?
<shevy> like php
<apeiros> by aiming at people who like rubys design choices
<apeiros> and the set of people who like rubys design choices is by no means equivalent to the set of "all programmers"
<apeiros> and that's simplified
<marchelzo> using that logic, everything ever made is perfect
<marchelzo> that target audience of X is people who like X
antgel has joined #ruby
diego1 has joined #ruby
<shevy> where is the perfect programming language
<marchelzo> ruby, clearly
<shevy> nah
<apeiros> you have an interesting definition of perfect there
Es0teric has joined #ruby
<marchelzo> if you don't like something about ruby, your opinion doesn't matter, since ruby is only aimed at people who like ruby. is that right?
<apeiros> anyway, I'm out, as said. I see no point in continuing this.
<shevy> even matz himself is working on a better language https://github.com/mruby/mruby :) AND https://github.com/matz/streem
piliplaker has quit [Remote host closed the connection]
<marchelzo> good idea. time for breakfast anyway. take care.
marchelzo has quit [Quit: WeeChat 1.4]
idefine has joined #ruby
diegoviola has quit [Ping timeout: 260 seconds]
Mia has joined #ruby
diego2 has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
qasaur has joined #ruby
diego1 has quit [Ping timeout: 252 seconds]
idefine has quit [Ping timeout: 276 seconds]
lxsameer has quit [Quit: WeeChat 1.5]
statelesscode_ has quit [Ping timeout: 240 seconds]
sinkensabe has joined #ruby
the_drow has joined #ruby
roamingdog has quit [Remote host closed the connection]
diego2 has quit [Changing host]
diego2 has joined #ruby
diego2 is now known as diegoviola
karmatr0n has joined #ruby
diego1 has joined #ruby
nankyokusei has joined #ruby
allcentury has joined #ruby
diego1 has quit [Changing host]
diego1 has joined #ruby
diego1 has quit [Client Quit]
diegoviola has quit [Ping timeout: 244 seconds]
karmatr0n has quit [Ping timeout: 250 seconds]
<raz> ha, funny trap with the snav nav operator. i naively tried hsh[:foo]&[:bar]&[:baz] ... and took me way too long to realize that's not how it works ;)
jgt1 has quit [Ping timeout: 276 seconds]
<apeiros> heh
<apeiros> with hash, use Hash#dig
<raz> yes, doing that now
* raz wonders if his constructs deserves an addition to rubocop
nankyokusei has quit [Ping timeout: 276 seconds]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros> if, then only when written without spaces
<apeiros> hm, though
<apeiros> if written without spaces or with multiple array literals
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<raz> yea well at least it's hard to write an actual bug that way
<apeiros> while ary1 & ary2 & ary3 makes sense, I guess ary1 & [literal1] & [literal2] does not
<raz> seems unlikely at least, but who knows :)
<raz> on another note i really wish ruby would finally at dot notation for hash access
<apeiros> not just unlikely. with literals, you can combine it into a single one.
<raz> im getting finger cramps from all that [] mess
<raz> add*
<raz> (see, that's how weak my fingers have become, can't even spell 3 letter words anymore)
<apeiros> you can do .store() instead of []=. and .fetch(key, nil) instead of []
<raz> no, i just want foo.bar.batz instead of foo.lots_of_typing('bar').even_more_typing('batz')
<apeiros> oh. no. please not.
bronson has joined #ruby
<apeiros> use an openstruct if you want that.
<raz> i dont want structs or hashie or what not, i've tried them all
<raz> i want it native on all hashes
|2701 has joined #ruby
<raz> use a new operator if you have to (i know, dots and method names..)
* raz is in rant mode
<shevy> hashie is a cool name
<shevy> sounds like a drug
<raz> it's also a relatively useful gem :)
<apeiros> raz: and what was your problem with hashie etc.?
<shevy> the name!!!
<raz> but sadly can only do so much. i.e. fix it for your own hashes - and put you into that certain place in hell where you're juggling with raw and fixed hashes..
<raz> apeiros: ^ that
<shevy> actually, HashWithIndifferentAccess is even worse as a name
<raz> they don't fix the problem, they arguably make it worse
<raz> by adding inconsistency to the injury
chipotle has joined #ruby
<shevy> layers on layers on layers
<shevy> lipstick on a pig!
<apeiros> how about refinements?
<raz> shevy++
<raz> apeiros: that can't be tacked on. it needs to be fixed in the language, like the hash literal synrax.
<raz> synTax
<shevy> hehe synrax
<apeiros> raz: uh, you do know what refinements are, yes?
<raz> apeiros: something i add to my codebase to make it incompatible with everything else?
<apeiros> because that'd be the point of using one - adding your desired dot-notation to Hash itself
<apeiros> raz: again, no. that's the point of refinements. they're lexically scoped. the change only applies to your code. even for objects shared between your and others' code.
<raz> apeiros: i don't want it on my code, i want it on YOUR code
<raz> on all ruby code
<apeiros> raz: why? you don't write my code
<raz> apeiros: but i may have to access your hashes
<apeiros> ok. again. reread what I wrote.
<apeiros> that's. the. point. of. refinements.
<apeiros> it WILL apply to hashes you get from my code.
bronson has quit [Ping timeout: 252 seconds]
pawnbox has joined #ruby
<raz> apeiros: gnah. and then i have to everyone and their rubocop why *my* ruby code is different
<raz> explain to
<raz> ffs
<apeiros> oh boohoo
labaleine has quit [Read error: Connection reset by peer]
<raz> apeiros: this is a language wart. we should just fix it on the language for everyone's greater good.
<apeiros> I doubt there's a rubocop rule which figures that you're having a hash there and calling methods which normally don't exist on a hash.
<raz> at the same time the symbol/string-key mess could be sorted
<apeiros> no thanks.
<apeiros> and next the integer/string key mess?
<raz> why would there be an integer/string mess?
<apeiros> because asking for "foo" and :foo be the same key is the same bad idea as asking for 1 and "1" to be the same key.
<raz> apeiros: you are right, symbols were a bad idea
<shevy> well newcomers will always ask the string versus symbol access dichotomy for hashes
<apeiros> no. people being willfully ignorant is a bad idea.
<apeiros> if you're confused about the difference between strings and other objects, then just stick with strings.
<apeiros> in the worst case your code will be tiny bit slower.
<raz> apeiros: explain, why are symbols needed in a language?
<shevy> but they read that symbols are faster and should be used :)
<apeiros> raz: no. I'll not take that much from my time. please educate yourself on the advantages of symbols.
<apeiros> and as said, if you don't think they exist - just stick with strings.
<raz> shevy: yea, newbies happily take every bullshit that's fed to them as gospel :/
<shevy> raz I remember that for my main configuration object (for some bigger projects), I tend to use . methods such as: if @config.use_colours? because I found it more readable than @config[:use_colours]
<apeiros> I'm against dumbing down tools just because some people can't be bothered to learn how and why things work the way they do.
<shevy> or perhaps without the ? there, I actually forgot
<shevy> but I like the ? there
<raz> apeiros: oh. advantages of symbols. how does that work in the context of now immutable strings again?
sinkensabe has quit [Read error: Connection reset by peer]
<apeiros> a string is not a symbol
<raz> i'd really be curious to hear an advantage, just one. and don't say performance.
<apeiros> and a symbol is not a string
sinkensabe has joined #ruby
jgt1 has joined #ruby
<apeiros> a symbol is (for the machine) closer to an integer than to a string.
<shevy> raz hah that's an interesting thought, I haven't yet considered how immutable strings would affect symbols
<apeiros> "and don't say performance" - go away then :-p
<raz> yea just how do all these other languages do it, without exposing symbols...
<apeiros> I'll say it anyway: performance. there.
<shevy> YES!
<raz> apeiros: symbols were a mistake. not having dot notation is sort of defensible, but ultimately just awfully inconvenient.
<apeiros> I could also say GC stress. but that's just convoluted for "performance".
<apeiros> I could also say "using the native representation". but again, that's just convoluted for "performance".
<shevy> lol
<shevy> let's not forget bottlenecks!!!
czerasz has joined #ruby
<apeiros> raz: you are being willfully ignorant. please, do stick with strings. let the grown up keep their advanced tools. thanks.
<raz> apeiros: red herring. ruby is slow. wasting trillions of developer hours for a difference that rarely can even be measured was *not* worth it.
<apeiros> you sure you didn't mean to say trollions?
<raz> apeiros: you're just bitter because i know more than you :P
<apeiros> lol, yeah, sure.
Ocratech has left #ruby ["Leaving"]
<raz> nah trillions seems accurate, tho i'll admit i didn't research the number
allcentury has quit [Read error: Connection reset by peer]
<raz> but thinking about strings/symbols probably costs me an hour or so a month. for newbs the number is much higher. multiply by number of ruby users. it adds up.
<apeiros> again: just stick with strings then.
<raz> apeiros: you know that doesn't work, why do you keep suggesting it!
<apeiros> I know it works perfectly.
<raz> why must you dilute my beautiful sunday rant!
tildes has quit [Ping timeout: 260 seconds]
Elvin has joined #ruby
<apeiros> oh, oh, oooh: better yet: go use node
bruno- has joined #ruby
<apeiros> js' hashes only know string keys
<apeiros> better yet - they aren't really hashes
bruno- is now known as Guest44161
davedev24 has quit [Remote host closed the connection]
<raz> i'm suggesting to fix a wart on a nice language and you tell me to go use an awful language instead
<raz> i guess that's the nerd version of 'fu'
DanyC has joined #ruby
whathappens has joined #ruby
whathappens has quit [Remote host closed the connection]
sesquipedalian has joined #ruby
<apeiros> no. you suggest to change a non-issue into a dumbed down stupidity.
<raz> improving syntax has nothing to do with 'dumbing down'
<apeiros> making symbols be the same as strings has nothing to do with syntax
CloCkWeRX has quit [Quit: Leaving.]
<apeiros> removing symbols would, but only to the extend as it'd mean to remove the symbol literal from the syntax
<raz> that was a secondary subject, and yes that's not dumbing down either, that's fixing a design bug
<apeiros> *sob*
<apeiros> today's motto of discussions: ignorants trying to have their way.
<apeiros> or "wanting to"
<apeiros> whatever.
<raz> ignorants huh
<raz> you still haven't explained the purpose of symbols in ruby, in contrast to lisp and smalltalk
cdg has joined #ruby
AlexRussia has quit [Ping timeout: 276 seconds]
<apeiros> "I don't know the purpose of symbols" -> that's what makes you an ignorant.
RegulationD has joined #ruby
<apeiros> and your unwillingness to educate yourself on it makes you a willful ignorant.
<raz> well, i have educated myself. why don't you enlighten me?
<raz> if i replace all symbols in my code with strings, somehow it still works
cdg has quit [Remote host closed the connection]
<raz> what am i missing?
saneax_AFK is now known as saneax
DanyC has quit [Ping timeout: 276 seconds]
<apeiros> obviously that "I educated myself" part.
<raz> or maybe you just don't have an argument huh? ¯\_(ツ)_/¯
<apeiros> oh, yes. yes. you won. done well there. good bye.
davedev24 has joined #ruby
rkazak has joined #ruby
nankyokusei has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
<kaleido> a symbol is always the same in any context, correct?
jancel has joined #ruby
jancel has quit [Remote host closed the connection]
jancel has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ruby
sdothum has quit [Remote host closed the connection]
skade has joined #ruby
SilverKey has joined #ruby
<apeiros> mostly. as of ruby 2.2, dynamically generated symbols can be gc'ed.
sdothum has joined #ruby
<raz> and strings are staged to be immutable by default
* raz chuckles
<raz> (from 2.3)
<apeiros> and yet, strings are just as much not symbols as integers aren't.
<apeiros> though again, integers are actually closer to symbols than strings.
<raz> apeiros: but i already won, you can stop flailing :P
<apeiros> sure. you won. the prize of the ignorant of the day.
czerasz has quit [Ping timeout: 244 seconds]
pawnbox has quit [Remote host closed the connection]
* raz wonders about the difference between an immutable string and a symbol
<apeiros> don't worry your head. keep using strings. it'll be fine.
<raz> i like your way of arguing without arguments :D
<shevy> but they are so slow... did we mention this already :D
<p1k> underlying representation aside, they have a completely different use type
<apeiros> shevy: you must not say that. or any other performance related metric.
mercerist has joined #ruby
<shevy> hehe
monoprotic has joined #ruby
pawnbox has joined #ruby
<p1k> (although hashes where the keys are used as string values hide this in places)
<raz> apeiros: so what's the performance difference between these immutable strings and symbols... why don't you help the ignorant :(
<apeiros> things like memory consumption, gc pressure or any other performance related metrics are taboo in raz' world
<apeiros> raz: because I refuse to spoon feed the lazy.
<apeiros> is that a single word?
<apeiros> hm, hyphenated it seems
jenrzzz has joined #ruby
<raz> apeiros: but.. don't they use the same code-path in the vm?
* raz so confused :(
chouhoulis has joined #ruby
<shevy> uhm
m_antis has quit [Ping timeout: 244 seconds]
<shevy> ruby people deal with the VM?
mooe has joined #ruby
sinkensabe has quit [Ping timeout: 240 seconds]
<raz> only if they speak japenese!
<shevy> hmm norc is not here, he usually goes to the VM
<shevy> and Ox0dea
<shevy> this is also something that has changed... a few years ago, that really could not be observed on #ruby
<shevy> the speed discussions are admittedly much older :)
jenrzzz has quit [Ping timeout: 265 seconds]
<p1k> for the same reason you wouldn't do stuff like :archived + :active
<raz> well, matz himself *wanted* to scrap symbols for 1.9
<raz> but he couldn't, too much legacy code broke
<p1k> raz: if strings are immutable you get about half-way
<raz> the new immutable string default is probably meant to be a slower take on the issue
<raz> p1k: exactly
<p1k> but for example in python where this the case it's not uncommon to define constants to mimic c-style enums
karmatr0n has joined #ruby
<p1k> e.g. ACTIVE = 0; ARCHIVED = 1 etc.
<raz> p1k: yea python is a good example here. their ongoing py2/py3 debacle is the prime argument against aprupt major syntax changes.
saneax is now known as saneax_AFK
blur3d has quit [Quit: blur3d]
hutch34 has joined #ruby
<raz> p1k: i wouldn't even mind retaining the symbol syntax, they should just behave as strings (i.e. indifferent access) where it matters
<raz> i.e. just make :foo syntactic sugar for 'foo'
<shevy> how does this work with a static object id
<p1k> raz: what's the benefit?
<raz> p1k: getting rid of the whole symbolize_keys and related mess
pawnbox has quit [Remote host closed the connection]
<p1k> raz: but I think this is just because a lot of people use enums where they are going to later use them as strings
<raz> p1k: removing one blocker from the road to dot-notation hash access
wigust_ has joined #ruby
<p1k> raz: which {foo:1} being easier to write then { "foo" => 1} kind of promotes
<p1k> esp. { "foo".freeze => 1 }
<raz> p1k: well yes and yes. there simply is no reason for ruby to expose symbols as something special. they were a mistake, i think matz said that himself.
pawnbox has joined #ruby
<p1k> raz: I just thing the hash case is intermingled
<raz> hm, like how?
<p1k> ENUM's make plenty of sense to me, but that's not something you usually string interpolate
jancel has quit [Remote host closed the connection]
<raz> yea as said, i don't even mind to retain the syntax (doing away with that isn't realistic anyway)
noService has joined #ruby
<raz> but hashes shouldn't get on my neves when i access [:foo] as 'foo'
<p1k> where as with a hash you might say |k,v| "#{k} is set to {v}" (or something of that sort <a href=v>k</a> )
karmatr0n has quit [Ping timeout: 252 seconds]
wigust has quit [Ping timeout: 252 seconds]
<raz> hm, not sure what you're going at there :)
<p1k> I mean that some key's you use as literals which is that intermingled frozen string usecase you are speaking of
<raz> when in interpolated (via to_s) they already look the same.. which is one of the problems with them
<raz> p1k: oh, you're talking about the performance difference now?
<p1k> I think e.g. enum use type is usually not for interpolation but representation of state
<Mon_Ouie> p1k: {"foo" => 1} and {"foo".freeze => 1} are the same though
<Mon_Ouie> >> {"foo" => 1}.keys.map(&:frozen?)
<p1k> raz: that's 50% of why I'd define ENUM in postgres rather than varchar
<ruby[bot]> Mon_Ouie: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
<shevy> haha
rbennacer has quit [Remote host closed the connection]
<raz> Mon_Ouie++
nankyokusei has quit [Remote host closed the connection]
akiTendo has joined #ruby
akiTendo has quit [Client Quit]
<p1k> the other reason being constraints
symm- has joined #ruby
<apeiros> p1k: if only pg's enums could be meaningfully modified :-/ iirc deletion of a value being especially problematic.
<p1k> apeiros: when do you actually delete values from enums though? :o
<apeiros> p1k: when you have thing like country-, language- or currency-codes as enum
ekinmur has joined #ruby
<apeiros> *things
* raz mumbles something about static, ordered set
am55 has quit [Quit: Leaving]
<p1k> apeiros: oh, I've never used enum for things like that I guess
<apeiros> or say you use it for something like progress codes (static, ordered set), and the requirements change after a year…
<p1k> apeiros: meh, once a year, shouldn't be that expensive to update alter type on the column?
<apeiros> the alter type isn't the expensive thing
<apeiros> as far as I remember the problem was how pg handles the enums internally and that deletion leads to the whole enum degrading
<p1k> I mean drop value might be nice, but if it literally map's to a c enum they'd have to have a different structure to handle drop
<apeiros> I don't remember the details, though. it's almost 2y ago since I came across that.
kirun has joined #ruby
diegoviola has joined #ruby
<p1k> I think it's still not on Rails anyways =/
<p1k> in*
idefine has joined #ruby
`tim` has joined #ruby
nankyokusei has joined #ruby
labaleine has joined #ruby
flashpoint9 has joined #ruby
`tim` has quit [Ping timeout: 276 seconds]
kareeoleez has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ruby
nando294021 has joined #ruby
shinnya has joined #ruby
idefine has quit [Remote host closed the connection]
wigust_ has quit [Remote host closed the connection]
Elvin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
skade has quit [Quit: Computer has gone to sleep.]
wigust has joined #ruby
RegulationD has joined #ruby
hutch34 has quit [Quit: WeeChat 1.4]
joelwallis has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
idefine has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
tmtwd has joined #ruby
rocfig has joined #ruby
rodfersou has joined #ruby
rumia has quit [Ping timeout: 246 seconds]
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
AlexRussia has joined #ruby
A124 has quit [Quit: '']
flashpoint9 has quit [Remote host closed the connection]
moeabdol has quit [Ping timeout: 252 seconds]
madgen has quit [Ping timeout: 276 seconds]
A124 has joined #ruby
jancel has joined #ruby
hinbody has joined #ruby
SilverKey has quit [Quit: Halted.]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
SilverKey has joined #ruby
Bugboy1028 has quit [Remote host closed the connection]
ixti has joined #ruby
SilverKey has quit [Client Quit]
DanyC has joined #ruby
idefine has quit [Remote host closed the connection]
DanyC has quit [Remote host closed the connection]
Bugboy1028 has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
noService has quit [Quit: Lost terminal]
mtkd has quit [Ping timeout: 265 seconds]
A124 has quit [Quit: '']
rumia has joined #ruby
mtkd has joined #ruby
karmatr0n has joined #ruby
A124 has joined #ruby
zast has joined #ruby
JoshGlzBrk has joined #ruby
idefine has joined #ruby
roamingdog has joined #ruby
karmatr0n has quit [Ping timeout: 260 seconds]
Masonn has joined #ruby
idefine has quit [Remote host closed the connection]
the_drow has quit [Quit: This computer has gone to sleep]
s00pcan_ has joined #ruby
LBo has joined #ruby
jackjackdripper has joined #ruby
idefine has joined #ruby
benzrf has quit [Quit: bye]
bronson has joined #ruby
benzrf has joined #ruby
s00pcan_ has quit [Client Quit]
idefine has quit [Remote host closed the connection]
sepp2k has quit [Read error: Connection reset by peer]
jancel has quit [Remote host closed the connection]
joelwallis has quit [Ping timeout: 250 seconds]
bronson has quit [Ping timeout: 252 seconds]
sepp2k has joined #ruby
giz|work has quit [Ping timeout: 244 seconds]
lubekpl has quit [Ping timeout: 244 seconds]
A5101 has joined #ruby
crystal77 has joined #ruby
kgrz has joined #ruby
roamingdog has quit [Remote host closed the connection]
idefine has joined #ruby
crystal77 has quit [Client Quit]
karmatr0n has joined #ruby
jancel has joined #ruby
opentux has joined #ruby
Yzguy has joined #ruby
idefine has quit [Ping timeout: 265 seconds]
Azure has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
`tim` has joined #ruby
nankyokusei has quit [Remote host closed the connection]
kgrz has quit [Quit: leaving]
jancel has quit [Read error: Connection reset by peer]
Azure has joined #ruby
jgt1 has quit [Ping timeout: 276 seconds]
giz|work has joined #ruby
skingsbu has quit [Ping timeout: 244 seconds]
moeabdol has joined #ruby
Devalo has joined #ruby
rocfig has quit [Ping timeout: 276 seconds]
karmatr0n has quit [Ping timeout: 246 seconds]
rocfig has joined #ruby
bonhoeffer has joined #ruby
madgen has joined #ruby
<bonhoeffer> i have 19 lines of data -- i can do comma separated -- i tried to use a heredoc, but that is painful -- how should i load the variable
<bonhoeffer> i suppose i could use csvread or similar
<bonhoeffer> but think this should be really simple -- i could also save as a json
mistermocha has joined #ruby
IrishGringo has joined #ruby
pat__ has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
jancel has joined #ruby
chip_ has quit [Read error: Connection reset by peer]
madgen has quit [Ping timeout: 252 seconds]
<bonhoeffer> got it working -- just used ruby array syntax
sdothum has joined #ruby
colegatron has quit [Ping timeout: 246 seconds]
colegatron has joined #ruby
jancel has quit [Read error: Connection reset by peer]
crystal77 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
bonhoeffer has quit [Ping timeout: 250 seconds]
chouhoulis has quit [Remote host closed the connection]
jancel has joined #ruby
houhoulis has joined #ruby
Cohedrin has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
chip_ has joined #ruby
Devalo has quit [Remote host closed the connection]
AlexRussia has quit [Ping timeout: 252 seconds]
jancel has quit [Read error: Connection reset by peer]
mooe has quit [Quit: Connection closed for inactivity]
nhhc has joined #ruby
xall has joined #ruby
symm- has quit [Quit: Leaving...]
sarlalian has quit [Ping timeout: 260 seconds]
tmtwd has quit [Remote host closed the connection]
opentux has quit [Ping timeout: 244 seconds]
colegatron_origi has joined #ruby
colegatron has quit [Ping timeout: 276 seconds]
sarlalian has joined #ruby
Guest53755 has quit [Ping timeout: 260 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ruby
Guest53755 has joined #ruby
madgen has joined #ruby
rocfig has quit [Quit: This computer has gone to sleep]
giz|work has quit [Ping timeout: 240 seconds]
firstdayonthejob has quit [Quit: WeeChat 1.5]
mic_e has joined #ruby
tmtwd has joined #ruby
firstdayonthejob has joined #ruby
allcentury has joined #ruby
madgen has quit [Ping timeout: 276 seconds]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
The_Phoenix has quit [Read error: Connection reset by peer]
jgt1 has joined #ruby
jaguarmagenta has joined #ruby
mic_e has quit [Ping timeout: 276 seconds]
xall has quit [Ping timeout: 260 seconds]
moeabdol has quit [Ping timeout: 276 seconds]
Es0teric has quit [Quit: Computer has gone to sleep.]
Es0teric has joined #ruby
Yiota has joined #ruby
Elvin has joined #ruby
Rasmusolle has joined #ruby
eagduw has quit [Remote host closed the connection]
yodeler has joined #ruby
Azure has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
idefine has joined #ruby
nankyokusei has joined #ruby
d0lph1n98 has quit [Ping timeout: 276 seconds]
Rasmusolle has left #ruby ["Leaving"]
<apeiros> !spam Rasmusolle
mistermocha has quit [Ping timeout: 276 seconds]
govg has joined #ruby
skade has joined #ruby
tmtwd has quit [Ping timeout: 265 seconds]
jaguarmagenta has quit [Remote host closed the connection]
jancel has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
isxek has joined #ruby
ravishankarjha has joined #ruby
jancel has quit [Remote host closed the connection]
mercerist has quit [Ping timeout: 265 seconds]
d0nn1e has quit [Ping timeout: 276 seconds]
Azure|dc has joined #ruby
<zacts> morning #ruby
<|2701> its 2pm
sinkensabe has joined #ruby
karmatr0n has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
p1k has quit [Ping timeout: 250 seconds]
<apeiros> moin zacts
<ruby[bot]> |2701: it's morning, see http://www.total-knowledge.com/~ilya/mips/ugt.html
<apeiros> ?ugt |2701
<|2701> that's cringy
Yiota has joined #ruby
<apeiros> less so than "20:00 |2701: its 2pm"
<|2701> lol
<|2701> ok
sinkensabe has quit [Remote host closed the connection]
mic_e has joined #ruby
hk238 has quit [Quit: http://www.kvirc.net/ 4.9.1 Aria]
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
giz|work has joined #ruby
tildes has joined #ruby
agriffis has joined #ruby
qasaur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
valkyr1e has quit [Quit: Bye.]
mic_e has quit [Ping timeout: 246 seconds]
agriffis has left #ruby ["WeeChat 1.4"]
valkyr1e has joined #ruby
Devalo has joined #ruby
flughafen_ has joined #ruby
Masonn has quit [Ping timeout: 240 seconds]
rbennacer has joined #ruby
iamvery has quit [Ping timeout: 240 seconds]
iamvery has joined #ruby
Devalo has quit [Ping timeout: 250 seconds]
greg__ has joined #ruby
greg__ has quit [Client Quit]
crystal77 has quit [Read error: Connection reset by peer]
crystal77 has joined #ruby
Dimik has joined #ruby
symm- has joined #ruby
rbennacer has quit [Remote host closed the connection]
greg__ has joined #ruby
nhhc has quit [Quit: Leaving]
greg__ has quit [Remote host closed the connection]
cooldavid has joined #ruby
bronson has joined #ruby
<cooldavid> what are your thoughts on elixir?
rbennacer has joined #ruby
nankyokusei has quit [Remote host closed the connection]
<shevy> cures diseases
pwnd_nsfw has quit [Read error: Network is unreachable]
bronson has quit [Ping timeout: 252 seconds]
karmatr0n has quit [Ping timeout: 252 seconds]
pwnd_nsfw has joined #ruby
crystal77 has quit [Ping timeout: 260 seconds]
rbennacer has quit [Remote host closed the connection]
<zacts> moin apeiros
<zacts> Is your nick greek?
<zacts> I like it
jancel has joined #ruby
<apeiros> yes, it is
<zacts> nice nice
* zacts is learning ancient (attic) greek right now... slowly, but surely
<zacts> anyway I'm almost done with Head First Ruby
<zacts> I'll be done either tonight or tomorrow
<zacts> and next is poodr
cooldavid has quit [Quit: leaving]
<apeiros> cool :)
<shevy> good old poodles
IrishGringo has quit [Ping timeout: 276 seconds]
rbennacer has joined #ruby
sesquipedalian has quit [Ping timeout: 260 seconds]
AlexRussia has joined #ruby
<|2701> poodr is really great
Apelsin has joined #ruby
jgt1 has quit [Ping timeout: 276 seconds]
IrishGringo has joined #ruby
edwinvdgraaf has joined #ruby
GodFather has quit [Remote host closed the connection]
codeurge has joined #ruby
<Apelsin> So, I've read the guide for good questions a bit, and realize that this doesn't quite fall under those categories but eh...
edwinvdgraaf has quit [Remote host closed the connection]
dumdedum has joined #ruby
edwinvdgraaf has joined #ruby
bluOxigen has joined #ruby
<Apelsin> So, I'm trying to learn Ruby on codeacademy and I've gotten to the part where they talk about yield. I've read their stuff and some other sites, but I got problems wrapping my head around what it's good for/why to use it. Anyone got any good examples?
dumdedum has quit [Client Quit]
<Apelsin> ..too long string?
<apeiros> Apelsin: tons of strategy patterns
<Apelsin> oh nvm the last part
rbennacer has quit [Ping timeout: 246 seconds]
<apeiros> example: people.sort_by { |person| person.first_name }
<Apelsin> Hrm
<apeiros> people.sort { |person1, person2| person1.age <=> person2.age }
<apeiros> first_names = people.map { |person| person.first_name }
<apeiros> or callbacks:
rbennacer has joined #ruby
<apeiros> every(5.minutes) do puts "another five minutes of your life are forever gone!" end
<apeiros> there's plenty more
<apeiros> blocks are omnipresent in ruby
<Apelsin> but there are others things than yield that gives the same results no?
<Apelsin> and to me blocks and methods are kind of the same thing
startupality has joined #ruby
<Apelsin> which might be why I'm confused
GodFather has joined #ruby
<apeiros> yes @ other things
<apeiros> no @ blocks and methods being the same thing. they're similar.
<apeiros> methods belong to an object (self, within the method definition), blocks do not.
<Apelsin> hrm I see
<apeiros> blocks also capture the surrounding lexical context, methods do not
<apeiros> >> a = 1; def foo; yield; end; foo { a += 1 }; a
<ruby[bot]> apeiros: # => 2 (https://eval.in/571845)
startupality has quit [Client Quit]
<apeiros> a method could not access the local variable "a"
<Apelsin> I see
<Apelsin> that makes sense
GodFather has quit [Remote host closed the connection]
<Apelsin> Thanks for your patience with me
tildes has quit [Ping timeout: 244 seconds]
<apeiros> yield is a convenience. you could achieve the same goal differently. and with current ruby version even without much more code. e.g. via lambdas:
<apeiros> people.mySort(->(person1, person2) { person1.age <=> person2.age })
<apeiros> ugh, doing JS at the moment has a bad influence. pretend I wrote "my_sort", not "mySort"
<Apelsin> Haha, No worries
<Apelsin> Thanks for the help :)
<apeiros> yw
<Apelsin> I guess it will also help sitting with it more than just reading about it once/twice haha
<Apelsin> just another fast, and this time dumb question. On codeacademy I don't have to write the ;'s after things, but I noticed that you did. Is it depending on the editor/compiler?
<apeiros> ; is (almost) the same as a newline to ruby
<Apelsin> (cause CA accepts ;'s without complaining, but their example code doesn't use it)
<Apelsin> Oh
<apeiros> so we use it in irc to write multiple lines in a single line while still having valid ruby
<Apelsin> Aah, I see
<apeiros> you can read ";" as "replace with a newline here"
<Apelsin> Yea
jackjackdripper has quit [Quit: Leaving.]
<Apelsin> Thanks alot!
nanoz has quit [Read error: Connection reset by peer]
xall has joined #ruby
bobbycvi has joined #ruby
idefine has quit [Remote host closed the connection]
firstdayonthejob has quit [Quit: WeeChat 1.5]
JammyHammy has joined #ruby
LoneHermit has joined #ruby
marr has joined #ruby
wigust has quit [Remote host closed the connection]
GodFather has joined #ruby
firstdayonthejob has joined #ruby
GodFather has quit [Remote host closed the connection]
eliand has joined #ruby
flashpoint9 has joined #ruby
last_staff has joined #ruby
brunto has joined #ruby
czerasz has joined #ruby
GodFather has joined #ruby
qasaur has joined #ruby
flashpoint9 has quit [Ping timeout: 252 seconds]
y3 has joined #ruby
vipaca has joined #ruby
Xaitec has joined #ruby
GodFather has quit [Remote host closed the connection]
codecop has joined #ruby
jenrzzz has joined #ruby
karmatr0n has joined #ruby
duncannz has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
Elvin_ has joined #ruby
Elvin has quit [Ping timeout: 265 seconds]
e4xit has joined #ruby
eliand has left #ruby ["Leaving"]
diegoviola has quit [Quit: WeeChat 1.5]
zeroDi has quit [Quit: WeeChat 1.5]
sesquipedalian has joined #ruby
symm- has quit [Quit: Leaving...]
futilegames has joined #ruby
GodFather has joined #ruby
yfeldblum has joined #ruby
GodFather has quit [Remote host closed the connection]
snath has joined #ruby
snath has left #ruby [#ruby]
noobsu has quit [Remote host closed the connection]
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
jancel has quit [Remote host closed the connection]
mistermocha has joined #ruby
LoneHermit has quit [Remote host closed the connection]
y3 has quit [Ping timeout: 252 seconds]
GodFather has joined #ruby
<claw> hey channel
GodFather has quit [Remote host closed the connection]
<claw> i have a gzip function to compress a string http://paste.debian.net/684056/
<claw> the result of gzip(data).valid_encoding? is false
JammyHammy has quit [Read error: Connection reset by peer]
<apeiros> you should set its encoding to binary
mistermocha has quit [Ping timeout: 244 seconds]
<claw> apeiros: i want to store the result on a remote server using net-sftp
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
pwnd_nsfw has quit [Read error: Network is unreachable]
pwnd_nsfw has joined #ruby
<apeiros> was that supposed to be a question?
nankyokusei has joined #ruby
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
jackjackdripper has joined #ruby
<claw> apeiros: should i just use .encode("binary") on the result to encode it ?
<jhass> actually I'd be surprised if StringIO doesn't use that as a default encoding already
<apeiros> no. encode() tries to translate from the current encoding to the target encoding. but your data already is binary. you can't (and hence shouldn't) translate it.
<apeiros> jhass: uses utf-8 here
<apeiros> not sure based on what
<jhass> meh
<apeiros> probably depends on the ruby version too
<apeiros> but in the newest, I'd assume that's the default
<apeiros> claw: set the encoding when you create the StringIO
<claw> io.string.encoding => "UTF-8"
govg has quit [Ping timeout: 246 seconds]
<apeiros> btw., your code is broken anyway. String.new("wb") does not do what you think it does.
<apeiros> >> StringIO.new("wb").string # surprise
<ruby[bot]> apeiros: # => "wb" (https://eval.in/571895)
<apeiros> interestingly enough you're already the second person within around a week making this mistake.
brunto has quit [Ping timeout: 252 seconds]
<apeiros> also seems even when properly using new's arguments, wb won't set the encoding to binary. you'll have to initialize it with an empty binary string.
roamingdog has joined #ruby
futilegames has quit [Quit: futilegames]
<claw> thank you apeiros
GodFather has joined #ruby
<claw> added io.set_encoding("binary")
GodFather has quit [Remote host closed the connection]
<apeiros> you didn't read the part about your code being broken, did you? you should :-p
<claw> i did
<apeiros> your code is still broken the very same way.
<apeiros> StringIO.new("w") still does not do what you think it does.
startupality has joined #ruby
<apeiros> though, probably you're lucky, because by default, writing to that StringIO will start at position 0 and thus override your "w"
<claw> the results where fine but i understand now what you mean
knaesig has joined #ruby
<claw> i does not set mode
<apeiros> so… broken and wrong, but happens to work correctly by coincidence.
<claw> i grabbed that from *somewhere*
<apeiros> just replace line 2 & 3 by: io = StringIO.new("".b)
jaguarmagenta has joined #ruby
<apeiros> do me a favor and leave a comment, hinting a) at the wrong idea about StringIO.new("w") and how to do it properly in current ruby
<apeiros> *and b)
ravishankarjha has quit [Ping timeout: 260 seconds]
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
Xeago_ has joined #ruby
raeoks has joined #ruby
agent_white has joined #ruby
Xeago_ is now known as Xeago
Xeago has quit [Ping timeout: 260 seconds]
raeoks has quit [Client Quit]
<agent_white> Afternoon
<apeiros> moin
LoneHerm_ has joined #ruby
jaguarmagenta has quit [Ping timeout: 260 seconds]
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
rodfersou has quit [Quit: leaving]
Elvin_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
LoneHerm_ has quit [Ping timeout: 250 seconds]
Elvin has joined #ruby
aries_liuxueyang has quit [Quit: No Ping reply in 180 seconds.]
GodFather has joined #ruby
aries_liuxueyang has joined #ruby
GodFather has quit [Read error: Connection reset by peer]
skade has joined #ruby
LoneHerm_ has joined #ruby
GodFather has joined #ruby
<ule> anyone from Philadelphia?
GodFather has quit [Remote host closed the connection]
Guest44161 has quit [Read error: Connection reset by peer]
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
symm- has joined #ruby
roamingdog has quit [Remote host closed the connection]
jenrzzz has joined #ruby
lubekpl has joined #ruby
y3 has joined #ruby
idefine has joined #ruby
bruno- has joined #ruby
karmatr0n has quit [Remote host closed the connection]
idefine has quit [Remote host closed the connection]
roamingdog has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
skade has quit [Quit: Computer has gone to sleep.]
nankyokusei has quit [Remote host closed the connection]
Oog has joined #ruby
Rixius has quit [Ping timeout: 265 seconds]
<Oog> https://gist.github.com/anonymous/0fa62e0507cbbb9ae3fa37bb90aaefc3 - so weird the return not only returns out of boo but all the way out of foo?!
Devalo has joined #ruby
<Oog> when i call boo - hiiiiiiiii is not printed...?!
stannard has joined #ruby
<apeiros> return does not return control to the yielding method
Rixius has joined #ruby
<apeiros> it returns from the method within which the return statement is lexically located
<apeiros> (which actually means that you'll get a LocalJump error if you defer execution of the passed block)
<apeiros> use `next` if you want to return control to the yielding method
y3 has quit [Ping timeout: 265 seconds]
<apeiros> use `break` if you want to return from the yielding method
Es0teric has quit [Quit: Computer has gone to sleep.]
A5101 has quit [Ping timeout: 252 seconds]
mooe has joined #ruby
Devalo has quit [Ping timeout: 250 seconds]
<bazzy> simplest way to take a params hash and send it as a POST to a URL?
bruno- has quit [Read error: Connection reset by peer]
idefine has joined #ruby
* bazzy learns about Net::HTTP
nankyokusei has joined #ruby
stannard has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
<apeiros> bazzy: maybe httparty
govg has joined #ruby
dreinull has joined #ruby
pawnbox has joined #ruby
<bazzy> apeiros, I got it done with Net::HTTP already ^_^
<dreinull> is there a better "Enumerable#all" than map{|e|e}?
<apeiros> .to_a
<adaedra> What is it you're trying to do?
bruno- has joined #ruby
idefine has quit [Remote host closed the connection]
<apeiros> and ^
idefine has joined #ruby
postmodern has joined #ruby
<adaedra> moin apeiros
<apeiros> moin adaedra
<dreinull> I have included enumerable to one of my classes and would like to return itself as an array
ljames has joined #ruby
<apeiros> to_a then indeed.
<dreinull> ok
jancel has joined #ruby
<dreinull> #all is more intuitive
<dreinull> but to_a i totally forgot.
bronson has joined #ruby
<apeiros> um, no?
<apeiros> #all is rails
<dreinull> sequel user.
<apeiros> to_a is standard for anything ruby
<dreinull> sorry, no rails.
idefine has quit [Remote host closed the connection]
<apeiros> and #all there (and I'm pretty sure in sequel too) return a relation
Yzguy has quit [Quit: Zzz...]
<apeiros> not an array
<apeiros> so you're doubly mistaken
<dreinull> apeiros, no, all returns an array
codecop has quit [Remote host closed the connection]
<apeiros> poor choice by jeremy then IMO.
<dreinull> hm
<adaedra> well, I'd disagree on this one, but this is not really the subject
<dreinull> rails is not ruby afaik
<adaedra> it isn't?
<dreinull> anyway, to_a will do for now
<dreinull> no, I'm having lots of fun without ever touching or knowing rails
Masonn has joined #ruby
Masonn has quit [Max SendQ exceeded]
Masonn has joined #ruby
<apeiros> dreinull: well, same thing for sequel - sequel isn't ruby
jancel has quit [Ping timeout: 276 seconds]
<apeiros> (in that sense of "isn't")
<dreinull> of course not. Also, I'm not into flame wars.
bronson has quit [Ping timeout: 252 seconds]
<dreinull> Not worth it
hightower2 has joined #ruby
ur5us has joined #ruby
<hightower2> Hey, where does Ruby hold the last syscall error? (Like $! in Perl)
jackjackdripper has quit [Quit: Leaving.]
pawnbox has quit [Remote host closed the connection]
<apeiros> $!
<apeiros> though, the last exception, not just syscall error
<hightower2> apeiros, well, in irb, I run something which results in an error, like Dir.rmdir('/etc'), and I get Errno::EACCES: Permission denied. But printing $! immediately afterwards tells me $! is nil.
idefine_ has joined #ruby
<apeiros> probably ruby cleans $! up after the `end` of the surrounding begin/rescue.
<apeiros> so I think you'll have to begin/rescue/end wrap the expression yourself
arlek has joined #ruby
<hightower2> apeiros, oh indeed. Works, thanks.
<adaedra> you can try adding `rescue $!` in irb to have it as a return I guess.
idefine_ has quit [Remote host closed the connection]
<adaedra> that's not a pretty pattern to use in code, but I guess it's ok for one-time-use in irb/pry.
isxek has quit [Quit: Leaving]
Oog has quit []
idefine has joined #ruby
<apeiros> adaedra: nice
<hightower2> apeiros, though still I don't seem to be able to get syscall errors. E.g., if I call Dir.exist?( dir), that doesn't trigger an exception but I'd still like to read out the syscall error (like, was it a not found, or it was found but it was a file and not a dir)
<adaedra> ah
ur5us has quit [Remote host closed the connection]
<adaedra> let's try.
<adaedra> &ri errno
<adaedra> mh.
rbennacer has quit [Remote host closed the connection]
startupality has quit [Quit: startupality]
rbennacer has joined #ruby
<adaedra> It does raise an exception here
whiteline has quit [Read error: Connection reset by peer]
whiteline has joined #ruby
<adaedra> Ah, exist?, duh.
<adaedra> Not sure there's a system error here
smathy has joined #ruby
malcolmva has quit [Ping timeout: 240 seconds]
<apeiros> I think if you want to do it in a single syscall, File.stat is the only option.
<apeiros> otherwise there's File.directory?, File.file? etc.
bluOxigen has quit [Remote host closed the connection]
RegulationD has joined #ruby
bluOxigen has joined #ruby
jcomito has joined #ruby
ruby-lang385 has joined #ruby
<adaedra> Dir#exist? could be implemented with a stat(2) and not have a syscall error at all.
codeurge has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
auxbuss has joined #ruby
<eam> you definitely want stat()
<bazzy> How can I set the http_referer in a Net::HTTP post request?
blackmesa has joined #ruby
<bazzy> I am using Net::HTTP.post_form(uri, params)
jtd has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 276 seconds]
jcomito has quit [Quit: WeeChat 1.4]
ruby-lang385 has quit [Ping timeout: 250 seconds]
roamingdog has quit [Remote host closed the connection]
pawnbox has joined #ruby
<agent_white> bazzy: Checkout the documentation, there's a section titled "Setting Headers"
roamingdog has joined #ruby
aeterne has joined #ruby
<bazzy> agent_white, what confuses me is it seems like people are putting the 'Referer' => "http://example.com" into where I have my params .. but doing that isn't solving my issue
yqt has joined #ruby
<agent_white> bazzy: What's the issue?
<bazzy> I am testing a webhook that uses the http refer to create new data .. when I test from localhost, the referer is blank .. (using sinatra to receive the post requests) .. I'd like to spoof the referer so I can test locally, ideally without modifying the server code
yfeldblum has quit [Ping timeout: 250 seconds]
<kaleido> sinatra is based on rack. cant you look at req.referer?
<bazzy> well I look at request.referer (must be a sinatra wrapper) .. as stated it's blank when testing from localhost
Gasher has joined #ruby
malcolmva has joined #ruby
<kaleido> request.env['REMOTE_ADDR'] also might do the trick
<bazzy> it populates fine when sending the POST from the production site
pawnbox has quit [Ping timeout: 250 seconds]
idefine has quit [Remote host closed the connection]
aaa__ has joined #ruby
startupality has joined #ruby
aaa__ has quit [Client Quit]
bluOxigen has quit [Read error: Connection reset by peer]
bluOxigen has joined #ruby
Mon_Ouie has quit [Ping timeout: 276 seconds]
<kaleido> id be stumped to i spose. i would have thought request.referer would have done it :/
<kaleido> to/too
<bazzy> it looks like I'm improperly passing the referer as params and not properly as a header
Apelsin has quit [Quit: Apelsin]
<bazzy> I'll try converting the GET request with header settings to a Post and see what happens .. although I'm not sure where to put my params in that example code
idefine has joined #ruby
koxu has joined #ruby
<apeiros> bazzy: check out the post_form code
<apeiros> should not be too hard to add the header-setting piece of code from your above link
<bazzy> I already use post_form .. ^.^ but uh .. the context is way different from those examples for header-setting (new blocks and such)
auxbuss has quit [Quit: ZZZzzz…]
<bazzy> post_form doesn't seem to take header parameters either :\ that's why I'm in this predicament
<apeiros> yes. I know. and you want to add a header. which is why I suggest you use the post_form code to start from.
Rickmasta has quit [Quit: Textual IRC Client: www.textualapp.com]
<bazzy> It's not clear enough to me
<bazzy> I already am starting from post_form lol
smathy is now known as smathy_afk
auxbuss has joined #ruby
<bazzy> I think I'll take some time on my own to try to handle this.. Thanks for your help
Rickmasta has joined #ruby
startupality has quit [Quit: startupality]
jenrzzz has joined #ruby
startupality has joined #ruby
chouhoulis has joined #ruby
<bazzy> ok .. converting the header example code from a Get to a POST. with the 'Referer' => 'http://example.com' got the referer variable to be set appropriately .. now I just need to find out how to get my params into the request
rbennacer has quit [Remote host closed the connection]
smathy_afk is now known as smathy
tildes has joined #ruby
rbennacer has joined #ruby
<bazzy> apeiros, I understand you now - you want me to look at the definition of post_form so I can use its impl code possibly -- least that's what I'm headed to do
rbennace_ has joined #ruby
chouhoulis has quit [Ping timeout: 265 seconds]
jenrzzz has quit [Ping timeout: 276 seconds]
<bazzy> I've got it! req.form_data = params let me try it :D
<bazzy> YES it works!~
<kaleido> rack makes it so easy
<kaleido> well, easier
<kaleido> i still fight with the same kinds of things
<bazzy> I've never used it x_X
<bazzy> apeiros, I got it working :D ^
<apeiros> congrats
<bazzy> thanks :D
tildes has quit [Ping timeout: 276 seconds]
rbennacer has quit [Ping timeout: 276 seconds]
startupality has quit [Quit: startupality]
duncannz has quit [Remote host closed the connection]
mtkd has quit [Ping timeout: 260 seconds]
koxu has quit [Ping timeout: 250 seconds]
stannard has joined #ruby
IrishGringo has quit [Ping timeout: 250 seconds]
mtkd has joined #ruby
<shevy> until a bug hits!
GodFather has joined #ruby
Yzguy has joined #ruby
aryaching has joined #ruby
vdamewood has joined #ruby
JoshGlzBrk has joined #ruby
Elvin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
e4xit has quit [Quit: Right I'm out!]
last_staff has quit [Quit: last_staff]
quazimodo has quit [Ping timeout: 260 seconds]
jackjackdripper has joined #ruby
auxbuss has quit [Quit: I'm gone.]
jackjackdripper has quit [Client Quit]
joneshf-laptop has quit [Ping timeout: 252 seconds]
aryaching has quit [Read error: Connection reset by peer]
SilverKey has joined #ruby
flughafen_ has quit [Ping timeout: 260 seconds]
nankyokusei has quit [Remote host closed the connection]
mdw has joined #ruby
Masonn has quit [Ping timeout: 276 seconds]
lubekpl has quit [Quit: WeeChat 1.3]
y3 has joined #ruby
raldu has quit [Ping timeout: 276 seconds]
rbennace_ has quit [Remote host closed the connection]
sneakerhax has joined #ruby
MyMind has joined #ruby
mdw has quit [Quit: Sleeping Zzzzz]
sembei has quit [Ping timeout: 250 seconds]
jaguarmagenta has joined #ruby
minimalism has joined #ruby
jaguarmagenta has quit [Ping timeout: 260 seconds]
|ifei5g00d has joined #ruby
y3 has quit [Ping timeout: 260 seconds]
mic_e has joined #ruby
Es0teric has joined #ruby
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
roamingdog has quit [Remote host closed the connection]
chrisja has joined #ruby
roamingdog has joined #ruby
wigust has joined #ruby
RegulationD has joined #ruby
stannard has quit [Remote host closed the connection]
ljames has quit []
knaesig has quit [Quit: WeeChat 1.0.1]
rbennacer has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ljames has joined #ruby
roamingdog has quit [Remote host closed the connection]
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
Gasher has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
idefine has quit [Remote host closed the connection]
solars has quit [Ping timeout: 240 seconds]
Cohedrin_ has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
Devalo has joined #ruby
jancel has joined #ruby
moeabdol has joined #ruby
zast has quit [Remote host closed the connection]
Devalo has quit [Ping timeout: 250 seconds]
bruno- has quit [Read error: Connection reset by peer]
j_mcnally has joined #ruby
bruno- has joined #ruby
moeabdol has quit [Ping timeout: 260 seconds]
jancel has quit [Ping timeout: 265 seconds]
skolman_ has joined #ruby
nawn has joined #ruby
mooe has quit [Quit: Connection closed for inactivity]
idefine has joined #ruby
y3 has joined #ruby
nawn has quit [Remote host closed the connection]
yfeldblum has joined #ruby
smathy is now known as smathy_afk
aphprentice has quit [Quit: Connection closed for inactivity]
roshanavand has joined #ruby
idefine has quit [Ping timeout: 276 seconds]
hakunin has joined #ruby
bronson has joined #ruby
<hakunin> Hm, the `lazy` doesn't seem to work here… 1.step(by: 0.01).lazy.each_cons(2){|a,b| puts [a,b].inspect}.take(3)
<hakunin> bug in 2.3.0?
Yzguy has quit [Quit: Zzz...]
<apeiros> you want enum_for there
dionysus69 has joined #ruby
kareeoleez has quit [Remote host closed the connection]
SilverKey has quit [Quit: Cheerio!]
bronson has quit [Ping timeout: 252 seconds]
y3 has quit [Ping timeout: 260 seconds]
roshanavand has quit [Quit: This computer has gone to sleep]
edwinvdgraaf has quit [Remote host closed the connection]
giz|work has quit [Ping timeout: 276 seconds]
zenlot6 has joined #ruby
idefine has joined #ruby
zenlot has quit [Ping timeout: 246 seconds]
banister has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
diegoaguilar has joined #ruby
xall has quit [Ping timeout: 260 seconds]
skolman_ has quit [Remote host closed the connection]
skolman_ has joined #ruby
xall has joined #ruby
idefine has quit [Ping timeout: 276 seconds]
davedev24 has quit []
skolman_ has quit [Ping timeout: 244 seconds]
stardiviner has joined #ruby
stardiviner has quit [Client Quit]
Xaitec has quit [Remote host closed the connection]
CloCkWeRX has joined #ruby
elifoster has joined #ruby
|2701 has quit [Quit: Connection closed for inactivity]
saneax_AFK is now known as saneax
twistedpixels_ has joined #ruby
twistedpixels_ has quit [Changing host]
twistedpixels_ has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
twistedpixels has quit [Quit: ZNC - http://znc.in]
hightower3 has joined #ruby
govg has quit [Ping timeout: 252 seconds]
firstdayonthejob has quit [Ping timeout: 276 seconds]
govg has joined #ruby
joneshf-laptop has joined #ruby
twistedpixels_ has quit [Quit: ZNC - http://znc.in]
twistedpixels has joined #ruby
twistedpixels has joined #ruby
Kallis has joined #ruby
hightower2 has quit [Ping timeout: 260 seconds]
idefine has joined #ruby
Kallis has quit [Remote host closed the connection]
|2701 has joined #ruby
idefine has quit [Remote host closed the connection]
bodgix has left #ruby [#ruby]
agent_white has quit [Quit: brb]
idefine has joined #ruby
agent_white has joined #ruby
Kallis has joined #ruby
aeterne has quit [Read error: Connection reset by peer]
aeterne has joined #ruby
halfamind has joined #ruby
SCHAAP137 has quit [Quit: Leaving]
Guest43 has joined #ruby
idefine has quit [Remote host closed the connection]
moeabdol has joined #ruby
chip_ has quit [Ping timeout: 276 seconds]
Guest43 has quit [Changing host]
Guest43 has joined #ruby
jaguarmagenta has joined #ruby
idefine has joined #ruby
idefine has quit [Remote host closed the connection]
idefine has joined #ruby
pawnbox has joined #ruby
chip_ has joined #ruby
labaleine has quit [Read error: Connection reset by peer]
jaguarmagenta has quit [Ping timeout: 246 seconds]
symm- has quit [Ping timeout: 260 seconds]
pawnbox has quit [Ping timeout: 260 seconds]
jgt1 has joined #ruby
freija has joined #ruby
quazimod1 has joined #ruby
halfamind has quit [Quit: Leaving.]
startupality has joined #ruby
chip_ has quit [Read error: No route to host]
startupality has quit [Client Quit]
yfeldblum has quit [Ping timeout: 276 seconds]
freija has quit [Quit: freija]
symm- has joined #ruby
govg has quit [Ping timeout: 246 seconds]
chopin has joined #ruby
spider-mario has quit [Remote host closed the connection]
d5sx43 has joined #ruby
govg has joined #ruby
startupality has joined #ruby
smathy_afk is now known as smathy
gregf has quit [Quit: WeeChat 1.5]
LoneHerm_ has quit [Remote host closed the connection]
d5sx43 has quit [Client Quit]
Madplatypus has joined #ruby
PlasmaStar has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
d0nn1e has joined #ruby
chip_ has joined #ruby
kirun has quit [Remote host closed the connection]
nankyokusei has joined #ruby
pawnbox has quit [Ping timeout: 252 seconds]
gregf has joined #ruby
govg has quit [Ping timeout: 260 seconds]
mynameisbrian has joined #ruby
wigust has quit [Remote host closed the connection]
nankyokusei has quit [Ping timeout: 250 seconds]
govg has joined #ruby
<mynameisbrian> Hey guys. I'm confused about what a block is exactly. is do ... end always a block? I see a lot of resources differentiating lambda's and blocks, but I can do this: l = lambda do | num | num * 2 end
<mynameisbrian> for example
<apeiros> not always. but almost always. `while cond do; end` is not a block f.ex., but it's a rare exception
<apeiros> your example: yes, that is a block. passed to the Kernel#lambda method, which returns a Proc instance.
PlasmaStar has joined #ruby
<mynameisbrian> so what makes it a block?
<apeiros> the do/end, and being passed to a method as block argument.
<mynameisbrian> so in my example, it's both a block and a lambda?
<apeiros> in the exceptions (like with while), it's not passed to a method (while is syntax)
<apeiros> no. it's just a block. passed as an argument to lambda. that expression creates your lambda. which is, as said before, a Proc instance.
<apeiros> >> x = lambda {}; [x.class, x.lambda?]
<ruby[bot]> apeiros: # => [Proc, true] (https://eval.in/571921)
<mynameisbrian> okay, I understand now, thanks.
allcentury has quit [Ping timeout: 276 seconds]
govg has quit [Ping timeout: 246 seconds]
eljimmy has joined #ruby
<bazzy> I sometimes move a function into a separate module and have it as a module function .. this is just to organize the code .. is that behavior OK? I was also wondering if it matters using module self methods vs. class self methods for this purpose
govg has joined #ruby
<mynameisbrian> I get confused with the arguments. the fact we're passing do and end. I was seeing it as an entire construct
<shevy> bazzy yeah I think module FileUtils is one big module_function
<apeiros> I'd usually say "it's methods, not functions", but in this case they might actually be functions :)
idefine has quit [Remote host closed the connection]
<apeiros> bazzy: do those functions of yours reference self in any way? e.g. via self itself, or via an @ivar?
<shevy> funny code though
<shevy> module_function :pwd; alias getwd pwd; module_function :getwd
jgt1 has quit [Ping timeout: 260 seconds]
<shevy> dir == '/' ? dir : dir.chomp(?/)
<bazzy> oh no, there's a difference between functions and methods in Ruby.. heh (I come from C/CPP background) .. I think I meant methods, as in `def method_name`
<shevy> hmm
<apeiros> bazzy: there aren't really functions in ruby
moeabdol has quit [Ping timeout: 260 seconds]
koooge has joined #ruby
<apeiros> but some methods are used like functions
<bazzy> I don't note a difference, but it's besides the point. No, in this particular case, I'm not referencing self, I'm only operating on the arguments and returning new data
<bazzy> sometimes I may want to call one of the other "static" functions in the module
arlek has quit [Ping timeout: 252 seconds]
<apeiros> ok, in that case the proper way to do it is indeed to put them into a module, define them as instance methods, and use module_function
<apeiros> that does the right thing for you. one being to allow you to use the method as YourModule.some_func, and additionally by include YourModule; some_func
<apeiros> see e.g. Math module from core
<bazzy> this is my first time hearing of module_function .. my situation gets a little hairier.. let
<bazzy> let's say I have 3 modules .. and I want them to share some parent functions
<bazzy> I guess I need to make a "parent module" for all of them
<apeiros> a method: called on a receiver. thus belongs to an object and has a self, can access @ivars from the object it's called upon.
<bazzy> and then to call the parent "shared" functions.. use ParentModuleName.func
<apeiros> a function: does not have a receiver, has no self, therefore no access to @ivars either
<apeiros> since ruby allows methods to be called without explicit receiver, we can pretend to have functions. though they're really methods and called on self.
<bazzy> I think I may have to make a gist and ask for approval or improvement points
<apeiros> sure. code review is a great way to get more idiomatic ruby code.
Cohedrin has joined #ruby
Cohedrin_ has quit [Read error: Connection reset by peer]
stardiviner has joined #ruby