cydrobolt_ has quit [Quit: oooh...what does THIS button do?]
cydrobolt has joined #ruby
cydrobolt has joined #ruby
cydrobolt has quit [Changing host]
jusa has joined #ruby
GinoMan has joined #ruby
nachoman has joined #ruby
__Yiota has joined #ruby
cabraturgo has quit [Quit: Bye!]
__Yiota has quit [Client Quit]
jusa has quit [Ping timeout: 260 seconds]
iNs has joined #ruby
mentok has joined #ruby
cam27 has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
JeanCarl1Machado has quit [Ping timeout: 268 seconds]
<cam27>
I use Vim and am just wondering if anyone uses anything other than Vim or if the VimRuby plugin is worth the install? I like the intellisense (auto complete) features that Visual Studo and Xcode provide.
BSab has joined #ruby
c0mrad3 has quit [Quit: Connection closed for inactivity]
BSAlb has quit [Ping timeout: 260 seconds]
MrSprinkle is now known as MrSparkle
kobain has joined #ruby
weathermaker has quit [Ping timeout: 268 seconds]
JoshS has quit [Ping timeout: 258 seconds]
redaudit has joined #ruby
dikaio has quit [Quit: Lost terminal]
Cohedrin has quit [Read error: Connection reset by peer]
antib has quit [Ping timeout: 245 seconds]
Cohedrin has joined #ruby
weathermaker has joined #ruby
jhack_ has quit [Quit: Leaving]
endemic has quit [Quit: Leaving.]
endemic has joined #ruby
JoshS has joined #ruby
endemic has quit [Client Quit]
jameser has joined #ruby
endemic has joined #ruby
charliesome has joined #ruby
t-recx has quit [Quit: t-recx]
houhoulis has quit [Remote host closed the connection]
GinoMan has quit [Remote host closed the connection]
weathermaker has quit [Ping timeout: 260 seconds]
marr has quit [Ping timeout: 240 seconds]
Cohedrin has quit [Read error: Connection reset by peer]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
harfangk has joined #ruby
unpleased__ has quit [Quit: Sto andando via]
ledestin has joined #ruby
Cohedrin has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 246 seconds]
Bock has joined #ruby
Bock has quit [Max SendQ exceeded]
nachoman has quit []
bonhoeffer_ has quit [Ping timeout: 240 seconds]
Emmanuel_Chanel has joined #ruby
nachoman has joined #ruby
Bock has joined #ruby
jane_booty_doe has joined #ruby
nachoman has quit [Client Quit]
charliesome has joined #ruby
enterprisey has quit [Ping timeout: 268 seconds]
cschneid_ has joined #ruby
Tempesta_ is now known as Tempesta
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Kuukunen- has quit [Quit: leaving]
Kuukunen has joined #ruby
cschneid_ has quit [Ping timeout: 268 seconds]
mentok has quit [Ping timeout: 240 seconds]
apparition has joined #ruby
cschneid_ has joined #ruby
cabraturgo has joined #ruby
Azure has quit [Read error: Connection reset by peer]
Tempesta has quit [Quit: AdiIRC is updating to v2.8 Beta Build (2017/05/14) 64 Bit]
Tempesta has joined #ruby
Azure has joined #ruby
weathermaker has joined #ruby
cabraturgo has quit [Quit: Bye!]
JeanCarloMachado has joined #ruby
JeanCarl1Machado has joined #ruby
rfoust has joined #ruby
gizmore|2 has joined #ruby
cam27 has quit [Quit: cam27]
gizmore has quit [Ping timeout: 240 seconds]
d^sh has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
rkellermeyer has quit [Quit: Leaving]
weathermaker has quit [Ping timeout: 240 seconds]
joast has joined #ruby
fmccann has joined #ruby
fmccann has quit [Client Quit]
jusa has joined #ruby
jusa has quit [Ping timeout: 240 seconds]
genpaku has quit [Remote host closed the connection]
genpaku has joined #ruby
wilo has joined #ruby
jud^ has joined #ruby
jud has quit [Ping timeout: 245 seconds]
enterprisey has joined #ruby
herbmillerjr has quit [Quit: Konversation terminated!]
igniting has quit [Ping timeout: 260 seconds]
cabraturgo has joined #ruby
JeanCarl1Machado has quit [Ping timeout: 272 seconds]
JeanCarl1Machado has joined #ruby
nomad101 is now known as pifon
excph has quit [Ping timeout: 240 seconds]
igniting has joined #ruby
mim1k has joined #ruby
SimpleIRC_VLBcT has joined #ruby
SimpleIRC_VLBcT has quit [Client Quit]
mim1k has quit [Ping timeout: 240 seconds]
weathermaker has joined #ruby
weathermaker has left #ruby [#ruby]
cabraturgo has quit [Quit: Bye!]
mentok has joined #ruby
Toledo has joined #ruby
silentoxygen has joined #ruby
jusa has joined #ruby
mentok has quit [Ping timeout: 240 seconds]
JeanCarloMachado has quit [Ping timeout: 272 seconds]
JeanCarl1Machado has quit [Ping timeout: 268 seconds]
silentoxygen has quit []
wilo has quit [Read error: Connection reset by peer]
bravo has joined #ruby
wilo has joined #ruby
bravo has quit [Client Quit]
cschneid_ has quit [Remote host closed the connection]
jusa has quit [Ping timeout: 260 seconds]
nofxx has joined #ruby
Cohedrin has quit [Max SendQ exceeded]
pharma_joe has joined #ruby
silentoxygen has joined #ruby
cabraturgo has joined #ruby
lightstalker has quit [Ping timeout: 240 seconds]
jane_booty_doe has quit [Quit: Leaving]
Cohedrin has joined #ruby
lightstalker has joined #ruby
Trynemjoel2 has quit [Ping timeout: 245 seconds]
milardovich has joined #ruby
enilsen16 has joined #ruby
linetrace has quit [Read error: Connection reset by peer]
milardovich has quit [Ping timeout: 240 seconds]
Trynemjoel has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
cschneid_ has joined #ruby
Cohedrin has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
cschneid_ has quit [Ping timeout: 272 seconds]
Cohedrin has joined #ruby
Select has joined #ruby
<Select>
Hi
igniting has quit [Ping timeout: 240 seconds]
patr0clus has quit [Quit: tempusfugit]
Select has left #ruby [#ruby]
etehtsea has joined #ruby
gix has quit [Ping timeout: 240 seconds]
araujo has quit [Quit: Leaving]
cabraturgo has quit [Quit: Bye!]
gix has joined #ruby
enilsen16 has quit [Ping timeout: 240 seconds]
enilsen16 has joined #ruby
enilsen16 has quit [Client Quit]
quobo has quit [Quit: Connection closed for inactivity]
igniting has joined #ruby
latemus has quit [Ping timeout: 240 seconds]
mikias has joined #ruby
etehtsea has quit [Ping timeout: 240 seconds]
jusa has joined #ruby
_whitelogger has joined #ruby
enilsen16 has joined #ruby
nullfxn has joined #ruby
renchan has joined #ruby
wilo has quit [Quit: Konversation terminated!]
Caius has quit [Ping timeout: 255 seconds]
Caius has joined #ruby
ych has joined #ruby
mim1k has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
enilsen16 has quit [Quit: enilsen16]
mentok has joined #ruby
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikias has left #ruby [#ruby]
igniting has quit [Ping timeout: 268 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
enterprisey has quit [Remote host closed the connection]
xenops has quit [Ping timeout: 240 seconds]
excph has joined #ruby
bkxd has joined #ruby
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
enterprisey has joined #ruby
<Radar>
dminuoso: Hi.
<Radar>
Please leave a message after the tone. *BEEP*
excph has quit []
haxrbyte has joined #ruby
pharma_joe has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
anisha_ has joined #ruby
enterprisey has quit [Remote host closed the connection]
anisha has quit [Read error: Connection reset by peer]
latemus has joined #ruby
TomyWork has joined #ruby
jackrandom has joined #ruby
jusa has joined #ruby
Burgestrand has quit [Quit: Closing time!]
jusa has quit [Ping timeout: 240 seconds]
yogg-saron has joined #ruby
kies has joined #ruby
Burgestrand has joined #ruby
armyriad has quit [Ping timeout: 240 seconds]
armyriad has joined #ruby
andikr has joined #ruby
mark_66 has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Caius has quit [Ping timeout: 255 seconds]
marr has joined #ruby
Caius has joined #ruby
im0nde has joined #ruby
User458764 has joined #ruby
biberu has joined #ruby
Volhist has joined #ruby
kies has quit [Ping timeout: 268 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pandaant has joined #ruby
aufi has joined #ruby
marr has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 272 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Pongles has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
charliesome has joined #ruby
bkxd has joined #ruby
jameser_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 246 seconds]
im0nde has quit [Ping timeout: 240 seconds]
Silthias has joined #ruby
jameser has joined #ruby
mikecmpbll has joined #ruby
User458764 has joined #ruby
<dzodzo>
greetings, i have a matrix of conditions that are represented by 2 variables - i have a category (exists, doesn't) and tag (exists, doesn't), what would be an ellegant way to implement the decision logic? there can be 4 states, is there something like multivalue case category,tag option?
<dzodzo>
or in this case it's ok with if A && B, elsif !A && B... etc
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bigkevmcd has joined #ruby
antgel has joined #ruby
TreyG has quit [Ping timeout: 260 seconds]
TreyG has joined #ruby
nofxx has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
mim1k has joined #ruby
<judofyr>
dzodzo: you can do: case [A, B]; when [true, true]; … end
<judofyr>
but I'm not sure if it's cleaner
bigkevmcd has quit [Read error: Connection reset by peer]
bigkevmcd has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
<dzodzo>
that might represent the matrix better, i will try it, thanks
lipoqil has quit [Quit: Connection closed for inactivity]
im0nde has quit [Ping timeout: 268 seconds]
haxrbyte has quit [Read error: Connection reset by peer]
haxrbyte has joined #ruby
Talltree_ has quit [Remote host closed the connection]
haxrbyte has quit [Remote host closed the connection]
haxrbyte has joined #ruby
Talltree has joined #ruby
pifon has quit [Quit: Connection closed for inactivity]
tomphp has joined #ruby
flying has quit []
tvw has quit [Read error: Connection reset by peer]
tvw has joined #ruby
Tripolitix has joined #ruby
GodFather has joined #ruby
flying has joined #ruby
KiderSpiel has quit [Quit: KiderSpiel]
haxrbyte has quit [Quit: Leaving...]
yitsushi has joined #ruby
Skarlso has joined #ruby
whiteline has joined #ruby
Tripolitix has left #ruby [#ruby]
dcunit3d has joined #ruby
<ikopico>
dyjakan: nice! My two cents: I would've extract some of the _Rails_ questions for a general webapp question, such as "What is REST?", "What is an ORM?"
GodFather has quit [Client Quit]
TreyG_ has joined #ruby
GodFather_ has joined #ruby
dcunit3d has quit [Client Quit]
tildes has quit [Ping timeout: 240 seconds]
bkxd has quit [Ping timeout: 260 seconds]
jaruga has joined #ruby
TreyG has quit [Ping timeout: 258 seconds]
<dyjakan>
ikopico: I see your point but I think that currently there's not enough questions that can be abstracted (i.e. general web app section would be too small imo)
bkxd has joined #ruby
<ikopico>
dyjakan: Sure.
Burgestrand has quit [Quit: Closing time!]
TreyG has joined #ruby
<dzodzo>
judofyr: works as intended, thanks :)
TreyG_ has quit [Ping timeout: 255 seconds]
GodFather_ has quit [Ping timeout: 240 seconds]
<dminuoso>
Mmmm. Regarding that "and vs &&" -> didn't we have an exceptional case showing some really nasty subtle difference between the two?
<dminuoso>
I feel like the parser should not choke on this.
alazred has quit [Ping timeout: 260 seconds]
mim1k has quit [Ping timeout: 268 seconds]
Talltree has quit [Ping timeout: 272 seconds]
Talltree has joined #ruby
<dyjakan>
dminuoso: what do you mean by nasty subtle difference?
<dyjakan>
from my personal experience I don't use 'and' and other word logical operators in ruby and I would expect because they have lower priority, I already hit bugs with them
<dyjakan>
(I would expect elaboration on this from a candidate)
nadir has joined #ruby
TreyG_ has joined #ruby
apparition has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TreyG has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
im0nde has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Vingador has joined #ruby
_aeris_ has joined #ruby
ldnunes has joined #ruby
<judofyr>
dzodzo: is it any cleaner though? might be more cryptic with true/false everywhere
InsaneSplash has joined #ruby
JeanCarloMachado has joined #ruby
JeanCarl1Machado has joined #ruby
<workmad3>
dminuoso: the parser can be a bit picky about running an expression like that across two lines... you can always end a line with \ to fix the issue though (https://eval.in/795334)
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<workmad3>
but yeah, might be the case that it should be a bit more lenient :)
<InsaneSplash>
I have data returned from a REST API in JSON format, the data includes a results section which is being turned in to an array. I am trying to obtain a number of values from this but not making any headway. the 'dig' only works on JSON when its seen as a hash, but in this case there is an array within the hash...
<InsaneSplash>
would be great if I could reference data using a key like first.second.third
mim1k has quit [Ping timeout: 240 seconds]
Kanbi_ has quit [Ping timeout: 240 seconds]
Vingador has quit [Remote host closed the connection]
JeanCarl1Machado has quit [Ping timeout: 246 seconds]
JeanCarloMachado has quit [Ping timeout: 264 seconds]
minimalism has quit [Quit: minimalism]
<dzodzo>
judofyr: this is just for a matrix 2x2 so it's quite clear
minimalism has joined #ruby
cabraturgo has joined #ruby
JeanCarloMachado has joined #ruby
jameser has joined #ruby
JeanCarl1Machado has joined #ruby
cabraturgo has quit [Client Quit]
<dminuoso>
matthewd: Mmm yeah I figured \ would fix it. I mean it definitely works for method calls, but debugging a LALR parser to figure out why it would even break is a pure nightmare..
tabakhase has quit [Ping timeout: 240 seconds]
<dminuoso>
Last time after a few hours my head was spinning around states..
JeanCarloMachado has quit [Ping timeout: 268 seconds]
JeanCarl1Machado has quit [Ping timeout: 240 seconds]
<dminuoso>
InsaneSplash: You can provide your own mixin to add :second and :third methods respectively.
JeanCarloMachado has joined #ruby
JeanCarl1Machado has joined #ruby
morfin has joined #ruby
<morfin>
which characters are valid in email before @?
<morfin>
i mean right next to it
<dminuoso>
morfin: Does this channel look like #google-for-rfc ?
<workmad3>
morfin: if it's quoted, anything is allowed before the @
<workmad3>
" fooo "@[192.168.0.1] is valid
jackrandom has quit [Remote host closed the connection]
<workmad3>
(it'll almost certainly never get anywhere, so it's not deliverable... but it's valid)
<dminuoso>
Which is that "reality" part that I mentioned.
<workmad3>
:)
<morfin>
funny, i can't be sure what's valid and what's not because remote API has different opinion
<dminuoso>
The issue is just that by arbitrarily disallowing valid email addresses you just add to the ball of reasons why the entire world is riding on non-compliant mail.
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<workmad3>
morfin: if you have a remote API that's validating email addresses, just chuck them at it and record the response...
<dminuoso>
morfin: Let the remote API decide entirely then.
blackwind_123 has joined #ruby
<workmad3>
trying to rebuild a different system's email validation rules based on testing inputs is a crazy and futile exercise...
jameser has joined #ruby
marr has joined #ruby
jameser has quit [Client Quit]
nowhere_man has quit [Ping timeout: 245 seconds]
jameser has joined #ruby
hashrocket has joined #ruby
jameser has quit [Client Quit]
jameser has joined #ruby
<dminuoso>
Though you can implement a more generous simple regex matcher, and only do the remote validation on submit (or debounced)
Fysicus has quit [Ping timeout: 240 seconds]
<workmad3>
^ or use `type=email` for submit and provide a regexp matcher as a fallback (assuming webpage entry)
<dminuoso>
Say something along the lines of [\w\s-_]+@[\w\s-_\.]+
bmurt has joined #ruby
<dminuoso>
Oh type=email that's neat.
<morfin>
well, i will ask different question
PaulCapestany has quit [Quit: .]
<morfin>
how can i replace characters around other character?
<morfin>
i will remove spaces only and try send like that
mim1k has joined #ruby
PaulCapestany has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
bonhoeffer has joined #ruby
shinnya has joined #ruby
tgragnato has joined #ruby
BSab has quit [Quit: Leaving]
tomphp has joined #ruby
BSaboia has joined #ruby
vali has joined #ruby
<ljarvis>
are we validating email addresses up in here?
tvw has quit [Ping timeout: 260 seconds]
xenops has joined #ruby
<canton7>
\w includes underscore. "-" needs escaping there. You don't allow +'s, or quotes, or...
<canton7>
(gmail users can put stuff after a + at the end of their email, e.g. "foo.bar+reddit@gmail.com", which is very useful for filtering, etc. They tend to get pissed off if your email validation rejects that)
dcluna has quit [Ping timeout: 272 seconds]
<workmad3>
canton7: number of people on the internet pissed off if you disallow 'foo@localhost' == 0
<judofyr>
the best email regex: /@/
<ljarvis>
optimised
dcluna has joined #ruby
<canton7>
/\A.+@.+\Z/ is probably not a bad one for real-world usage. I mean, what's the point of email validation? About the only reasons are making sure someone doesn't leave it blank, and making sure they don't accidentally type their name. Anything else is only ever going to piss off someone
<apeiros>
email validations? fun, just tweeted about that today…
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<canton7>
if you're preventing someone from typing rubbish... they'll just keep making up rubbish until they find one that passes your validation: they won't go "oh, no, they rejected 'a@a', I'd better type my actual email"
<apeiros>
RFC822 is rather ancient
<workmad3>
majority of time you don't care about validity, you care about deliverability... and that's a pretty different issue
<workmad3>
I found an address that ^ incorrectly says is valid a while ago :)
<apeiros>
regarding email validation (without having read full scrollback): 1) most tips and expressions on the internet are *wrong*.
<apeiros>
2) you most likely do NOT want to allow all technically valid email addresses
houhoulis has joined #ruby
chouhoulis has joined #ruby
<apeiros>
3) as workmad3 said, syntactically valid emails are not necessarily deliverable. there's no real way to test deliverability. best you can do is send an email which requires an action from the recipient (not always applicable)
judofyr has quit [Remote host closed the connection]
renchan_ has joined #ruby
renchan has quit [Read error: Connection reset by peer]
houhoulis has quit [Ping timeout: 246 seconds]
ramortegui has joined #ruby
<apeiros>
re canton7 "what's the point of email validations": depends entirely on where you use it. we had terrible quality in our database which made campaigns rather useless. tons of the bad email addresses would have been preventable. things like foo@gmail@com (which your regex would still allow)
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
others report vastly lowered drop-out rates in online campaigns - again, due to silly typos usually like htomail.com
<apeiros>
(of course, that's something a regex alone won't help)
feal has quit [Quit: Leaving]
<workmad3>
apeiros: gmail.con is a common one we've had at my workplace
<apeiros>
but nb, I prefer a validator which allows too much over a validator which allows too little. tons of validators which fail at utf8 in local part, IDNs, or +, & etc. in local part.
<linduxed>
hey guys! let's say that i've got some high-res source image that gets run through rmagick, or something like that. over on whatever storage solution one uses, there are now at least two files: "thumb.png" and "full.png"
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<linduxed>
one way of storing links to these images would be to have a database column that is called "thumbnail_url" and one called "full_image_url"
<linduxed>
but if i have like 5 of these, that's a lot of extra database columns
<linduxed>
an alternative would be to generate links that have hardcoded suffixes, such as "thumb.png", "full.png" and so on
<linduxed>
easier, but i think it's a hacky solution that's error prone
<ljarvis>
i don't think that's hacky
<linduxed>
you don't?
<ljarvis>
no not really, i think it's fine
<linduxed>
hmmm
<linduxed>
maybe if the suffix was fetched from a list of constants
<ljarvis>
you could be able to build image urls dynamically in my opinion, and just update a single endpoint if it changes
chouhoulis has quit [Remote host closed the connection]
<linduxed>
hmmm, ok
<ljarvis>
well sure, you can validate suffixes if you'd like
chouhoulis has joined #ruby
Fysicus has joined #ruby
<crayfishx>
qq.... I have a hash which might contain some procs/lambdas - I don't care about them specifically but later on I need to Marshal.load/dump the hash so Im trying to find a nice way to 'clean' the hash of any procs/lambdas....etc. The easiest way so far is to do cleanhash = JSON.load(dirtyhash.to_json) which "stringyfies" everything and means I can Marshal.dump/load it without error - but that's pretty expensive - is there are better way to do
<crayfishx>
this?
yehowyada has joined #ruby
<linduxed>
ljarvis: well, thanks for your input!
anisha_ has quit [Quit: This computer has gone to sleep]
<ljarvis>
crayfishx: keep a copy that does not contain procs?
cdg has joined #ruby
minimalism has quit [Quit: minimalism]
Bhootrk_ has joined #ruby
alessandro_ has joined #ruby
igniting has quit [Ping timeout: 268 seconds]
<elomatreb>
crayfishx: Hash has select/reject methods, def. cleaner than relying on JSON
xall has quit [Ping timeout: 268 seconds]
<crayfishx>
elomatreb: yeah - problem is the procs could be burried in nested hashes or arrays
bonhoeffer has quit [Ping timeout: 240 seconds]
<crayfishx>
ljarvis: I don't build the hash, it's coming out of a third party library - I just need to parse it to make it dumpable by Marshal.
ldnunes has quit [Quit: Leaving]
quite has left #ruby ["WeeChat 1.7.1"]
aurelien has quit [Read error: Connection reset by peer]
ldnunes has joined #ruby
patarr has joined #ruby
gnufied has joined #ruby
DLSteve has joined #ruby
alessandro_ has quit [Quit: Page closed]
yeticry_ has joined #ruby
mentok has joined #ruby
ResidentBiscuit has joined #ruby
<dminuoso>
canton7: It was not meant as an accurate usable regexp.
<somerandomteen>
aha! there's me being thick :) thanks apeiros! As an aside, I don't suppose you know why Neighborhood is capitalised there? (it's the devise {authentication_keys} variable)
<somerandomteen>
You can probably tell I'm pretty new to Ruby haha
tomphp has joined #ruby
<apeiros>
I don't use devise, so no idea, no
jrafanie has joined #ruby
<somerandomteen>
cool, no problem :)
tomphp has quit [Client Quit]
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
tomphp has joined #ruby
cam27 has joined #ruby
mim1k_ is now known as mim1k
apparition has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cfec0b8d has quit [Quit: Leaving]
<cam27>
So if I have a String object and then assign a new string object to that object. How come I can change it’s value, but if I use .replace then it changes both?
kegster has joined #ruby
polishdub has joined #ruby
amclain has joined #ruby
tristanp_ has quit []
tristanp has joined #ruby
cdg has joined #ruby
postmodern has joined #ruby
aufi has joined #ruby
ledestin has joined #ruby
soc42 has joined #ruby
alazred has joined #ruby
alazred has joined #ruby
alazred has quit [Changing host]
jackrandom has joined #ruby
brent__ has joined #ruby
gothicsouth has joined #ruby
BSab has joined #ruby
bruno- has joined #ruby
AlexRussia has quit [Ping timeout: 240 seconds]
rory has joined #ruby
BSAlb has quit [Ping timeout: 246 seconds]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Burgestrand>
cam27 for one, ruby's strings are mutable, and ruby always passes things by reference
<Burgestrand>
(or, well, by value but the value is the reference)
cam27 has quit [Quit: cam27]
chihhsin_ has quit [Quit: leaving]
bonhoeffer has quit [Ping timeout: 240 seconds]
cout_ is now known as cout
chihhsin has joined #ruby
<morfin>
dminuoso, you can't even imagine crap i saw today
<baweaver>
Burgestrand: which version of Ruby though? :)
<morfin>
1000 messages with errors like "someemail@ domain.com" or someemail @domain.com or someemail.@domain.com etc etc
facest has quit [Ping timeout: 240 seconds]
spheric has joined #ruby
<morfin>
i was not trying to fix all emails but at least reduce number of finished with an error
raspado has joined #ruby
gusrub has joined #ruby
TomyLobo has joined #ruby
gusrub has quit [Client Quit]
soc42 has quit [Remote host closed the connection]
nitric has joined #ruby
AlexRussia has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
xall has quit [Ping timeout: 260 seconds]
gusrub has joined #ruby
TomyLobo2 has joined #ruby
AgentVenom has joined #ruby
Eiam has joined #ruby
Eiam has quit [Client Quit]
TomyLobo has quit [Ping timeout: 240 seconds]
BSab has quit [Quit: Leaving]
BSaboia has joined #ruby
Eiam has joined #ruby
jespada has joined #ruby
mas886 has joined #ruby
brent__ has quit [Remote host closed the connection]
<mas886>
How can I concatenate a file in ruby? "File.open("asd.txt", 'w') { |file| file.write(msg) }" <- This one overwrites what's already on the file.
mikecmpbll has quit [Quit: inabit. zz.]
jespada has quit [Client Quit]
GinoMan has joined #ruby
<ljarvis>
mas886: "a" (append) instead of "w" (write)
brent__ has quit [Remote host closed the connection]
amclain has joined #ruby
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
cam27 has joined #ruby
rkazak has joined #ruby
<cam27>
Burgestrand: thank you for replying first of all. I could never fully understand this concept of mutable as I bounce around from language to language. Is Ruby different than C++ and Java in this regards?
t-recx has joined #ruby
lxsameer has quit [Quit: WeeChat 1.7]
<Burgestrand>
cam27 I find that it helps to think about identity when it comes to mutable strings, if you do: a = "Hello"; b = a — in Ruby b is not only the same as a, it *IS* a
<Burgestrand>
cam27 however, if you do: a = "Hello"; b = "Hello" — b now only looks like a, but it isnt a
yokel has quit [Quit: Lost terminal]
yokel has joined #ruby
xall has joined #ruby
ascarter has joined #ruby
<Burgestrand>
cam27 like in this example, https://eval.in/795691, there is no real difference
SeepingN has joined #ruby
alazred has joined #ruby
alazred has joined #ruby
alazred has quit [Changing host]
Burgestrand has quit [Quit: Closing time!]
<cam27>
Burgestrand: You know what I jsut did to help me out. I created a, then assigned it to b. Printed out their object_id and noticed they were the same until I changed one of the two values, then they broke away from each other. But with a.replace(“new_value”) they were still the same object_id
<ljarvis>
replace doesn't return a new object like many string methods, it mutates self
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<ljarvis>
it should really include a bang
<ljarvis>
but it doesn't, because ruby
pupsicle has joined #ruby
<SeepingN>
urgh. Damn you ruby and your Time changes
renchan has quit [Quit: Leaving...]
horst has joined #ruby
<cam27>
ljarvis: I just ran a.upcase and it is the same object_id
tlaxkit has quit [Quit: tlaxkit]
Silthias has quit [Ping timeout: 246 seconds]
<cam27>
which one should I try to see that it changed, and thanks for the code snippet burgestrand
<ljarvis>
>> a = "foo"; a.upcase.object_id == a.object_id
<ljarvis>
you can't do `a = "foo"; a.upcase; a.object_id` because the return value of a.upcase is ignored. The method doesn't mutate self, and so a is still not upcased
SeepingN has quit [Quit: The system is going down for reboot NOW!]
<ljarvis>
ignoring the ! is exactly what was demonstrating my point
hobodave has quit [Quit: Computer has gone to sleep.]
Cohedrin has joined #ruby
antgel has quit [Ping timeout: 260 seconds]
duderonomy has joined #ruby
<cam27>
I’m reading the Well Grounded Rubyist at the moment, cause my first time working with Rails I realized that I need to master Ruby
<cam27>
Trying to get a deeper understanding this time around
nowhere_man has joined #ruby
SeepingN has joined #ruby
<cam27>
I think I will try to get a job as a Ruby developer first to master Ruby and then worry about the Rails part of it all. Not sure if it will work out that way. But I was all of the way to RSpec, Teaspoon, Jasmine, etc, and I never really fully understood Ruby code in my controllers
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
romank has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has quit [Ping timeout: 255 seconds]
raul782 has joined #ruby
gothicsouth has joined #ruby
<cam27>
And I’m reading through this book and it is so much easier this time around having a much better understanding of OOP
Puffball has quit [Remote host closed the connection]
ascarter has joined #ruby
Puffball has joined #ruby
psmolen has quit [Ping timeout: 255 seconds]
<eam_>
/win 1
<eam_>
whoop, good morning all
<cam27>
Just learned what a Singleton is :) Again. heard about them, never knew that they only worked for one object :) Ok, I won’t bug you guys, but pretty good decision on my part to come back to this book and start it on pg 1
psmolen has joined #ruby
anisha_ has quit [Ping timeout: 246 seconds]
c0mrad3 has joined #ruby
rory has left #ruby [#ruby]
<Papierkorb>
cam27: just be wary that singletons are also a great way to shoot yourself into your foot if you didn't think it completely through
<cam27>
Not sure why I would want to use them, cause I could just not call those methods with another object? I mean, if I have a method that needs to be different from one object, wouldn’t I jsut change the argument?
<eam_>
you don't ever have to use them strictly speaking. Any task that can be done with a singleton can be done with a regular object
Puffball has quit [Remote host closed the connection]
<eam_>
but it can be confusing if a method has no relationship to its object
eam_ is now known as eam
eam has quit [Changing host]
eam has joined #ruby
muelleme has joined #ruby
Puffball has joined #ruby
chouhoulis has quit [Remote host closed the connection]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ascarter has joined #ruby
GinoMan has quit [Ping timeout: 255 seconds]
alazred has quit [Ping timeout: 260 seconds]
kurko has joined #ruby
romank has joined #ruby
antgel has joined #ruby
hobodave has joined #ruby
hahuang65 has joined #ruby
PatrikasZvaigzde has quit [Ping timeout: 260 seconds]
PatrikasZvaigzde has joined #ruby
dionysus69 has joined #ruby
anisha has joined #ruby
mas886 has quit [Ping timeout: 245 seconds]
xall has quit [Read error: Connection reset by peer]
tvw has joined #ruby
jaruga has quit [Quit: jaruga]
jaruga has joined #ruby
jaruga has quit [Client Quit]
alazred has joined #ruby
alazred has joined #ruby
alazred has quit [Changing host]
borodin has joined #ruby
workmad3 has quit [Ping timeout: 260 seconds]
Ishido has joined #ruby
marlinc has quit [Ping timeout: 260 seconds]
xall has joined #ruby
milardovich has joined #ruby
Bock has quit [Read error: Connection reset by peer]
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
mwlang has joined #ruby
bonhoeffer has joined #ruby
ahrs has quit [Remote host closed the connection]
ahrs has joined #ruby
cdg has quit [Remote host closed the connection]
gothicsouth has joined #ruby
enterprisey has joined #ruby
gusrub has quit [Remote host closed the connection]
muelleme has quit [Ping timeout: 268 seconds]
jusa has quit [Ping timeout: 268 seconds]
exchgr has joined #ruby
mentok has quit [Changing host]
mentok has joined #ruby
jackrandom has quit [Remote host closed the connection]
marlinc has joined #ruby
jackrandom has joined #ruby
muelleme has joined #ruby
enterprisey has quit [Quit: Leaving]
quobo has quit [Quit: Connection closed for inactivity]
jackrandom has quit [Remote host closed the connection]
chouhoulis has joined #ruby
<Pierreb>
if i want to compare see if 1 variable is equal to 2 variable how do i write that? if $var1 == $var2 doesnt work
<elomatreb>
Show your code, since that's exactly how it's supposed to work
<elomatreb>
Try printing your variables directly before you're comparing them (`p $somevar`), your values may just be incorrect
<matthewd>
That.. is a lot of globals
<al2o3-cr>
matthewd: literally just beat me to it :p
<dminuoso>
Also this strange mix of imperative programming and state machinery it really amazing.
<Papierkorb>
Pierreb: In case you don't know, in ruby, $ denotes a global variable. Just leave it off if you want a local variable instead.
<matthewd>
Channel() is pretty interesting too
<Pierreb>
using cinch
<al2o3-cr>
matthewd: cinch bot by the looks of it
<dminuoso>
I have been developing Ruby programs in different sizes for about 8 years now, half of that professionally.
<dminuoso>
Until now I have never ever developed the need for a global.
<dminuoso>
A single one
<elomatreb>
$stdout? :P
<dminuoso>
With the sole exception of logger interfaces.
<dminuoso>
Heh.
<Pierreb>
i just picked 1 and if it worked
<Pierreb>
went for it all the way
<elomatreb>
They will persist if that block gets called multiple times, which may be what's confusing you
<dminuoso>
elomatreb, I guess that kind of fits into the "logger exception" - but that is about the one spot where mutable globals are generally not frowned upon.
<matthewd>
Ah okay, I'll retain the opinion that it looks surprising, but will grant that it's not open to change here ;)
quobo has joined #ruby
<Pierreb>
i dont mind changing so ill go read about variables :)
<matthewd>
Pierreb: If you're up for change, please also consider 2-space indentation.. it's a near-universal standard in ruby code
<elomatreb>
And even for $stdout, I don't think I ever actually typed it somwehere myself since most of the methods just assume it
<dminuoso>
elomatreb, yeah I think I only ever used STDOUT -> not that it's particularly better than $ ..
hobodave_ has joined #ruby
muelleme has quit [Ping timeout: 260 seconds]
hobodave has quit [Ping timeout: 240 seconds]
<elomatreb>
I had a whole reply typed out about how I'd rather just use STDOUT since I can reassign it, confused the two
<Pierreb>
matthewd never understood thatm looks weird but ill change them
TreyG has joined #ruby
<dminuoso>
elomatreb, shame. Would have loved some seal clubbing!
<matthewd>
Pierreb: At a higher level, I'd suggest you maybe want some objects to handle the actual behaviours, separate from the "UI" of the message parsing -- but that depends on how comfortable you are with classes etc, and the nature/purpose of your project
alazred has quit [Ping timeout: 240 seconds]
<dminuoso>
And functions. Pure functions!
<matthewd>
e.g. if the goal is to progressively learn ruby while implementing something, it may indeed be better to keep all the logic in-line for now, and worry about more complex extractions later
<dminuoso>
Never not write pure functions in eloquent Ruby!
<elomatreb>
RewriteInHaskell.meme
haylon has joined #ruby
latemus has quit [Ping timeout: 268 seconds]
chouhoul_ has quit [Remote host closed the connection]
quobo has quit []
chouhoulis has joined #ruby
mim1k has joined #ruby
bonhoeffer has joined #ruby
cek has joined #ruby
gusrub has joined #ruby
quobo has joined #ruby
<cek>
wondering if there's a includee callback that would be invoked when includer scope closes.
mim1k has quit [Ping timeout: 240 seconds]
kristofferR has joined #ruby
Verity has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
nullfxn has quit [Quit: leaving]
alazred has joined #ruby
alazred has joined #ruby
alazred has quit [Changing host]
<matthewd>
cek: No
<cek>
thanks, that really helped.
minimalism has joined #ruby
<dminuoso>
cek, there may not even be any such scope. Consider C.include(M)
<matthewd>
Given a problem, I can suggest a solution. Given a binary question about whether a thing exists, I can only answer it.
<dminuoso>
cek, ?xy
<dminuoso>
cek, !xy
<dminuoso>
?xy cek
<ruby[bot]>
cek: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378