baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.0, 2.3.3 & 2.2.6: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
<apeiros> oh, seems 2.1 even
<elomatreb> Also, Ruby does not strictly follow semantic versioning
<GameDevFox> Got it
<GameDevFox> That being the case, what dictates when to increment the "tiny" versus the "patchlevel" in my own project
marcdel_ has quit [Client Quit]
<apeiros> in <= 2.0 rubies, it meant "only bugfixes in this release"
<GameDevFox> Normally patches would be bugfixes and changes that don't provide functionality
<GameDevFox> Ok so ONLY bug fixes, as opposed to other changes for a patch level, right
<GameDevFox> ?
<elomatreb> IIRC the Ruby patchlevel was just the number of a certain type of commits, no?
marcdel has quit [Ping timeout: 268 seconds]
<GameDevFox> Ah, that makes sense since there's no sequential ordering to them
<GameDevFox> That answers my questions. Thanks for your help everyone. It's great to be part of the Ruby community! :)
GameDevFox has left #ruby [#ruby]
zeroDi has quit [Quit: WeeChat 1.7]
jhack_ has joined #ruby
rhyselsmore has quit [Quit: Textual IRC Client: www.textualapp.com]
cdg has quit [Ping timeout: 260 seconds]
jhack has quit [Ping timeout: 240 seconds]
darix has quit [Quit: may the packets be with you...]
darix has joined #ruby
welfkarling has joined #ruby
cpruitt has quit [Read error: Connection reset by peer]
darix has quit [Client Quit]
darix has joined #ruby
cpruitt has joined #ruby
BTRE has quit [Quit: Leaving]
leitz has joined #ruby
axsuul- has quit [Ping timeout: 246 seconds]
axsuul has joined #ruby
hotpanca_ has joined #ruby
<leitz> Quick question before nappy time; does Java have something like Ruby's Mixins? I'm watching some Bob Martin videos and he references Java code. Some of the solutions seem easier with mixins.
hotpancakes has quit [Ping timeout: 246 seconds]
<al2o3-cr> leitz: just solves multiple inheritence. tia
jgt has quit [Read error: Connection reset by peer]
jgt has joined #ruby
<leitz> Thanks! I'm trying to learn more but most of the resources aren't Ruby based. Still, good learning though.
<al2o3-cr> leitz: programming is shit, just live life.
leitz has quit [Quit: Nappy time]
hutch34 has joined #ruby
rfoust has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
toretore has quit [Ping timeout: 240 seconds]
sepp2k has quit [Read error: Connection reset by peer]
|RicharD| has quit [Quit: Sto andando via]
nadir has quit [Quit: Connection closed for inactivity]
milardovich has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
tvw has joined #ruby
gloscombe_ has quit [Ping timeout: 260 seconds]
cschneid_ has joined #ruby
MasterRex has joined #ruby
tvw has quit []
<mzo> ruby
<mzo> how do i get hired to write ruby
<mzo> i want to become a ruby god and make just enough to get by doing good honest work
<baweaver> depends on a lot of factors, primarily location
<mzo> where should i move to?
<baweaver> though to become a Ruby God you have to be ordained by at least 3 core members and Matz himself.
<mzo> ok maybe not a god then
bocaneri has joined #ruby
<mzo> a ruby adept
<baweaver> SF Bay Area, Austin TX, KC MO, Boston MA, Philadelphia PA, Seattle WA, or another major tech hub.
<baweaver> also depends heavily on your experience
enterprisey has joined #ruby
<baweaver> remote jobs are impossible with much under 5-10 years experience.
rkazak_ has joined #ruby
<mzo> ok so i have to relocate
<mzo> but then what
<mzo> or rather, what before that
<baweaver> Then you look around LinkedIn and other job sites
<mzo> i don't think i'm skilled enough yet
<mzo> how do i become someone that people will want to hire
BTRE has joined #ruby
<mzo> a ruby adept
<baweaver> What's your background?
<mzo> i'm 20 years old. no work experience. but i'm pretty good at programming i think.
<elomatreb> You should definitely actually try working a programming job first before thinking about relocating for a job. See if you actually like it
<mzo> i do like it
<elomatreb> Programming for fun/personal stuff is very different from doing serious work and/or working in a professional team with time constraints
<mzo> i know, but i still like it
<baweaver> Where are you currently?
<mzo> eastern canada
<baweaver> Can you find any programming jobs around there?
<mzo> maybe. but i want a rails job.
<baweaver> The bad news is that very few places hire junior Rails devs
<mzo> why's that?
<baweaver> obsession with Seniors mainly and not reinvesting in the community
<mzo> should i stay away from rails then?
<baweaver> (feel free to prove me wrong anyone else, but I've seen this be the case more than I'd like to admit)
<baweaver> At this stage, try and find a programming job in general and work from there
<baweaver> If you can get any related experience it'll be leverage for doing anything else later
<mzo> i get the impression that there aren't too many non-rails ruby jobs. is that true?
<elomatreb> You just need to convey to the recruiter that you're able to actually do stuff with rails, a lot of people claiming "rails experience" stumbled through the first tutorials once and put it on their CV
selfthoughtstood has joined #ruby
<selfthoughtstood> there is a hackerrank problem called candies and i would like to see the ruby solution so i can study it
<mzo> solve it in ruby then
<baweaver> selfthoughtstood: that's not the way this channel works
<selfthoughtstood> baweaver: i'm not doing this for homework or anything else
<selfthoughtstood> i just want to learn programming
<baweaver> we have to see some effort put into a solution before we give help, we don't just outright solve things
<selfthoughtstood> i don't want you to solve it
<selfthoughtstood> i just want to see a solution that was already implemented
<baweaver> The gist of it is that it's a Knapsack problem
<selfthoughtstood> i see the solution in other languages that i don't know yet
<selfthoughtstood> i know ruby and javascript
<mzo> looking at solutions defeats the purpose
<mzo> it's much more rewarding to solve it yourself
<selfthoughtstood> no i learned a lot from looking at solutions
<mzo> sure you did
<selfthoughtstood> looking at solutions helps me understand the problem completely
<baweaver> mzo: enough
<mzo> selfthoughtstood: it seems like it does, but you're not really getting better at problem solving.
<elomatreb> I have to agree with selfthoughtstood there, I like understanding solutions more than coming up with a half-baked answer myself
<mzo> at least try it before looking at the solution. you're really cheating yourself.
<baweaver> what I'm saying is see how far you get, then come with a gist of information asking how it could be improved
<baweaver> some problems will naturally be beyond you
<mzo> every problem is beyond you if you don't attempt it
<allisio> Deep.
<allisio> And accurate.
<baweaver> some are still beyond you even if you attempt them
<baweaver> there are some prerequisite bits of knowledge which will enable you to get there
<allisio> Big if true.
<mzo> haha
marr has quit [Ping timeout: 240 seconds]
<baweaver> mzo: While that may be in essence truth, there are better and less confrontational ways of stating it. Another prerequisite of being hired is being kind to other people, especially in Ruby where the core mantra is MINASWAN: Matz is nice and so we are nice.
<mzo> i value kindness very much, believe me
milardovich has quit []
<mzo> i didn't mean to be unkind there. sorry if it seemed like that.
cdg has joined #ruby
<baweaver> remember everyone starts somewhere, and some times they don't even really know where to start
<mzo> i meant "sure you did" in a playful kind of way, because i know all too well how easy it is to fool yourself into thinking you're learning when you're not
bmurt has joined #ruby
<baweaver> remember it's very easy to come off badly on IRC
<mzo> yes, sorry about that
nadir has joined #ruby
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
enterprisey has quit [Ping timeout: 246 seconds]
bmurt has quit [Client Quit]
hutch34 has joined #ruby
MasterRex has quit [Read error: Connection reset by peer]
hutch34 has quit [Ping timeout: 260 seconds]
elshaka has joined #ruby
<jeffreylevesque> will line 27 - https://bpaste.net/show/1caae039bd8c contain a ruby array of "hostnames" listed on line 5?
jhack_ has quit [Quit: Leaving]
<baweaver> Have you tried it?
<jeffreylevesque> my `vagrant up` build says "==> aristotle: Box '#<Vagrant::Config::V2::DummyConfig:0x398d2b8>/#<Vagrant::Config::V2::DummyConfig:0x398d258>' could not be found. Attempting to find and install...'
<baweaver> (also you should name it hostnames if it's an array)
<jeffreylevesque> so, i'm guessing it either didn't capture the array, or it's some kind of encoding problem
<baweaver> It's loading some type of dummy config, though I can't tell much without knowing the entire error
<jeffreylevesque> should line 27 be a ruby array of hostnames?
<baweaver> Trying includes things like putting debug statements and looking.
<baweaver> such as: puts mongodb_nodes
<baweaver> also line 31 won't work
<baweaver> &ri Enumerable#map
<baweaver> vs
<baweaver> &ri Enumerable#map!
<`derpy> No results
<baweaver> ....
<baweaver> anyways
m__31 has joined #ruby
<baweaver> >> a = [1,2,3]; a.map { |i| i * 2 }
<ruby[bot]> baweaver: # => [2, 4, 6] (https://eval.in/753324)
<baweaver> what's a now jeffreylevesque?
<jeffreylevesque> [2, 4, 6]
<baweaver> (and line 30 is never used)
<baweaver> >> a = [1,2,3]; a.map { |i| i * 2 }; a
<ruby[bot]> baweaver: # => [1, 2, 3] (https://eval.in/753325)
<baweaver> nope
bkxd has quit [Ping timeout: 240 seconds]
<baweaver> map doesn't mutate the original array
<elomatreb> The `p` is really useful too, because it returns its arguments you can just stick it in almost anywhere
pilne has joined #ruby
<baweaver> ^ that as well
<jeffreylevesque> so maybe i need b = a.map { ... }
<baweaver> or tail it onto line 27
<baweaver> mongodb_nodes = db_config['database']['mongodb_cluster']['hostname'].map { ... }
m_31 has quit [Ping timeout: 256 seconds]
<jeffreylevesque> which is best syntax?
<baweaver> considering you immediately want that and don't do anything with just the names
charliesome has joined #ruby
<jeffreylevesque> i've updated it to - https://bpaste.net/show/c9174c892a55
<mzo> selfthoughtstood: any luck?
<selfthoughtstood> i found solutions in java
<selfthoughtstood> i have no idea how java works
<mzo> i wish they gave you the test data instead of having you upload your program
Rodya_ has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
Rodya_ has joined #ruby
cdg has joined #ruby
d0nn1e has quit [Ping timeout: 240 seconds]
d0nn1e has joined #ruby
gnufied has joined #ruby
gusrub has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
oetjenj has joined #ruby
<mzo> i think i solved it but i doubt my solution is optimal
gusrub has quit [Remote host closed the connection]
gusrub has joined #ruby
KnownSyntax_ has quit [Ping timeout: 240 seconds]
selfthoughtstood has quit [Killed (Sigyn (Spam is off topic on freenode.))]
KnownSyntax has joined #ruby
KnownSyntax has joined #ruby
KnownSyntax has quit [Changing host]
tuelz has joined #ruby
pilne has quit [Quit: Quitting!]
gusrub has quit [Remote host closed the connection]
<tuelz> is there an enum method that will iterate over each of the items from each enum? so [1,2].method([3,4]) will give a block with 1,3 and 1,4 then 2,3 then 2,4 ?
<tuelz> s/and/then/g
Guest45617 has joined #ruby
welfkarling has left #ruby [#ruby]
<havenwood> >> [1, 2].product [3, 4] # tuelz
<ruby[bot]> havenwood: # => [[1, 3], [1, 4], [2, 3], [2, 4]] (https://eval.in/753328)
<tuelz> havenwood: thanks
<havenwood> tuelz: you're welcome
hahuang65 has joined #ruby
<allisio> Note that #product takes a block in case you don't need the collection immediately realized.
d^sh has quit [Ping timeout: 246 seconds]
d^sh has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has quit [Quit: WeeChat 1.7]
yokel has quit [Quit: leaving]
<mzo> allisio: that's incredible
yokel has joined #ruby
sneakerhax has joined #ruby
harfangk has joined #ruby
ResidentBiscuit has joined #ruby
ResidentBiscuit has quit [Remote host closed the connection]
ResidentBiscuit has joined #ruby
Guest45617 has quit [Quit: ...]
<jeffreylevesque> anyone here have experience with yaml files, and parsing it in ruby?
Andrevan has quit [Quit: WeeChat 1.7]
hutch34 has joined #ruby
ResidentBiscuit has quit []
oetjenj has joined #ruby
hahuang65 has joined #ruby
BackEndCoder has quit [Excess Flood]
dar123 has joined #ruby
hutch34 has quit [Ping timeout: 268 seconds]
BackEndCoder has joined #ruby
EV3RYDAYPR0GRESS has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
gusrub has joined #ruby
gusrub has quit [Remote host closed the connection]
BackEndCoder has quit [Excess Flood]
libastral has quit [Ping timeout: 240 seconds]
BackEndCoder has joined #ruby
libastral has joined #ruby
<havenwood> jeffreylevesque: running into a yaml parsing issue?
<jeffreylevesque> havenwood: yeah, i think so
<jeffreylevesque> this is what i have so far - https://bpaste.net/show/1e64c0068cc9
elshaka has quit [Quit: Ex-Chat]
elshaka has joined #ruby
<jeffreylevesque> i don't do much ruby, but used irb to confirm it manually - https://bpaste.net/show/38e3d5dbc110
<jeffreylevesque> right now my Vagrantfile has "/Vagrantfile:43:in `block (2 levels) in <top (required)>'"
<jeffreylevesque> which translates to error on line 55 - https://bpaste.net/show/1e64c0068cc9
astrobunny has joined #ruby
Trynemjoel has quit [Ping timeout: 245 seconds]
d^sh has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
Trynemjoel has joined #ruby
jgt has quit [Ping timeout: 240 seconds]
xall has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has quit [Remote host closed the connection]
oetjenj has quit [Quit: Textual IRC Client: www.textualapp.com]
MrBusiness has quit [Quit: https://www.youtube.com/watch?v=xIIqYqtR1lY -- Suicide is Painless - Johnny Mandel]
MrBusiness has joined #ruby
hutch34 has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hutch34 has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
cschneid_ has joined #ruby
mzo has quit [Quit: kiwirc - an handmad irc cleint xd]
cschneid_ has quit [Ping timeout: 246 seconds]
blackmesa has joined #ruby
montanonic has quit [Ping timeout: 256 seconds]
bkxd has quit [Ping timeout: 246 seconds]
elifoster has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
cfec0b8d has quit [Remote host closed the connection]
<tripolisenten> jeffreylevesque: so is this a yaml parsing error or a vagrant config issue?
cfec0b8d has joined #ruby
dar123 has quit [Read error: Connection reset by peer]
<tripolisenten> what's your error, even? i see you are parsing one yaml file and then using what's in that to open other yaml files... you should probably be prying in and seeing if those paths really exist
rkazak_ has quit [Quit: Sleep.....ing....]
elshaka has quit [Quit: Ex-Chat]
dar123 has joined #ruby
Channel6 has quit [Quit: Leaving]
blackmesa has quit [Ping timeout: 258 seconds]
ignarps has quit [Quit: ZNC - http://znc.in]
jnoob22 has quit [Ping timeout: 240 seconds]
<jeffreylevesque> tripolisenten: i'm new to ruby.. but, i just found out that i can use `puts`, and I can also use it in my `Vagrantfile`, which is super useful
gix has quit [Ping timeout: 260 seconds]
xzhao has quit [Remote host closed the connection]
BackEndCoder has quit [Excess Flood]
hotpanca_ has quit [Remote host closed the connection]
cfec0b8d has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby
<tripolisenten> jeffreylevesque: there's something called pry you should look into
gix has joined #ruby
<tripolisenten> install it and you can put binding.pry into your code to open up an interactive shell
<tripolisenten> really useful
BackEndCoder has joined #ruby
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
eb0t has joined #ruby
jnoob22 has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
roflmyeggo has quit [Ping timeout: 240 seconds]
cdg_ has joined #ruby
jackjackdripper has joined #ruby
hutch34 has joined #ruby
cdg has quit [Ping timeout: 260 seconds]
BackEndCoder has quit [Excess Flood]
cdg_ has quit [Ping timeout: 256 seconds]
BackEndCoder has joined #ruby
jackjackdripper has quit [Read error: Connection reset by peer]
jackjackdripper has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
jackjackdripper has quit [Read error: Connection reset by peer]
jackjackdripper has joined #ruby
CloCkWeRX has joined #ruby
bkxd has joined #ruby
xenops has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tax has quit [Quit: Leaving]
duderonomy has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
dionysus69 has joined #ruby
duderono_ has joined #ruby
duderonomy has quit [Read error: Connection reset by peer]
duderono_ has quit [Client Quit]
a1fa has quit [Ping timeout: 240 seconds]
a1fa has joined #ruby
pulkit4tech has joined #ruby
cfec0b8d has joined #ruby
enterprisey has joined #ruby
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
Derperperd has joined #ruby
dar123 has quit [Read error: Connection reset by peer]
renchan has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
joneshf-laptop has joined #ruby
squ has joined #ruby
bruce_lee has joined #ruby
hutch34 has joined #ruby
hutch34 has quit [Ping timeout: 258 seconds]
dionysus69 has joined #ruby
djbkd_ has joined #ruby
enterprisey has quit [Remote host closed the connection]
nofxxx has joined #ruby
bkxd has quit [Ping timeout: 264 seconds]
uncertainty has joined #ruby
nofxx has quit [Ping timeout: 258 seconds]
jamesaxl has joined #ruby
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
dar123 has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
hotpancakes has quit [Ping timeout: 246 seconds]
Mortomes|Train has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
hotpancakes has joined #ruby
Alina-malina has quit [Ping timeout: 260 seconds]
jameser has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
baweaver is now known as baweaver_away
ddrmanxbxfr has quit [Remote host closed the connection]
djbkd_ has quit [Remote host closed the connection]
lightheaded has quit [Ping timeout: 258 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
dar123 has quit [Read error: Network is unreachable]
hutch34 has joined #ruby
pwnd_nsfw` has joined #ruby
psmolen has quit [Ping timeout: 240 seconds]
xall has quit [Ping timeout: 264 seconds]
pwnd_nsfw has quit [Ping timeout: 256 seconds]
hutch34 has quit [Ping timeout: 264 seconds]
last_staff has joined #ruby
psmolen has joined #ruby
dar123 has joined #ruby
ta_ has quit [Remote host closed the connection]
nhhc has joined #ruby
bkxd has joined #ruby
rfoust has joined #ruby
djbkd_ has joined #ruby
Mortomes|Train has quit [Ping timeout: 260 seconds]
jgnagy has quit [Remote host closed the connection]
jgnagy has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xall has joined #ruby
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
lightheaded has joined #ruby
saneax-_-|AFK is now known as saneax
dionysus69 has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
jackjackdripper has joined #ruby
nOwz has joined #ruby
djbkd_ has quit []
haraoka has joined #ruby
aupadhye has joined #ruby
xenops has joined #ruby
conta has joined #ruby
govg has quit [Ping timeout: 264 seconds]
grant has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
haxrbyte has joined #ruby
pawnbox has joined #ruby
pawnbox has quit [Remote host closed the connection]
Arpanet69 has joined #ruby
pawnbox has joined #ruby
jeyraof^mbpr has joined #ruby
hutch34 has joined #ruby
singalaut has joined #ruby
govg has joined #ruby
jdeen has quit [Remote host closed the connection]
esObe_ has joined #ruby
hutch34 has quit [Ping timeout: 264 seconds]
ta_ has joined #ruby
esObe_ has quit [Ping timeout: 240 seconds]
bkxd has quit [Ping timeout: 260 seconds]
andikr has joined #ruby
aspiers has quit [Ping timeout: 258 seconds]
jackjackdripper has quit [Ping timeout: 240 seconds]
toretore has joined #ruby
pawnbox has quit [Remote host closed the connection]
aspiers has joined #ruby
pawnbox has joined #ruby
esObe_ has joined #ruby
haxrbyte has quit [Quit: Leaving...]
Qchmqs has joined #ruby
esObe_ has quit [Ping timeout: 240 seconds]
hays has quit [Ping timeout: 256 seconds]
Mr_Pancake has joined #ruby
nOwz has quit [Quit: WeeChat 1.7]
<tildes> I am using Dir.mktmpdir for a use case where I think it's a good fit. However I notice some peculiarities, for instance when I use a "service object", I need to pass my tmp dir, and Dir.chpwd, because otherwise actual directory is reset. Something similar happens within begin-rescue.
stoffus_ has joined #ruby
antgel has joined #ruby
aganov has joined #ruby
<tildes> I see this happening, and I can guess it has something to do with scope or objects, but I really lack the terminology to explain it, or understanding of ruby internals, or tools to track it... Other than check which directory I am in.
<tildes> Any pointers for some study resources, this is something I would like to understand better. :)
<dminuoso> tildes: Can you explain the observed behavior again? This made no sense to me.
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
esObe_ has joined #ruby
stoffus has quit [Ping timeout: 260 seconds]
zeroDi has joined #ruby
<tildes> dminuoso: I suppose it's tough to follow. I'll make a small code snippet to demonstrate it
hotpancakes has joined #ruby
lenwood has joined #ruby
<tildes> one would expect @temp_dir and @dir_within_begin_rescue_block are the same, at least I did
<tildes> I just think it is curious and would like to understand what goes on behind the scenes :)
<dminuoso> tildes: can you show me your actual output for that testcase?
Mr_Pancake has quit [Ping timeout: 260 seconds]
tvl has joined #ruby
tvl is now known as tobiasvl
aufi has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
lenwood has quit [Ping timeout: 240 seconds]
<tildes> dminuoso: it's all the same. it's only @dir_variable which is actually different, and that gives an absolute path... and I need new eyes
lenwood has joined #ruby
<tildes> dminuoso: so I was imagining behaviour that was not there :-(
<dminuoso> tildes: :)
<dminuoso> 09:21 < tildes> Any pointers for some study resources, this is something I would like to understand better. :)
<dminuoso> tildes: Next time you hit a wall, extract a testcase. In almost all cases this will isolate the problem and often make it visible to you.
<tildes> dminuoso: so be it. thanks
larcara has joined #ruby
sepp2k has joined #ruby
alibby1 has quit [Quit: Leaving.]
Silthias has joined #ruby
ebcz has joined #ruby
Silthias1 has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Silthias has quit [Ping timeout: 268 seconds]
vondruch has quit [Ping timeout: 256 seconds]
Qchmqs has quit [Read error: Connection reset by peer]
hutch34 has joined #ruby
nertzy has joined #ruby
bigkevmcd has joined #ruby
jeyraof^mbpr has quit [Quit: Leaving]
Burgestrand has joined #ruby
Burgestrand has quit [Client Quit]
bkxd has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
Derperperd has quit [Ping timeout: 246 seconds]
hays has joined #ruby
hays has joined #ruby
hays has quit [Changing host]
szulak has joined #ruby
cschneid_ has joined #ruby
naprimer_3 has quit [Ping timeout: 258 seconds]
zeroDi has quit [Quit: WeeChat 1.7]
uncertainty has quit [Ping timeout: 246 seconds]
mikecmpbll has joined #ruby
naprimer_3 has joined #ruby
astrobunny has quit [Remote host closed the connection]
astrobunny has joined #ruby
cschneid_ has quit [Ping timeout: 246 seconds]
Derperperd has joined #ruby
dangerousdave has joined #ruby
larcara has quit [Remote host closed the connection]
astrobunny has quit [Ping timeout: 264 seconds]
larcara has joined #ruby
larcara has quit [Read error: Connection reset by peer]
larcara has joined #ruby
Arpanet69 has quit [Ping timeout: 268 seconds]
Derperperd has quit [Ping timeout: 258 seconds]
vondruch has joined #ruby
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 264 seconds]
teclator has joined #ruby
Arpanet69 has joined #ruby
tomphp has joined #ruby
ferr1 has joined #ruby
Arpanet69 has quit [Ping timeout: 268 seconds]
unshadow has joined #ruby
unshadow has quit [Client Quit]
jaiks has joined #ruby
unshadow has joined #ruby
unshadow has quit [Client Quit]
hotpancakes has joined #ruby
jsrn_ has joined #ruby
xenops has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pandaant has joined #ruby
blackmesa has joined #ruby
pwnd_nsfw` has joined #ruby
Snickers has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
pwnd_nsfw has quit [Ping timeout: 258 seconds]
cdg has joined #ruby
hutch34 has joined #ruby
mark_66 has joined #ruby
TomyLobo has joined #ruby
cdg has quit [Read error: Connection reset by peer]
cdg has joined #ruby
LambdaSi1 is now known as LambdaSix
bkxd has quit [Ping timeout: 240 seconds]
hutch34 has quit [Ping timeout: 240 seconds]
DaveTaboola has joined #ruby
Paraxial has joined #ruby
Paraxial has quit [Read error: Connection reset by peer]
lxsameer has joined #ruby
xenops has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
marr has joined #ruby
hotpancakes has joined #ruby
Fernando-Basso has joined #ruby
esObe_ has quit [Remote host closed the connection]
esObe_ has joined #ruby
Paraxial has joined #ruby
esObe_ has quit [Read error: No route to host]
esObe_ has joined #ruby
dangerousdave has quit [Ping timeout: 268 seconds]
hotpancakes has quit [Ping timeout: 246 seconds]
xen0fon has joined #ruby
psychicist__ has joined #ruby
nobitano_ has joined #ruby
cdg_ has joined #ruby
nobitanobi has quit [Ping timeout: 260 seconds]
cdg has quit [Ping timeout: 246 seconds]
Rodya_ has joined #ruby
Xiti has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
nobitanobi has joined #ruby
Mortomes|Work has joined #ruby
xall has quit [Ping timeout: 256 seconds]
workmad3 has joined #ruby
Rodya_ has quit [Ping timeout: 258 seconds]
nobitano_ has quit [Ping timeout: 260 seconds]
larcara has quit [Remote host closed the connection]
hutch34 has joined #ruby
bkxd has joined #ruby
jameser has joined #ruby
haraoka has quit [Ping timeout: 260 seconds]
jameser has quit [Max SendQ exceeded]
<mc_fail> hi guys
hutch34 has quit [Ping timeout: 240 seconds]
<mc_fail> is there any simple way to convert hash like a = {:c => 3, :b => 1} to array [:c,:c,:c,:b] ?
jameser has joined #ruby
psychicist__ has quit [Ping timeout: 260 seconds]
vali has joined #ruby
larcara has joined #ruby
<matthewd> mc_fail: Enumerable#flat_map + Array#*
<mc_fail> matthewd i'm not getting how
<mc_fail> basically :c => 3, means there are 3 x :c symbols should be addedd to the array
<canton7> mc_fail, flat_map the hash. For each k/v pair, construct an array containing that key repeated the correct number of times (using Array::new or Array#*)
<matthewd> `[:c] * 3` (or `Array.new(3, :c)`)ff
<mc_fail> hmm
Burgestrand has joined #ruby
alibby has joined #ruby
<mc_fail> a.flat_map{ |k,v| [k] * v }
<mc_fail> this works
<mc_fail> thanks folks
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xall has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
norbertka has joined #ruby
nettoweb has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
uncertainty has joined #ruby
zhustec has joined #ruby
xall has quit [Ping timeout: 260 seconds]
Robtop__ has joined #ruby
cdg_ has quit [Remote host closed the connection]
bkxd has joined #ruby
conta has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
teddysmoker has joined #ruby
mniip has quit [Ping timeout: 624 seconds]
pwnd_nsfw` has quit [Ping timeout: 240 seconds]
jaiks has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Ping timeout: 268 seconds]
millerti has joined #ruby
mniip has joined #ruby
jaiks has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
ldnunes has joined #ruby
Rodya_ has joined #ruby
JeanCarloMachado has joined #ruby
zhustec has quit [Remote host closed the connection]
Rodya_ has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
hutch34 has joined #ruby
mradmach1 has quit [Quit: WeeChat 1.4]
conta has joined #ruby
iwmrby has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
hutch34 has quit [Ping timeout: 258 seconds]
lenwood has quit [Ping timeout: 240 seconds]
synthroid has joined #ruby
synthroi_ has joined #ruby
synthroid has quit [Ping timeout: 256 seconds]
pwnd_nsfw has joined #ruby
Robtop__ has quit [Ping timeout: 240 seconds]
nadir has joined #ruby
nobitanobi has quit [Remote host closed the connection]
raul782 has joined #ruby
charliesome has joined #ruby
saneax is now known as saneax-_-|AFK
workmad3 has quit [Ping timeout: 260 seconds]
al2o3-cr has quit [Ping timeout: 256 seconds]
augcesar has joined #ruby
rikkipitt has joined #ruby
eclecticjohny has joined #ruby
GinoManWorks has quit [Quit: Leaving]
nofxxx has quit [Ping timeout: 240 seconds]
hotpancakes has joined #ruby
Alina-malina has joined #ruby
HoierM has joined #ruby
xall has joined #ruby
raul782 has quit [Remote host closed the connection]
dad27 has joined #ruby
dad27 has quit [Client Quit]
jaruga__________ has joined #ruby
dad27 has joined #ruby
jaruga__________ has quit [Client Quit]
milardovich has joined #ruby
bkxd has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
dad27 has quit [Client Quit]
lenwood has joined #ruby
lightheaded has quit [Read error: Connection reset by peer]
lightheaded has joined #ruby
raul782 has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
larcara has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 256 seconds]
bkxd has joined #ruby
larcara has joined #ruby
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaruga__________ has joined #ruby
Alina-malina has quit [Changing host]
Alina-malina has joined #ruby
jaruga__________ has quit [Remote host closed the connection]
xall has quit [Ping timeout: 258 seconds]
jaruga__________ has joined #ruby
griffindy has joined #ruby
larcara has quit [Ping timeout: 240 seconds]
milardovich has quit [Remote host closed the connection]
houhoulis has joined #ruby
milardovich has joined #ruby
shinnya has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
Rodya_ has joined #ruby
keanny479 has joined #ruby
<keanny479> hello
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<tildes> I have some issues with zip file encoding, as follows https://gist.github.com/anonymous/e1b3c8418b296ddfe5467f0353b0a4b6
jnoob22 has quit [Changing host]
jnoob22 has joined #ruby
<elomatreb> tildes: Forgive me if this is wrong, but why would that work? You're reading a raw zip file
<herwin> and excatly why would you put a zip-file in a json-file?
biberu has joined #ruby
<tildes> I need to send a zip file as json payload to an external service
<tildes> I don't know how to make it work, this is as far as I got
lightheaded has quit [Remote host closed the connection]
<tildes> I use net/http (but can change), and after I add the payload to request, it doesn't convert to json anymore
Rodya_ has quit [Ping timeout: 246 seconds]
<matthewd> tildes: You need 'rb' on line 16
hutch34 has joined #ruby
<keanny479> i have the following project : https://goo.gl/b1bRMK ; it uses PressAnyKey library ; the issue i meet is when i do a ctrl-c i get error, it does not execute the ctrlc method, the trap line, any idea ?
<tildes> matthewd: sorry, I don't follow
agit0 has joined #ruby
<tildes> ah instead of 'r'
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<matthewd> Yeah
lightheaded has joined #ruby
<matthewd> b = binary
<tildes> matthewd: cool, I'll try exactly that
<matthewd> So that'll change the encoding, which should then make the JSON happier, I think
<tildes> just a sec
<tildes> JSON not happy: Encoding::UndefinedConversionError: ""\xCA"" from ASCII-8BIT to UTF-
<tildes> if I read with 'rb:UTF-8', I get the original error in the gist
<keanny479> anyone can help me with my ctrlc error and the PressAnyKey library ?
bg has joined #ruby
blackmesa has quit [Ping timeout: 246 seconds]
bkxd has quit [Ping timeout: 260 seconds]
<tildes> matthewd: actually while my contrived example does not work with 'rb', request.to_json throws out something that looks a lot happier
<tildes> when I read the zip with 'rb'. so this could be it, thanks! :)
nobitanobi has joined #ruby
hotpancakes has joined #ruby
EV3RYDAYPR0GRESS has joined #ruby
rikkipitt has quit [Quit: Leaving...]
larcara has joined #ruby
nofxx has joined #ruby
jeffreylevesque has quit [Ping timeout: 268 seconds]
<matthewd> keanny479: I don't know anything about the press_any_key gem.. maybe it's setting a trap of its own? What *does* happen when you press Ctrl-C?
blackmesa has joined #ruby
<keanny479> matthewd, when i try ctrl-c at the 'Press any key to continue...' step, it gives me an error : in `block in initialize': Interrupt (Interrupt)
Derperperd has joined #ruby
nettoweb has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lightheaded has quit [Remote host closed the connection]
<Garo_> I'm trying to register a class which is instantiated inside an instance_eval call (see http://rubyfiddle.com/riddles/47be3) but I'm not sure how to get this working as I can't see the register() method.
lightheaded has joined #ruby
<allisio> keanny479: Why not just `require 'io/console'` and use `STDIN.getch` when you want the user to press any key?
ThiefMaster has joined #ruby
rfoust has joined #ruby
<keanny479> allisio, the trap will works using STDIN.getch ?
<ThiefMaster> hi, is this possible with ERB templates? https://bpaste.net/show/a01ab5f4f958 (in case it matters, the template is used in puppet)
g0d355__ has quit [Remote host closed the connection]
<bg> good morning you ruby rascals!
bg is now known as mzo
<allisio> keanny479: STDIN.getch returns "\u0003" for ^C on my end.
<keanny479> allisio, ok, i'm going to try it
lightheaded has quit [Read error: No route to host]
<keanny479> allisio, let's you know. Thank's!
hotpancakes has quit [Ping timeout: 246 seconds]
milardovich has quit [Remote host closed the connection]
lightheaded has joined #ruby
<matthewd> Garo_: The easy option is to pass the proxy to the initialize
<allisio> keanny479: You're welcome.
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
<Garo_> matthewd: absolutely, but I'm trying to find a way to avoid that (it's a DSL)
<ThiefMaster> nvm, it looks like my template is actually working, the puppet master just hadn't picked up my change yet
<matthewd> ThiefMaster: Move the <%- up next to the {, and change the first -%> to %>
<Garo_> matthewd: the register function would be available outside the Class initialize() scope, but I'm failing to understand how I could access the same scope from inside the initialize
<matthewd> Ah okay, I was trying to remember whether -%> ate all spaces or just the newline
mzo has quit [Remote host closed the connection]
<matthewd> Garo_: Okay, the next easiest option is to add a `singleton_class.send :attr_accessor, :the_proxy` to Test, then set it after the class definition
<matthewd> Garo_: The other option is to stop using class/def, and switch to Class.new + define_method, which will give you access to the surrounding scope
milardovich has quit [Ping timeout: 240 seconds]
d3d1rty has quit [Ping timeout: 268 seconds]
<Garo_> matthewd: ok hmm. trying to wrap my head around the first idea
xall has joined #ruby
agent_white has joined #ruby
szulak has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
nettoweb has quit [Ping timeout: 268 seconds]
nettoweb has joined #ruby
houhoulis has quit [Remote host closed the connection]
mzo has joined #ruby
xall has quit [Quit: WeeChat 1.7]
<Garo_> matthewd: thanks. I found a way which I'm satisfied with =)
<allisio> Let's see it.
<Garo_> Too long to copy into a fiddle as I wrote it straight into my active code base, but essentially I have a superclass which contains a class instance for the proxy and then I use that in the superclass constructor
<matthewd> Garo_: Note you probably shouldn't be using the class keyword anyway, because it's likely to end up assigning a constant that in the best case scenario you don't want
<agent_white> Mornin' folks
hutch34 has quit [Ping timeout: 246 seconds]
whiteline has quit [Ping timeout: 264 seconds]
JeanCarloMachado has quit [Quit: Lost terminal]
hutch34 has joined #ruby
patarr has joined #ruby
ule_ is now known as ule
ule has quit [Changing host]
ule has joined #ruby
hotpancakes has joined #ruby
workmad3 has joined #ruby
JeanCarloMachado has joined #ruby
nhhc has quit [Quit: Leaving]
DLSteve has joined #ruby
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
uncertainty has quit [Ping timeout: 240 seconds]
baked__beans has joined #ruby
<mzo> morning agent_white how are you doing today
baweaver_away is now known as baweaver
Mortomes|Work has quit [Ping timeout: 260 seconds]
xall has joined #ruby
keanny479 has quit [Quit: Page closed]
Toledo has joined #ruby
Toledo is now known as croberts
jeffreylevesque has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
gsnedders has quit [Ping timeout: 260 seconds]
szulak has joined #ruby
Rodya_ has joined #ruby
moeSizlak has joined #ruby
<moeSizlak> how do i include unicode in a regex
<moeSizlak> this works in javascript:
squ has quit [Remote host closed the connection]
<moeSizlak> \/^[\u000d\u0020-\u007e\u00a0-\u00ff\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178]*$/
<moeSizlak> not ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
raul782 has quit [Remote host closed the connection]
Rodya_ has quit [Ping timeout: 246 seconds]
mikecmpb_ has joined #ruby
xall has quit [Ping timeout: 240 seconds]
<matthewd> moeSizlak: In what way is it not working?
<moeSizlak> matthewd, invalid Unicode escape: /^[\u000d\u0020-\u007e\u00a0-\u00ff\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178]*$/
gsnedders has joined #ruby
kobain has joined #ruby
pawnbox has quit [Ping timeout: 260 seconds]
mikecmpbll has quit [Ping timeout: 260 seconds]
<herwin> ...u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u...
<herwin> ... ^
<herwin> that points exactly to the incorrect unicode thing here
<herwin> (\u2c6)
<moeSizlak> damn, good catch, thank you
roamingdog has joined #ruby
tercenya has quit [Read error: Connection reset by peer]
synthroi_ has quit [Remote host closed the connection]
tercenya has joined #ruby
cdg has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
stoffus_ has quit [Ping timeout: 256 seconds]
last_staff has quit [Quit: last_staff]
lenwood has quit [Ping timeout: 264 seconds]
govg has quit [Ping timeout: 240 seconds]
<mzo> you know what i call that
<mzo> a good error message
milardovich has joined #ruby
<LyndsySimon> I'm looking for a way to document models for a Rails app. The use case is that there is a reporting/analytics team that needs to know what things mean in the tables and when we change them.
<LyndsySimon> I'm thinking of using Yardoc plus some custom scripts to generate diffs between documentation versions at this point.
<LyndsySimon> Also, I'm trying to minimize the overhead to developers when updating.
<LyndsySimon> Thoughts? :)
roamingdog has quit [Read error: Connection reset by peer]
roamingdog has joined #ruby
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
roamingdog has quit [Remote host closed the connection]
<nofxx> LyndsySimon, prob better luck on #rubyonrails... if it's sql also check 'annotate models' stuff
<LyndsySimon> TY. Yeah, it's sql, and the first order of business is to decide if we should store the metadata in the ruby model files, in the migrations, or somewhere else entirely.
<nofxx> LyndsySimon, there are some model -> visual schema bubble thing sql ppl adore I forgot the name
<LyndsySimon> It's not really a "rails" thing, though, which is why I asked here.
lxsameer has quit [Quit: WeeChat 1.5]
<LyndsySimon> The Rails Way™ seems to eschew documentation anyhow.
<nofxx> in the model, no doubt... it's where one going to look
eclecticjohny has joined #ruby
<nofxx> migration is a mess that isn't supposed to be read
<mzo> nofxx: sql ppl? does that mean you're not a sql person?
<nofxx> you read the schema.rb
Blaze_Boy has joined #ruby
pawnbox has joined #ruby
<LyndsySimon> Well, the primary consumers of these docs aren't developers, and don't have visibility into the source at this point. Adding them wouldn't be a huge issue, but it seems like additional cognitive overhead for not much benefit.
_aeris_ has quit [Remote host closed the connection]
<nofxx> mzo, some years now w/o it... only happiness
<nofxx> life's too short for SQL
<mzo> nofxx: what do u use
<nofxx> mzo, redis, mongo, rething, couch... anything =D
_aeris_ has joined #ruby
<LyndsySimon> nofxx: I'm aware :) schema.rb (or structure.sql) is auto-generated though, and therefore not suitable to insert documentation.
<matthewd> MySQL and Postgres both support comments on columns inside the schema definition
* LyndsySimon has lots of non-relational DB experience, but much prefers good 'ole ANSI SQL.
<LyndsySimon> matthewd: True enough. Do those get dumped to schema.rb?
<matthewd> I believe so
* LyndsySimon is off checking.
chouhoulis has joined #ruby
mula has joined #ruby
enterprisey has joined #ruby
pawnbox has quit [Ping timeout: 240 seconds]
<nofxx> mzo, actually my issue with sql is schema/migration.. it bores the hell out of me, did this to solve my problem: https://github.com/nofxx/schemaless
<LyndsySimon> Hmmm. It doesn't look like schema.rb gets column comments
norbertka has quit [Remote host closed the connection]
norbertka has joined #ruby
<nofxx> mzo, but that scares the hell out of everyone I showd, sql ppl don't like the different
uncertainty has joined #ruby
<LyndsySimon> Hmm. Maybe it's a Rails5 feature: https://github.com/rails/rails/pull/22911
<mzo> nofxx: very slick
spicerack has joined #ruby
<LyndsySimon> nofxx: That looks great, from a casual look.
raul782 has joined #ruby
<nofxx> mzo, LyndsySimon thanks, needs love (from a better coder than I) and users, but I still think it's a good idea... pg w/o migrations
raul782 has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<LyndsySimon> In fact, I'm doing something that looks visually similar for ajax-datatables-rails :)
<nofxx> also there's a 'safe-mode', that just writes the migration for you, so on server perspective it's all the same
whiteline has joined #ruby
<LyndsySimon> I'll look into it. I don't think I can use it right now, though. We use MySQL, for one thing.
<dminuoso> LyndsySimon: Here we try to cut down the raw SQL interface because SQL dependencies from reporting teams has a tendency to produce migration issues.
<dminuoso> LyndsySimon: Instead I'm strongly pushing for well defined JSON APIs (where you can just define a static interface and test for it, and everyone can rely on it)
<LyndsySimon> dminuoso: How so? In our case, the reporting team is "read-only" to use. We replicate our production DB nightly for them, but they need to be aware of schema (and intentionality) changes before the hit production.
aryaching has joined #ruby
Derperperd has joined #ruby
<dminuoso> LyndsySimon: If reporting needs something that can be described in a query, they can describe it as a requirement to the application. And we generate either a raw JSON API or ready-to-use charts.
<LyndsySimon> A JSON API seems like it would just push the documentation/communication responsibility to another place, and give us one more module to maintain.
<dminuoso> Im trying my best to keep their hands out of my database.
<LyndsySimon> That makes sense, but unfortunately isn't a workable solution for us.
<dminuoso> LyndsySimon: The issue is that if you expose your database to them, they start relying on specific schemata.
<LyndsySimon> I work for a healthcare company, and reporting/analytics is a first-class citizen. They absolutely require access to our raw data.
<dminuoso> LyndsySimon: Then I would expose data through views.
<dminuoso> That way you still get to control what they can see.
<LyndsySimon> Yep, absolutely, and their reliance means that we have to build communication channels between the teams. Luckily, our reporting folks are closer to developers than "analysts", so it's going to be workable.
aryaching has quit [Read error: Connection reset by peer]
<LyndsySimon> I agree - they're responsible for creating and maintaining those views :)
<dminuoso> Well it depends on how you want to handle migrations that change database layouts.
<LyndsySimon> Think of our "reporting team" as a dev team whose role it is to support a traditional reporting team. In most cases it's actually going to be clients that are doing the analytics.
<LyndsySimon> We're using Rails 4, and standard migrations.
lightheaded has quit [Remote host closed the connection]
andikr has quit [Ping timeout: 268 seconds]
jameser has joined #ruby
lightheaded has joined #ruby
<dminuoso> Well my point is, let's say you have some foreign_resources_id column, and at some point down the road you decide you want to refactor and follow convention, and now name it "resource_id" instead
<dminuoso> Either this will fail (because reporting has temporary tables with foreign key constraints), or worse, it wont and suddenly reporting will get broken views all over.
<dminuoso> That is unless all the reporting is done within your repo and can be covered by tests
<dminuoso> This is the thing you will be battling mainly
hxegon_afk is now known as hxegon
<LyndsySimon> Ideally, our devs will work with the reporting folks to communicate those schema changes. As a fallback, our deployment cycle goes dev > sandbox > qa > prod; reporting has an aligned deployment cycle and will see their views break in sandbox.
<LyndsySimon> They have tools - alerts in their reporting suites - to detect when things break or when the data are outside of expected boundaries.
nettoweb has joined #ruby
<LyndsySimon> They're responsible for codifying their dependencies in those alerts, which function in the role of unit and integration tests.
szulak has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<dminuoso> Well it's definitely a slippery road because you have locked yourself out of a completely automated CI chain
<mzo> beginner question: does 'next' always just skip to the end of the block?
ramortegui has joined #ruby
<dminuoso> mzo: Yes.
<allisio> Fun fact: it takes an "argument" too.
<mzo> what does it do with the argument
<dminuoso> mzo: next is just sugary for "return"
<allisio> Not quite.
<dminuoso> well
<allisio> It's kinda like yielding it.
lightheaded has quit [Ping timeout: 268 seconds]
<dminuoso> allisio: If you view the block as just an anonymous function, it just is a return from that function.
<LyndsySimon> `next` in Ruby is equivalent to `continue` in C or Python.
<allisio> >> (1..4).map { |n| next :odd if n.odd?; n * 10 }
<ruby[bot]> allisio: # => [:odd, 20, :odd, 40] (https://eval.in/753617)
<allisio> LyndsySimon: But better. ^
<LyndsySimon> mzo: Also check out `retry` and `redo`: http://rubyquicktips.com/post/1122838559/redo-vs-retry
<mzo> ahh
<LyndsySimon> allisio: In what way?
<dminuoso> next in Ruby i sequivalent to "return" in JavaScript.
<dminuoso> seriously.
<dminuoso> the fact that this works with map is just based on how the concrete implementation works.
<LyndsySimon> allisio: OK, now I'm yak shaving and reading the ruby docs. Thanks a lot :)
<mzo> but continue only works in loops
<dminuoso> mzo: That's because it has nothing to do with the block itself.
<mzo> right
<dminuoso> mzo: a continue is basically a "jump"
<dminuoso> or throw/catch if you want.
dhollinger has joined #ruby
<mzo> the reason i asked is because i was watching a talk and there was a slide with: at_exit do; if $!; ... end end, so the whole block was indented. i was wondering if there was a way to do: at_exit do; <something> if !$!; ... end
<mzo> <something> is next i guess. but the name seems weird when it's in a block that is intended to be executed just once
<allisio> at_exit &-> { return is legal here }
dhollinger has quit [Client Quit]
<dminuoso> allisio: The issue is just that Ruby tries really hard to hide the fact that blocks are anonymous functions. That's why it feels more like "yield", but it really is just a return. "break/<actual return?" is the really special case that deserves special mention
<allisio> dminuoso: Does it?
<mzo> >> (1..4).map &-> (k) { return :odd if k.odd?; n * 10 }
<ruby[bot]> mzo: # => undefined local variable or method `n' for main:Object (NameError) ...check link for more (https://eval.in/753620)
<dminuoso> allisio: you "yield" to them, you have "next" (which is just so called in order to sound nice in the context of Enumerable), and return really doesnt do what you think it does as a beginner either.
<mzo> oops
<mzo> >> (1..4).map &-> (k) { return :odd if k.odd?; k * 10 }
<ruby[bot]> mzo: # => [:odd, 20, :odd, 40] (https://eval.in/753621)
<dminuoso> mzo: right, that's essentially "next" right there.
ta_ has quit [Remote host closed the connection]
<dminuoso> or you could do
<allisio> Why are we circling back?
<mzo> what if i just use & with a stabby lambda everywhere and never use normal blocks
<mzo> is that good?
<dminuoso> >> (1..4).map &-> (k) { return k.odd? ? :odd : k * 10 }
<allisio> It's what Ruby should've done.
<ruby[bot]> dminuoso: # => [:odd, 20, :odd, 40] (https://eval.in/753622)
ta_ has joined #ruby
<allisio> Blocks are non-lambda Procs. :/
<dminuoso> mzo: ^- that's the clearest form.
vali has quit [Quit: vali]
<mzo> or is it
<dminuoso> 15:45 < mzo> what if i just use & with a stabby lambda everywhere and never use normal blocks
<allisio> I hate `? ?`.
<dminuoso> ^- Im honestly thinking about doing that.
lightheaded has joined #ruby
<matthewd> Blocks are designed to feel the same way as (say) the contents of a while 'block'
<LyndsySimon> It really does look much more like JavaScript's `return`.
<mzo> >> (1..4).map &-> { k.odd? :odd : k * 10 }
<ruby[bot]> mzo: # => /tmp/execpad-566961570157/source-566961570157:2: syntax error, unexpected ':', expecting '}' ...check link for more (https://eval.in/753623)
<mzo> omg
<dminuoso> LyndsySimon: Precisely.
<mzo> i suck at ruby
<allisio> mzo: Fuckin' figure it out.
<mzo> as soon as i hit enter i realized i forgot the parameter
<mzo> not worth spamming any more though
<allisio> I like you.
<dminuoso> mzo: But yeah. I just used the return explicitly for demonstrational purposes. :)
<LyndsySimon> mzo: Don't feel that way. Ruby isn't complicated, but it also isn't *obvious* in a lot of cases. Go read the docs until you grok a concept, then move on.
pawnbox has joined #ruby
<allisio> dminuoso: No, me.
Rodya_ has joined #ruby
<allisio> Ruby *is* complicated.
<dminuoso> allisio: No you what?
<LyndsySimon> mzo: you can always ask here, and if you hang out here your mental model for how Ruby works will only get more accurate over time.
<nofxx> allisio, dminuoso I call it "the least surprise that often surprises"
<nofxx> of how cool it is hehe... but might need some reading
<mzo> LyndsySimon: thanks ^___^
<mzo> it worked with C
rippa has joined #ruby
mula has quit [Remote host closed the connection]
<dminuoso> mzo: Now if Ruby had only a way of doing &->{} with a dedicated syntax that would be awesome. :)
<allisio> I'm sure there's a way to lambdafy Procs as soon as they're born.
<dminuoso> You mean blocks?
<allisio> No, those aren't objects.
<LyndsySimon> allisio: I had to do that the other day. Let me dig up the code I used...
<allisio> LyndsySimon: ?!
<dminuoso> allisio: The point of doing &->{} is to bind a lambda to a block.
andikr has joined #ruby
<allisio> dminuoso: You gonna use it?
chouhoulis has quit [Remote host closed the connection]
raul782 has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
<dminuoso> allisio: Yes because the shit "who cares how many args" that proc has sometimes pisses me off. It hides bugs.
<LyndsySimon> allisio: Yeah, I have a "block_to_lambda" method I was using - it even returns a lambda bound to the class.
<LyndsySimon> I was using it for a DSL I'm writing atop ajax-datatables-rails
<allisio> dminuoso: I more meant that, if you're gonna use the block, it's liable to be a Proc at some point.
tvw has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
<LyndsySimon> One sec, I'm ripping it out into a gist.
<allisio> I don't think there's a way to be notified of the creation of a block from Ruby-land.
pawnbox has quit [Ping timeout: 260 seconds]
<dminuoso> allisio: Im not sure about that. I would like to do that everywhere, let's say everytime I use Enumerable
ozcanesen has joined #ruby
millerti has joined #ruby
troulouliou_div2 has joined #ruby
bkxd has joined #ruby
<LyndsySimon> allisio: Oh, maybe we're talking about different things. I've written a class method that takes a block, then converts it to a lambda so it can be used later.
troulouliou_div2 has quit [Remote host closed the connection]
pawnbox has joined #ruby
nobitanobi has quit [Ping timeout: 240 seconds]
<dminuoso> LyndsySimon: There's a shorthand for that.
<dminuoso> Proc.new
antoniobeyah has joined #ruby
<mzo> how come this doesn't work
<dminuoso> >> def wrap; return Proc.new; end; a = wrap() { puts "hello world" }; a.call()
<ruby[bot]> dminuoso: # => hello world ...check link for more (https://eval.in/753635)
hotpancakes has joined #ruby
<dminuoso> LyndsySimon: This is also tons faster.
cschneid_ has joined #ruby
<mzo> >> def f(&block); lambda &block; end; g = f { |k| return k + 1 }; g.(41)
<ruby[bot]> mzo: # => unexpected return (LocalJumpError) ...check link for more (https://eval.in/753636)
<dminuoso> Surprise surprise.
pawnbox has quit [Ping timeout: 240 seconds]
<dminuoso> mzo: And this is why "return" can be such a major PITA in ruby.
<mzo> what's going on there
<LyndsySimon> dminuoso: I've got to take a second to grok that, but I know it wouldn't work for my use case for sure - I'm including ApplicationHelper into the singleton object I'm creating, because the blocks I pass in have to be able to use its methods.
ferr1 has quit [Quit: WeeChat 1.7]
<dminuoso> LyndsySimon: Proc.new basically is a "if block_given? then use the block to bind it to a Proc object"
<dminuoso> (It's a way to allow for conditional block binding)
<LyndsySimon> No offense intended at all, but this is exactly the kind of magic about Ruby that I find frustrating.
<dminuoso> let's say you have def foo(rarely_truthy); do_something_with(Proc.new) if rarely_truthy; end #=> this will prevent the unnecessary cost of creating an object in some of the cases (as opposed to binding it with def foo(rarely_truthy, &callable))
<LyndsySimon> Proc.new should instantiate a new object of type Proc. Period.
<dminuoso> LyndsySimon: Well think about it.
<dminuoso> LyndsySimon: What possible use would Proc.new give you if no block is given?
enterprisey has quit [Remote host closed the connection]
<LyndsySimon> No, I see *why* it's that way. That's not the point. The point is that it's not apparent what's happening by reading the code.
<dminuoso> LyndsySimon: It's an optimization mostly just for library writers.
<dminuoso> the whole concept of blocks is an internal optimization
<dminuoso> It's a way to provide anonymous function semantics without the cost of creating an object every time
<dminuoso> but that means there cant be obvious or intuitive ways to interact with that block
<dminuoso> because well.. its not an object.
<LyndsySimon> That's a lot of cognitive overhead for an optimization that will almost certainly not matter.
<dminuoso> hence: only for library vendors
<dminuoso> you would never use Proc.new out of creativity because procs are immutable
<dminuoso> so it's just a special syntax for those who care about it
<mzo> do you know what the sad part is
<LyndsySimon> ?
<dminuoso> LyndsySimon: Proc.new is something you would find in the ruby stdlib for example.
<dminuoso> the actual stdlib implementation I mean
<dminuoso> LyndsySimon: things like super/super() are more annoying because you are likely to trip over this one once or twice in your ruby career.
<matthewd> "There is an obscure-but-possible way to do an obscure thing" doesn't match my definition of magic, but I guess ymmv
<mzo> javascript just has one unified notion of functions. they're always objects. and with V8 you get code that's faster than MRI but without the cognitive overhead or blocks/procs/lambdas.
<LyndsySimon> "I want to take the function that's given as an argument to this function, and pass it somewhere" isn't obscure, though.
hotpancakes has quit [Ping timeout: 246 seconds]
<matthewd> The non-obscure way to do that is &block in the argument list
cfec0b8d has quit [Remote host closed the connection]
minimalism has quit [Quit: minimalism]
<LyndsySimon> matthewd: No, that's how to reference a block passed in - you can't take that block and add it to a data structure elsewhere.
<dminuoso> LyndsySimon: No thats wrong.
<LyndsySimon> How so?
<dminuoso> LyndsySimon: & is the callable<>block converter. It converts one to the other.
<LyndsySimon> Right...
<dminuoso> LyndsySimon: You can use it to convert a block into a proc, or the other way around.
<matthewd> LyndsySimon: &block literally gives you the same thing as a blockless Proc.new
<dminuoso> except "block" is a bit of a misnomer.
<dminuoso> calling it &proc or &callable is more sensible
<matthewd> Wanting to defer the procification of the block is obscure
ThiefMaster has left #ruby [#ruby]
mula has joined #ruby
polishdub has joined #ruby
<matthewd> dminuoso: I don't call my variables "boolean" either ¯\_(ツ)_/¯
<mzo> matthewd: wouldn't &block be the same as &Proc.new rather than Proc.new
nobitanobi has joined #ruby
<matthewd> mzo: There was an implied "in the parameter list" in there, as per further up
<LyndsySimon> I'm going to write a minimal case for this. It'll take a bit, but I'm curious now.
<mzo> could anyone tell me what is actually going on in that example i made earlier
<matthewd> >> def f(&block); lambda &block; end; def x; g = f { |k| return k + 1 }; g.(41) * 2; end; x
<ruby[bot]> matthewd: # => 42 (https://eval.in/753641)
<matthewd> mzo: Does that help?
<mzo> i can see what it does, but i still don't know why
<mzo> >> def f(&block); block; end; def x; g = f { |k| return k + 1 }; g.(41) * 2; end; x
<ruby[bot]> mzo: # => 42 (https://eval.in/753642)
<mzo> seems 'lambda' did nothing at all
gnarf_ is now known as gnarf
larcara has quit [Remote host closed the connection]
<dminuoso> matthewd: But do you call a boolean variable "integer" ?
<dminuoso> matthewd: I mean I give my proc variables sensible names, such as "predicate".. :-)
<dminuoso> Which seems to be the general name for the majority of my procs..
<dminuoso> Somhow they are all predicates :)
swills has quit [Ping timeout: 256 seconds]
<mzo> dminuoso: callable<>block
<mzo> in what context does & convert a block to a callable object
swills has joined #ruby
<dminuoso> mzo: Rather the other way around. If you implement to_proc you imply that an object is implicitly callable
<dminuoso> Popular example: symbol.
govg has joined #ruby
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mzo> what do you mean
<dminuoso> >> [[1,2],[3,4]].map(&:first)
<ruby[bot]> dminuoso: # => [1, 3] (https://eval.in/753644)
<mzo> you seemed to be saying that the conversion can work in both directions
<dminuoso> here & turns whatever comes after it into a block (by first calling #to_proc and then hoisting the block out of the Proc)
<dminuoso> mzo: And yes I meant that.
<mzo> when does it turn a block into an object
gchristensen has joined #ruby
hotpancakes has joined #ruby
<gchristensen> Hi, I have a program which uses extensive concurrency. I suspect I have concurrency bugs present, but would be hard pressed to find them all. does anyone know of any tools to assist in this? anything would be a good start.
<dminuoso> >> def foo(&stuff); puts stuff.class; end; foo() { puts "I am a block" } # mzo
<ruby[bot]> dminuoso: # => Proc ...check link for more (https://eval.in/753646)
<dminuoso> gchristensen: You could try valgrind.
<matthewd> dminuoso: If block were a separate class, I'd agree... but to me it's not [distinct from proc] a concept that exists inside the application
<dminuoso> gchristensen: But be prepared to get hardly usable results unless you are intimately familiar with how Ruby works.
<mzo> oh you meant when its on a parameter
<gchristensen> huh, I had never considered valgrind... yeah I was worried about that :P
<dminuoso> mzo: Yeah.
<LyndsySimon> dminuoso: Well... thanks. My yak shaving has taught me quite a bit about what's going on with blocks/procs/lambdas. It's still not quite clear, but I'm closer.
<dminuoso> gchristensen: It's called "Helgrind"
<matthewd> dminuoso: So I'm free to use "block" to mean "a nested chunk of code", as it would in casual conversation, or in reference to the body of an if or a while
<dminuoso> gchristensen: It's uses are limited, and it cant prove all possible race conditions. But for those cases when it works it's amazing.
<gchristensen> nice, thank you dminuoso
<matthewd> gchristensen: My primary advice would be to use less concurrency
<dminuoso> Or dont use shared state
<matthewd> (that sounds like a joke, but really isn't)
Cohedrin has joined #ruby
Cohedrin has quit [Client Quit]
<gchristensen> I know it isn't a joke, matthewd :(
<gchristensen> ("You must be this tall to write concurrent software")
norbertka has quit [Read error: Connection reset by peer]
<baweaver> Elixir
<dminuoso> gchristensen: Or start writing functional code.
<dminuoso> gchristensen: Such as with Elixir. :-)
<matthewd> Yes, not less threads.. just less shared state in non-concurrent data structures
norbertka has joined #ruby
brent__ has joined #ruby
aufi has quit [Quit: Leaving]
<dminuoso> gchristensen: The main issue has nothing to do with experience, but the fact that concurrency and object oriented programming dont go well together. It's basically begging for trouble and data races.
<gchristensen> the trouble is we already have the application doing what it is doing, and it does lots of state inspection of hundreds of remote servers and doing it sequentially would be a nightmare
<LyndsySimon> dminuoso: Unfortunately I have to stick with my verbose code for now in production, because I rely on having access to ApplicationHelper instance methods... but this is much simpler.
<gchristensen> dminuoso: I know
cpruitt has quit [Read error: Connection reset by peer]
<baweaver> It's not that OO code is impossible to have work concurrently
<gchristensen> I'm aware of the dangers, the trouble is I have 10's of thousands of lines of code from other authors already doing it
<baweaver> Really you can just modify the accessors to return new objects
cpruitt has joined #ruby
patarr_ has joined #ruby
Blaze_Boy has quit [Ping timeout: 260 seconds]
<baweaver> Find the critical sections of your code
<LyndsySimon> gchristensen, dminuoso: I agree. If I'm writing concurrent code, my default setting it to write it in Clojure. If that's not possible, then take care to never, ever use functions with side effects.
ramortegui has quit [Ping timeout: 240 seconds]
<dminuoso> baweaver: Yeah it's not impossible. It's just notoriously hard unless you have overly pessimistic locking strategies (*cough* GVL anyone? *cough)
<gchristensen> yes of course
<baweaver> Critical section being where resources will fight
asahi has quit [Quit: leaving]
<baweaver> minimize all state around those if possible
<dminuoso> Well the thing is object oriented programming encourates data hiding. Data hiding means its that much harder to even know when you have shared data.
<baweaver> Sounds like a task for Freeze
<matthewd> gchristensen: To be wildly oversimplifying of what it sounds like your problem-space is: you need to inspect the remote servers concurrently... but does a single inspect_this_server(some_server) method need to manipulate shared state?
<matthewd> Presumably that's the part that's thousands of lines of multi-author code?
* baweaver chuckles that there's a user called freeze apparently
<LyndsySimon> That has to be annoying in this room.
<dminuoso> baweaver: And reentrancy is really hard because it forces you to plot out an entire call graph to ensure your function is reentrant.
<dminuoso> Popular example: strtok in C.
<dminuoso> It's not reentrant at all, despite what one might intuitively think.
<gchristensen> matthewd: need to vs. does it? hard to say :P we do lots of far more complicated operations in parallel as well, including modifying shared state, for sure
Snickers has quit [Ping timeout: 268 seconds]
<dminuoso> Bam. Hidden data => race condition is on.
patarr has quit [Ping timeout: 260 seconds]
dhollinger has joined #ruby
cdg has quit [Remote host closed the connection]
<gchristensen> it is going to be painful to fix, part of why I was hoping to find some tools to help.
cdg has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
OTORelic has joined #ruby
<baweaver> &ri Object#freeze
<baweaver> Use that to try and isolate changes
<gchristensen> (not to mention we're still on ruby 1.9.2p290 *runs away*
<dminuoso> gchristensen: It's quite possible you may have some old bug on your interpreter.
larcara has joined #ruby
<dminuoso> I wouldn't exclude that as a possibility.
<gchristensen> dminuoso: possible? guaranteed
<dminuoso> Well one that causes your problem.
<matthewd> gchristensen: Do you control the threads? Or is the ~uncontrolled code spawning its own?
<gchristensen> also guaranteed: our concurrency problems are our own problems.
<gchristensen> matthewd: "yes" :)
mula has quit [Remote host closed the connection]
xall has joined #ruby
<baweaver> The amount of evil possible with that function is immense, but the good in debugging is worth it in some cases.
uncertainty has quit [Ping timeout: 260 seconds]
<matthewd> For the ones you control, I'd just start freezing everything you can that they get passed, and then supplying fairly broad locks around the things you can't freeze
<baweaver> use carefully.
<baweaver> For instance an evil type could make all cases of addition in your program randomly add 1 to the final result
Blaze_Boy has joined #ruby
Blaze_Boy has left #ruby [#ruby]
<matthewd> That is, put the locking inside the 'outermost' objects, for better predictability at the cost of some sliver of extra concurrency
nobitanobi has quit [Read error: No route to host]
<dminuoso> baweaver: I like that. Now how do I install that gem for production use?
<dminuoso> I'd call it "addition-enhancer"
larcara has quit [Ping timeout: 260 seconds]
<dminuoso> "Ever had off-by-one errors in your application? This gem will apply a fix to ensure all off-by-one errors will be offset by one, thus fixing them.
<baweaver> set_trace_func proc { |event, file, line, id, binding, classname| me = binding.eval("self"); me.freeze if %w(SensitiveObject).include?(me.class) && !me.frozen? }
<baweaver> something like that for the nuclear hunting option
synthroid has joined #ruby
<baweaver> dminuoso: could gemify that one
<baweaver> call it MrFreeze
<matthewd> You could also add a Thread.main exclusion, or something
xen0fon has quit [Read error: Connection reset by peer]
t-recx has joined #ruby
<dminuoso> baweaver: Brilliant, that could sit right next to my Fiddle class "MrThaw"
<dminuoso> (And yes, I actually had to use a #thaw in production code before)
<dminuoso> well. "had"
<dminuoso> really wanted to monkey patch some third party class badly, and they thought they knew better than me. hah.
chouhoulis has joined #ruby
hotpancakes has joined #ruby
nofxx has quit [Ping timeout: 260 seconds]
<matthewd> Yeah, I do not enjoy it when 3rd party code tries to pretend it's not running in ruby, and starts applying "we won't allow this because someone might misuse it" protections
chouhoulis has quit [Remote host closed the connection]
iwmrby has quit [Quit: WeeChat 1.7]
xen0fon has joined #ruby
chouhoulis has joined #ruby
lenwood has joined #ruby
<hxegon> Is trying to use monadic code in my daily ruby job being "too clever"?
<baweaver> yes
<baweaver> Unless you're using Haskell or Scala or one of the like.
pawnbox has joined #ruby
preyalone has joined #ruby
<gchristensen> baweaver: that is amazing
<baweaver> also evil, use wisely
<hxegon> That's what I thought, just wanted to double check my intuition there
<matthewd> It's being "un-ruby-like", which has largely the same problems as "too clever", I'd say
<hxegon> What's more evil though, baweaver, nil or Maybe?
<gchristensen> naturally
<baweaver> If it requires a lot of comments to explain, it's trying to be clever
<gchristensen> great power / great responsibility
<baweaver> I was referring to gchristensen, not you there
Rodya_ has joined #ruby
<hxegon> ah
<baweaver> Now then, nil...
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> Firstly, use sane defaults whenever possible
hotpanca_ has joined #ruby
<baweaver> imagine select returned nil instead of empty array, that'd be an insane default
<baweaver> reduce surface area of nils with sane defaults first
<dminuoso> matthewd: Well over the past few months I'm slowly heading away from Ruby. The whole dynamic features looked a lot like fun, but the more serious a project grows the more I start liking static interfaces. I like reasoning about code.
xen0fon has quit [Read error: Connection reset by peer]
<baweaver> Second, consider the rule of Demeter in that you shouldn't chain deeply. It betrays a potential coupling that's worse than nils.
Rodya_ has quit [Remote host closed the connection]
<baweaver> Third, remember Ruby has the lonely operator
<dminuoso> matthewd: I'm slowly going back to static typing, even my JavaScript code is getting flowtype'd thoroughly
Rodya_ has joined #ruby
Snickers has joined #ruby
<baweaver> Y'know Ruby 3.x is getting static types right?
<hxegon> baweaver: Something about &. strikes me as deeply disturbing, but I can't put my finger on it
<gchristensen> ruby 1.9.2 doesn't have the lonely operator
<hxegon> wait what?
hotpancakes has quit [Ping timeout: 246 seconds]
<baweaver> I'm referring to the Maybe vs Nil bit on that one gchristensen
pawnbox has quit [Ping timeout: 240 seconds]
<gchristensen> ah
<dminuoso> baweaver: If Ruby 3.x had come out 3 years ago great, but I don't want to wait for this "Perl 6" kind of release we have been waiting for a decade.
<matthewd> s/static types/some as-yet-undetermined form of type annotations maybe/
<baweaver> hxegon: It's also getting Akka/Elixir like message passing iirc.
<baweaver> Keynote a while back made it sound stronger than a maybe, but fair.
<baweaver> We won't know until it hits.
<hxegon> Well, something to look out for at least :)
moeSizlak has left #ruby ["Leaving"]
<baweaver> We can only hope we don't suffer the same fate as Python 2 -> 3
xen0fon has joined #ruby
djbkd has quit [Remote host closed the connection]
<baweaver> Anyways. hxegon: so what do you need Maybe/Option for?
hotpanca_ has quit [Ping timeout: 246 seconds]
<matthewd> Matz is pretty strong on minimizing compatibility breaks
<baweaver> Remember that your code will be littered with psuedo-pattern matching and unbinds
<hxegon> I wasn't talking about a specific use case, just something that's been on my mind for a while
bmurt has joined #ruby
<baweaver> matthewd: I imagine it'll be fine.
<baweaver> well, as long as we don't go breaking print or unicode support
<hxegon> but the sane defaults thing you were talking about plus NullObject should cover most of my issues without being to un-ruby baweaver
<matthewd> Yeah.. we didn't get stuck on 1.8/1.9 for *that* long, compared to peers
<baweaver> Remember Demeter. Most people say law, I say rule, but the point is a deeply nested call speaks to other issues than nil.
amclain has joined #ruby
mello has joined #ruby
d0nn1e has quit [Ping timeout: 240 seconds]
<baweaver> person.address.state.governor.name
<baweaver> that'd be bad
<matthewd> baweaver: If everything's a Maybe, Demeter doesn't mind how many intermediates you traverse ;)
<hxegon> baweaver: Demeter is something I knew about but didn't really get until seeing some refactor examples being worked through in conf talks
<baweaver> It's Optional
raul782 has quit [Remote host closed the connection]
<baweaver> The problem with putting Option/Maybe everywhere is that all of your code is going to start surfacing unwrap operations which can make stack traces really hard in a language that's not familiar with them natively
d0nn1e has joined #ruby
<baweaver> Either that or hide truly insidious errors if you do something silly like swallow them in a pipeline
<baweaver> This works fine in FP, but in Ruby you'll find some fun gotchas - https://fsharpforfunandprofit.com/rop/
gchristensen has left #ruby ["WeeChat 0.4.2"]
<baweaver> Of course I'm going to start writing some really odd Ruby now that Javascript is going to be my primary language at work
<dminuoso> baweaver: Interesting, Ive noticed the same thing. So many FP constructs and ideas are carrying over.
pawnbox has joined #ruby
<baweaver> I've used currying, points free, and other concepts in production code before
djbkd has joined #ruby
<baweaver> granted this was Javascript.
shinnya has quit [Ping timeout: 256 seconds]
bkxd has quit [Ping timeout: 258 seconds]
* baweaver is not particularly fond of Ruby's & for procs
<hxegon> I'm guessing it's easier to take back functional concepts to work in javascript than ruby baweaver ?
<baweaver> Moreso than Ruby, less so than Haskell or Scala
mark_66 has quit [Remote host closed the connection]
<baweaver> JS at least has Tail Recursion built in.
* baweaver knows about the compile flags
marxarelli|afk has quit [Quit: Textual IRC Client: www.textualapp.com]
larcara has joined #ruby
marxarelli has joined #ruby
[Butch] has joined #ruby
dionysus69 has joined #ruby
hotpancakes has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
sehnny has joined #ruby
DaveTaboola has quit [Ping timeout: 260 seconds]
raul782 has joined #ruby
lxsameer has joined #ruby
[Butch] has quit [Client Quit]
mzo has quit [Ping timeout: 260 seconds]
JeanCarloMachado has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
last_staff has joined #ruby
<hxegon> baweaver: so how is working with js daily? I'd imagine terrible, but that's pretty much baseless speculation on my part.
<baweaver> Haven't really started yet. Transferring onto a client team over here.
<baweaver> primarily EmberJS
[Butch] has joined #ruby
<baweaver> Honestly JS isn't that bad, especially with ES6. If you know what to watch out for the rest is fairly straightforward.
armyriad has quit [Ping timeout: 268 seconds]
hotpancakes has quit [Ping timeout: 246 seconds]
<hxegon> nothing quite like dealing with merge conflicts in Gemfile.lock :(
<matthewd> hxegon: 90% of the time you can reset it to one of the two before-states, then re-bundle with the merged Gemfile
<hxegon> thanks matthewd
spicerack has quit [Quit: Textual IRC Client: www.textualapp.com]
aganov has quit [Remote host closed the connection]
dominikh has left #ruby ["WeeChat 1.6"]
renatosilva has joined #ruby
sneakerhax has quit [Ping timeout: 260 seconds]
last_staff has quit [Quit: last_staff]
ramortegui has joined #ruby
conta has quit [Ping timeout: 240 seconds]
Rodya_ has quit [Remote host closed the connection]
ResidentBiscuit has joined #ruby
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
Burgestrand has quit [Quit: Closing time!]
jnoob22 has quit [Read error: Connection reset by peer]
dar123 has joined #ruby
gusrub has joined #ruby
enterprisey has joined #ruby
username1 has joined #ruby
xen0fon1 has joined #ruby
xen0fon has quit [Ping timeout: 264 seconds]
xen0fon1 is now known as xen0fon
aufi has joined #ruby
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
norbertka has quit [Quit: Leaving]
synthroid has quit [Remote host closed the connection]
govg has quit [Quit: leaving]
synthroid has joined #ruby
aupadhye has quit [Quit: Leaving]
agit0 has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby
pawnbox has quit [Ping timeout: 256 seconds]
bkxd has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
pawnbox has joined #ruby
jsrn_ has quit [Read error: Connection reset by peer]
antgel has quit [Ping timeout: 240 seconds]
Derperperd has joined #ruby
tuelz has quit [Ping timeout: 264 seconds]
blackmesa has quit [Ping timeout: 240 seconds]
sehnny has quit [Remote host closed the connection]
larcara has quit [Remote host closed the connection]
gusrub has quit [Remote host closed the connection]
hotpancakes has joined #ruby
ebcz has quit [Ping timeout: 240 seconds]
gusrub has joined #ruby
milardovich has quit []
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xall has quit [Ping timeout: 246 seconds]
mustmodify has joined #ruby
dar123 has joined #ruby
milardovich has joined #ruby
<mustmodify> I'm obviously losing my mind. How could I end up with the error 'undefined method `using` for nil:NilClass" on line 6 here? https://gist.github.com/mustmodify/3975962c886c2349a46b1554434b43e3#file-gistfile1-txt-L6
<hxegon> that's uhhh
<hxegon> a little hard to parse
<hxegon> boundary_range.not.nil? ?
<hxegon> must be failing somehow. Never seen that before.
_djbkd has joined #ruby
<dminuoso> mustmodify: what is .not ?
<dminuoso> mustmodify: Is not defined on nil?
<hxegon> also curious about that mustmodify
marxarelli is now known as marxarelli|afk
<baweaver> Someone made a whole lot of custom OO chaining
<mustmodify> oh.
<dminuoso> mustmodify: If its defined on nil to return nil, that's the source of your error.
<mustmodify> yeah, .not -- I got that from ThoughtWorks. I'll remove that.
<mustmodify> It's cool though.
<dminuoso> ! is cool.
<dminuoso> .not is not.
<mustmodify> cool.not
<mustmodify> ok
<hxegon> lol
<baweaver> Also &.
<hxegon> seems like that might be more readable if you extracted some temp vars
<mustmodify> updated gist, still fails.
<dminuoso> and boy, assignments inside conditionals
govg has joined #ruby
<dminuoso> mustmodify: that code throw ruby warnings like there's no tomorrow.
<dminuoso> And rightfully so.
<mustmodify> ok, I'll rewrite it as its own class and see how it goes. :)
hxegon is now known as hxegon_afk
<dminuoso> mustmodify: and unfold it.
<dminuoso> Someone really deserves to have his tab key taken away. ;-)
<mustmodify> sure, that would be the point. :)
hotpancakes has quit [Ping timeout: 246 seconds]
<mustmodify> The tabs weren't originally in there.
szulak has joined #ruby
<mustmodify> I just pressed enter+space+space to put things on different lines, to make sure I was looking at the right piece of code. rspec sometimes seems to lose things from its stack trace.
<mustmodify> but I agree it's not great code.
<mustmodify> that said, I don't think that error should EVER happen.
enterprisey has quit [Remote host closed the connection]
xall has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JoshS has quit [Quit: Leaving]
duderonomy has quit [Ping timeout: 258 seconds]
xall has quit [Ping timeout: 258 seconds]
xall_ has joined #ruby
akkad has quit [Excess Flood]
mzo has joined #ruby
larcara has joined #ruby
mikecmpb_ has quit [Quit: inabit. zz.]
montanonic has joined #ruby
tvw has quit [Remote host closed the connection]
hotpancakes has joined #ruby
harfangk has quit [Quit: Textual IRC Client: www.textualapp.com]
synthroid has quit []
OTORelic has quit [Ping timeout: 240 seconds]
akkad has joined #ruby
pandaant has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
synthroid has joined #ruby
cdg_ has joined #ruby
montanonic has quit [Ping timeout: 268 seconds]
synthroi_ has joined #ruby
dopamean_ has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
Rodya_ has joined #ruby
blackmesa has joined #ruby
synthroid has quit [Ping timeout: 258 seconds]
pawnbox has joined #ruby
OTORelic has joined #ruby
<mustmodify> STUPID THING. I found the bug. It's right in front of our faces.
<mzo> should i use 'do' with while loops
Rodya_ has quit [Ping timeout: 246 seconds]
<dminuoso> >> def partialApply(callable, *applyArgs); return ->(*otherArgs) { callable.call(*applyArgs, *otherArgs) } end; thunk = ->(a,b) { puts "a: #{a}, b: #{b}" }; partialApply(thunk, "1").call("2")
faces has quit [Ping timeout: 240 seconds]
<ruby[bot]> dminuoso: # => a: 1, b: 2 ...check link for more (https://eval.in/753680)
<dminuoso> Im not quite happy with this star. :(
faces has joined #ruby
aufi has quit [Quit: Leaving]
kolchan11 has joined #ruby
benlieb has joined #ruby
andikr has quit [Remote host closed the connection]
<mzo> dminuoso: why not
preyalone has quit [Quit: Connection closed for inactivity]
<dminuoso> mzo: Im so used to the way that parameter packs are denoted in C++
Cohedrin has joined #ruby
juggler has joined #ruby
kolchan11 has left #ruby [#ruby]
lxsameer has quit [Quit: WeeChat 1.5]
hotpancakes has quit [Remote host closed the connection]
raul782 has quit [Remote host closed the connection]
hotpancakes has joined #ruby
hotpancakes has quit [Remote host closed the connection]
duderonomy has joined #ruby
hotpancakes has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
jaruga__________ has quit [Ping timeout: 240 seconds]
pilne has joined #ruby
elifoster has joined #ruby
larcara has quit []
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rodya_ has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
robnester has quit [Ping timeout: 246 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
antgel has joined #ruby
rfoust has quit [Ping timeout: 246 seconds]
cdg has joined #ruby
robnester has joined #ruby
OTORelic has quit [Ping timeout: 258 seconds]
cdg_ has quit [Ping timeout: 240 seconds]
bocaneri has quit [Read error: Connection reset by peer]
dar123 has joined #ruby
mzo has quit [Ping timeout: 256 seconds]
cFire has joined #ruby
antgel has quit [Ping timeout: 268 seconds]
pulkit4tech has quit [Quit: Connection closed for inactivity]
renchan has quit [Quit: Leaving...]
<cFire> Hi, I have a code style question. I'm writing a lexer parser that will do some custom scripting language stuff and the lexer at some point needs to make a choice about what type of thing it should start reading next (read a string, read a number, read a function name etc.)
choke has joined #ruby
<cFire> And I'm looking for a cleaner way to do it than a bit case/when statement for each case.
<cFire> than a big *
sepp2k has quit [Ping timeout: 260 seconds]
<cFire> The only thing I've come up with so far is some type of map construction, but that'd hardly make it more readable I think.
OTORelic has joined #ruby
bmurt has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Synthead has quit [Remote host closed the connection]
mula has joined #ruby
mzo has joined #ruby
dar123 has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
bmurt has quit [Ping timeout: 268 seconds]
hutch34 has quit [Ping timeout: 268 seconds]
<Papierkorb> cFire: The lexer doesn't decide that. The lexer takes a string and spits out a token stream
raul782 has joined #ruby
<Papierkorb> cFire: it's a parsers job to then make sense of that token stream
nowhereman has quit [Ping timeout: 240 seconds]
lightheaded has quit [Ping timeout: 260 seconds]
<patarr_> If I'm monkey patching a class (overriding a method), how do I call the original method? super doesn't work because it tries to call the method on the superclass (there is no superclass)
mustmodify has left #ruby [#ruby]
<Papierkorb> patarr_: Before the overriding def, just alias/alias_method the method to another name (like do_x -> orig_do_x), and then call that
cdg has quit [Ping timeout: 246 seconds]
mula has quit [Remote host closed the connection]
<cFire> Papierkorb: The lexer decides what type of token it's parsing. But regradless of the specific example I'm working on, that doesn't change the fact that I'm in need of a neater solution than a long case/when block.
weaksauce has joined #ruby
Rodya_ has quit [Remote host closed the connection]
hotpancakes has quit [Remote host closed the connection]
<cFire> ( For reference and anyone who cares, I'm basically using Rob Pike's lexer/parser design from https://www.youtube.com/watch?v=HxaD_trXwRE )
hxegon_afk is now known as hxegon
zeroDi has joined #ruby
renchan has joined #ruby
<cFire> But yeah, the question is a more general "How to deal with long case/when blocks that have no real logical way to split them up?"
Rodya_ has joined #ruby
sepp2k has joined #ruby
<cFire> And in my specific case I'm running into it where the lexer is trying to figure out what type of token it needs to lex and emit next
ishigoya has quit [Ping timeout: 255 seconds]
<dminuoso> cFire: For such cases a long case statement is perfectly fine.
<dminuoso> cFire: Try to keep any logic out of the case statement though
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<dminuoso> cFire: Is your lexer a statemachine, or is it just a dumb collection of regular expressions?
bkxd has joined #ruby
<dminuoso> Papierkorb: And by the way, regarding your "the lexer doesn't decide that" is a funny statement, considering the name of this channel.
<dminuoso> The monstrocity of the Ruby lexer would like to have a word with you. ;p
hotpancakes has joined #ruby
hutch34 has joined #ruby
raul782 has quit [Remote host closed the connection]
<cFire> dminuoso: neither. It's a little hard to explain in a short way. It's state-machine-ish .. kind of remotely :p
cpruitt has quit [Quit: cpruitt]
<cFire> If you're interested, watch the pesentation I linked. I think it's a pretty cool lexer design.
<cFire> It's what's used for golang's template lexer/parser
Rodya_ has quit [Remote host closed the connection]
cpruitt has joined #ruby
sagax has quit [Quit: Konversation terminated!]
<cFire> Also, from experience, never try to write a lexer using regex. It's a nightmare xD
hotpancakes has quit [Ping timeout: 268 seconds]
<dminuoso> cFire: Looks like a regular lexer.
Rodya_ has joined #ruby
<dminuoso> cFire: From experience it's quite fine for tons of cases actually.
<dminuoso> cFire: If you express your grammar well enough, it allows for a really simple lexer.
szulak has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<cFire> Really? Interesting. I've never written one for a case where I get to decide the grammar myself. I guess that would help a lot
jnoob22 has joined #ruby
Rodya_ has quit [Remote host closed the connection]
raul782 has joined #ruby
<dminuoso> cFire: You can easily implement all of C with a dumbed down 180 lines yacc lexer using pretty much just literals and a handful of regular expressions.
ahrs has joined #ruby
<Papierkorb> dminuoso: I wouldn't consider the Ruby lexer/parser to be the epitome of clean code
<cFire> That I'd like to see
cfec0b8d has joined #ruby
<Papierkorb> s/clean code/awesome architecture/
<mzo> don't use regex for a lexer? why?
<mzo> regex are a very natural way to describe tokens
xen0fon has quit [Quit: xen0fon]
<dminuoso> mzo: Well situations quickly arise where you need to take over, but they can easily cover for the majority of non-keyword cases. :)
<dminuoso> mzo: And that's basicaly all that's needed to tokenize constants and literals in C.
ramfjord has joined #ruby
Rodya_ has joined #ruby
<cFire> Interesting indeed. That's a lot less work than I'd have expected it to be
dar123 has joined #ruby
<dminuoso> cFire: Remember that's there's still a yacc code generator around it though.
<mzo> lexing is not a hard problem
<mzo> you could hand-write a lexer and it wouldn't be much bigger than that
<dminuoso> ^-
<cFire> Not all fun problems have to be hard :)
<dminuoso> cFire: Indeed, the trick usually lies in the parser.
hotpancakes has joined #ruby
<dminuoso> That's where things get truly interesting.
<matthewd> Last time I had to do such a thing I really liked kpeg (which as the name suggests, is a PEG, not a lexer/parser)
joelwallis has joined #ruby
teclator has joined #ruby
eclecticjohny has joined #ruby
<cFire> For me in this case the parser is luckily really simple since essentially all it needs to do is construct the parse tree from the token stream
<mzo> that's what all parsers do
<dminuoso> Except he probably tries to map grammar to tokens in the lexer already.
<dminuoso> Based on the history of this conversation..
<dminuoso> If the parser is more trivial than your lexer, there's something wrong.
workmad3 has quit [Ping timeout: 246 seconds]
<cFire> The lexer knows what type of token it's working on yeah
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
<mzo> in most programming languages the number of different types of AST nodes is a lot higher than the number of types of tokens
<mzo> also there's operator precedence, etc.
<dminuoso> cFire: What do you mean by what "type of token" ?
<cFire> single quoted string, number, start of block
<cFire> that sort of thing
<dminuoso> cFire: Well, that can easily be handled by raw regular expression matching.
<matthewd> Fairly clear, but still.. ugly :|
<dminuoso> o.o
<cFire> It can be, but it doesn't have to be
<dminuoso> matthewd: is this actually still raw ruby?
<matthewd> I blame the fact I was porting the existing parser
<matthewd> dminuoso: No
<cFire> I think we can all agree there's no one correct way to implement a lexer
ResidentBiscuit has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Derperperd has quit [Ping timeout: 240 seconds]
<cFire> I just happen to like Rob Pike's design
<matthewd> dminuoso: I mean.. it *parses* raw ruby ;)
skweek has quit [Ping timeout: 240 seconds]
<dminuoso> matthewd: Does it pass all and every Ruby you can throw at it?
tomphp has joined #ruby
skweek has joined #ruby
<matthewd> It certainly seemed to at the time
<matthewd> .. but "the time" was 1.8
<dminuoso> Im impressed. How did you write it? Was it a direct mimicry of the MRI bison parser?
<matthewd> Multiple sequential / nested heredocs, for example, were a point of focus I remember
<matthewd> Yes
mzo has quit [Quit: :*]
<matthewd> (it was an experiment as a possible option for rubinius, which was using an extracted copy of the MRI parser)
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> It was.. not as fast. ;)
SeepingN has joined #ruby
<dminuoso> matthewd: It makes sense. How did you tackle the lexer though?
<matthewd> It's a PEG, so it's all in one: the terminals are strings or regexes
<dminuoso> I've never done PEG, how does it differentiate lvars from method calls?
<matthewd> e.g. those operator strings are literally matching the bytes, not references to operator tokens elsewhere
<graft> cFire: i went through this exercise a few days ago, I recommend checking out RLTK
dar123 has joined #ruby
govg has quit [Ping timeout: 260 seconds]
<graft> cFire: unless you're dead set on writing the lexer/parser part, this is a nice framework that does this for you, so you can focus on grammar and implementation details
<cFire> I'll check it out, thanks
<dminuoso> Or does the parser at some point match an assignment to a variable, and then cache that identifier as a variable for the remainder of the current scope?
* dminuoso has only done LR1 and recursive descent parsers
<graft> cFire: saved me a ton of effort and time
<matthewd> I think https://github.com/evanphx/kpeg has some more manageably-sized examples
<matthewd> IIRC it might treat all barewords as lvars in the AST, then let the compiler decide later
govg has joined #ruby
<dminuoso> matthewd: Then it's definitely not the same :P
xall_ has quit [Ping timeout: 240 seconds]
<dminuoso> Though..
<dminuoso> No I suppose the compiler *could* do it.
jeffreylevesque has quit [Ping timeout: 246 seconds]
<matthewd> You can insert ruby code in a &{ .. } block, in the middle of a rule, to decide whether to continue trying to match -- I think that was one of the things I liked
<dminuoso> That sounds neat
<dminuoso> matthewd: That alone sounds a lot like a RDP
<dminuoso> Or similar
<matthewd> Yeah, the compiler has to know how to map AST::LVar("foo") to read_local_slot(3), so given it has that names->slots table, it can also switch to a vcall if the name's unknown
<dminuoso> Interesting, that means the AST has to be in lexing order (which would be interesting for the case of modifier_unless)
<dminuoso> Or at the very least AST nodes for modifier_ keywords need that information to allow the compiler to visit nodes in a different order
<matthewd> Hmm.. true
skweek has quit [Ping timeout: 256 seconds]
milardovich has quit [Remote host closed the connection]
<dminuoso> Ah. Yeah.
milardovich has joined #ruby
<dminuoso> Im curious how modifier_ keywords are handled in that regard.
raul782 has quit [Remote host closed the connection]
<matthewd> Yeah, looks like the check_for_local thing was already defined in the Rubinius parser, so not my invention
nertzy has quit [Ping timeout: 264 seconds]
<dminuoso> Either you need to use fixups or a quirky traversal method.
<dminuoso> My bet is on fixups
ncopa has quit [Quit: Leaving]
milardovich has quit [Remote host closed the connection]
Derperperd has joined #ruby
milardovich has joined #ruby
<matthewd> Without having actually tried anything, it looks like that might be a bug
raul782 has joined #ruby
<matthewd> The AST doesn't seem to retain any distinction between `if x; y; end` and `y if x`, so I don't see how a later stage could fix it
chimmy has joined #ruby
chimmy is now known as chimkan
pulkit4tech has joined #ruby
<allisio> dminuoso, LyndsySimon: Sorry, had to head out on short notice earlier. Did y'all get that Proc->lambda thing sorted?
<dminuoso> matthewd: You could argue that code that somehow relies on this behavior is almost always a bug anyway.
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
joelwall_ has joined #ruby
<LyndsySimon> allisio: Yeah - plus, it wasn't really a problem so much as it was my learning a bit more.
elifoster has quit [Quit: class]
nowhereman has joined #ruby
<matthewd> True.. it'd actually be pretty hard to come up with a sane thing that it'd break, I guess
postmodern has joined #ruby
synthroi_ has quit [Remote host closed the connection]
chimkan has quit [Client Quit]
<matthewd> .. because `while x; y; end` and `y while x`, where it's at least *possibly* useful, do in fact end up stored differently, because of their different behaviours
joelwallis has quit [Ping timeout: 240 seconds]
sysanthrope has quit [Remote host closed the connection]
chimkan has joined #ruby
sysanthrope has joined #ruby
<allisio> I do wish the pre-modifier expression could introduce locals.
<matthewd> `x = foo while x.nil?` is sane-ish; `x = foo if x.nil?` not so much
<dminuoso> allisio: It absolutely can
chimkan_ has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<allisio> dminuoso: Nah.
<matthewd> (given a not-yet-local 'x')
chimkan_ has left #ruby [#ruby]
bmurt has joined #ruby
<dminuoso> allisio: Just dont use identifiers, but binding.local_variable_get instead ;D
<allisio> dminuoso: Ha.
<allisio> LyndsySimon: Do you mean to say that you figured out how to write #proc_to_lambda?
chimkan has quit [Client Quit]
<LyndsySimon> allisio: I figured out *another* way to write it, lol.
<dminuoso> LyndsySimon: Shoot Im curious.
<allisio> I can't think how to write it without some gruesome combination of Proc#parameters and eval. :/
enterprisey has joined #ruby
<dminuoso> I can think of a few ways that involves RubyVM::InstructionSequence
<matthewd> define_method will do it
<matthewd> (don't do that)
szulak has joined #ruby
szulak has quit [Client Quit]
<dminuoso> Mmm. Passing UnboundMethods around.
<dminuoso> I like the idea.
<allisio> I'm talking about in the general case?
<LyndsySimon> The whole thing makes my head hurt at the moment.
blackmesa has joined #ruby
<allisio> Oh, hey, a bug!
<adaedra> 🐛
<dminuoso> > (->())()
<dminuoso> >> (->())()
<ruby[bot]> dminuoso: # => /tmp/execpad-402f9d42b49a/source-402f9d42b49a:2: syntax error, unexpected ')', expecting keyword_do_ ...check link for more (https://eval.in/753715)
<dminuoso> I wish that was legal syntax.
<adaedra> >> (->())[]
<ruby[bot]> adaedra: # => /tmp/execpad-ef81c9fb6005/source-ef81c9fb6005:2: syntax error, unexpected ')', expecting keyword_do_ ...check link for more (https://eval.in/753716)
<adaedra> mh.
<baweaver> IIFE?
xen0fon has joined #ruby
<dminuoso> Yeah
<adaedra> ah yes, lacks the block.
<adaedra> >> (->(){})[]
<ruby[bot]> adaedra: # => nil (https://eval.in/753717)
<dminuoso> mmm
<dminuoso> Oh.
<dminuoso> That hurt.
<baweaver> >> (->{})[]
<ruby[bot]> baweaver: # => nil (https://eval.in/753718)
<dminuoso> >>(->{})()
milardovich has quit [Remote host closed the connection]
<baweaver> We will not be bamboozled today dminuoso
<ruby[bot]> dminuoso: # => /tmp/execpad-d74e21cc49a3/source-d74e21cc49a3:2: syntax error, unexpected '(', expecting keyword_end ...check link for more (https://eval.in/753721)
<adaedra> you can't () directly
<matthewd> >> (->{}).()
<ruby[bot]> matthewd: # => nil (https://eval.in/753722)
<adaedra> but [] is alias for call
* baweaver still wishes you could do that
milardovich has joined #ruby
<dminuoso> adaedra: Oh, that explains why it works.
<dminuoso> baweaver: But not before optional parens become deprecated.
* matthewd is glad you can't
<baweaver> that's probably my #1 annoyance with Ruby is that you can't call procs/lambdas in the same manner as methods
<allisio> Definitely a bug, yeah? https://eval.in/753724
<matthewd> Yeah, optional parens + direct callables == un-fun ambiguity
<dminuoso> Mmmm
<matthewd> allisio: No
<matthewd> allisio: The required arg comes first, so it gets the hash
synthroid has joined #ruby
<allisio> Ah, yeah.
<mc_fail> guys, is there any .map way to merge two hashes, to hashes of hashes, like if i have a = {"c"=>4,"d"=>5} and b = {"c"=>40,"d"=>50}, and i want to have {"c"=>{"a"=>4,b=20},"d"={"a"=>5,"b"=>50}}
cdg has joined #ruby
<allisio> Yikes.
<baweaver> the values are completely different
<dminuoso> mc_fail: Is that structure guaranteed?
<matthewd> In a from-scratch language, kwargs might trump that and give a 'missing positional arg' error, but yeah, because of history, we get a less ideal result
<mc_fail> yes
elifoster has joined #ruby
<dminuoso> mc_fail: Transform them into an array, transpose the matrix and enjoy
mzo has joined #ruby
milardovich has quit [Ping timeout: 246 seconds]
<allisio> mc_fail: Where's the 20 coming from?
<dminuoso> mc_fail: And dont use hashes when you mean to use matrices.
<dminuoso> allisio: It probably meant to say 40
<mc_fail> yeah, it was 40
dar123 has joined #ruby
<allisio> Anyway, it's evident you're using the wrong data structure.
<dminuoso> >> [[4, 5], [40, 50]].transpose
<ruby[bot]> dminuoso: # => [[4, 40], [5, 50]] (https://eval.in/753728)
<dminuoso> mc_fail: ^- this is what you meant right?
<matthewd> ?xy mc_fail
<ruby[bot]> mc_fail: 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
raul782 has quit [Remote host closed the connection]
<allisio> Well, hell, I suppose #define_method really is the best way to lambda-fy a Proc; that's disappointing somehow.
<baweaver> someone's been reading up on bot commands
<dminuoso> ?botsnack
<ruby[bot]> nomnomnomnom
<matthewd> Two weird hash-mangling questions in 12 hours = time for a higher level view
<baweaver> highest level view: codewars.com
bkxd has quit [Ping timeout: 264 seconds]
Derperperd has quit [Ping timeout: 240 seconds]
<baweaver> not sure which problem though this time.
<adaedra> ☃ri String
<dminuoso> allisio: at the very least define it an Object.new.singleton_class
xen0fon has quit [Quit: xen0fon]
<dminuoso> Oh boy. Those who manage the Haskell codewars are the true wizards.
<dminuoso> I just started the first Haskell thing. Staring and staring...
<dminuoso> More staring..
<mzo> what do u gotta do
<dminuoso> I have no clue.
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mzo> dminuoso: the multiply function?
dar123 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
juggler has quit [Ping timeout: 246 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> mzo: what are you talking about?
<dminuoso> mzo: Yes.
<mzo> baweaver: the broken multiply function on codewars.com haskell section
<baweaver> ah
<dminuoso> Yeah..
<dminuoso> Im still staring...
<mzo> dminuoso: why
<mzo> multiply = (*) or equivalently multiply a b = a * b
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<dminuoso> mzo: Clearly.
hotpanca_ has joined #ruby
<dminuoso> mzo: Still staring at what your snippet means.
<dminuoso> I've completed like the first chapter of the best haskell book and figured this is too easy. Let's jump right to Monads.
<dminuoso> That's when I was tripping on LSD.. except without the acid.
<mzo> the best haskell book?
<dminuoso> Oh yeah.
<mzo> Haskell Programming from First Principles?
<dminuoso> That's the one.
<mzo> you paid $59 for it?
chouhoul_ has joined #ruby
<dminuoso> No, but I would if there was a hard copy of it.
hotpancakes has quit [Ping timeout: 246 seconds]
<mzo> the question on codewars is like specifically trying to confuse people who don't know haskell
<mc_fail> another question, i have ClassA which has methodA(var), also, there is ClassB < ClassA, which implements methodB(var), when i call methodA(var) inside methodB var is nil there
<mc_fail> why?
<dminuoso> ?testcase
<ruby[bot]> dminuoso: I don't know anything about testcase
* dminuoso kicks ruby[bot]
* dminuoso kicks Apocalypse
* dminuoso also kicks apeiros
<dminuoso> mc_fail: testcase please
<mc_fail> 5 sec
raul782 has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
xen0fon has joined #ruby
<dminuoso> That is not a testcase.
<dminuoso> That is a lot of code.
<mc_fail> ok
<dminuoso> mc_fail: A testcase is the _least_ amount of code that replicates your problem.
AndBobsYourUncle has joined #ruby
<mc_fail> ok
_djbkd has quit [Remote host closed the connection]
<apeiros> dminuoso: I'll add a fact if you tell me what
hahuang65 has quit [Quit: WeeChat 1.7]
<dminuoso> > ot
pawnbox has quit [Remote host closed the connection]
_djbkd has joined #ruby
<dminuoso> !mcve
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<baweaver> !mvce
joelwall_ has quit [Remote host closed the connection]
<baweaver> nope
<dminuoso> Heh
joelwallis has joined #ruby
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
workmad3 has joined #ruby
blackmesa has quit [Quit: WeeChat 1.6]
elifoster has quit [Ping timeout: 268 seconds]
dionysus69 has quit [Read error: Connection reset by peer]
joelwallis has quit [Ping timeout: 260 seconds]
blackmesa has joined #ruby
elifoster has joined #ruby
blackmesa has quit [Client Quit]
workmad3 has quit [Ping timeout: 240 seconds]
synthroid has quit []
username1 has quit [Quit: Lost terminal]
AndBobsYourUncle has joined #ruby
<mzo> whats the best programming language to get hired with no experience
<lupine> php
xenops has quit [Ping timeout: 240 seconds]
<lupine> or maybe qbasic
<mzo> ok php sounds good
hahuang65 has joined #ruby
<mzo> i'm already somewhat familiar
dionysus69 has joined #ruby
<adaedra> *sniff* *sniff* What's with the sudden troll odour?
Rodya_ has quit [Remote host closed the connection]
<mzo> adaedra: you think lupine is trolling?
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
dionysus69 has quit [Read error: Connection reset by peer]
<adaedra> I think that this kind of question attracts non constructive discussions quite quickly, even when they're not originally trolling attempts.
jeffreylevesque has joined #ruby
<mzo> let's be constructive then
<mzo> i asked the other day about becoming a ruby developer and i was told it's difficult to get hired as a rails developer without experience. so i need to take a detour, if you will. but i don't know where.
<allisio> Get off on Exit 22.
<dminuoso> mzo: I suppose the entry as a rails developer is naturally higher because it forces you to understand a stack of technologies.
<dminuoso> Ruby is much more limited, as it just limits you to an easy-to-learn language and programming concepts and the tooling around it.
<mzo> so i should get hired as a rack developer first? :p
<dminuoso> Heh
dionysus69 has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
raspado has joined #ruby
<dminuoso> mzo: If I was to start all over again Ruby wouldn't be my first pick. I would probably try to look for other languages like Erlang.
<dminuoso> But that's just me.
<mzo> why Erlang
bkxd has joined #ruby
xenops has joined #ruby
<dminuoso> mzo: Well bias I suppose. I work in the telco business. :-)
tolerablyjake has joined #ruby
<mzo> lol.
joelwallis has joined #ruby
bmurt has joined #ruby
<mzo> i want to work as a web developer
<allisio> Why?
<mzo> i like the web
<ytti_> gold and myrrh
joelwallis has quit [Client Quit]
<allisio> I wonder if and how "myrrh" and "pyrrhic" are related.
<dminuoso> allisio: they are both written using only ascii compatible codepoints
<dminuoso> is that what you wanted to know? ..
<dminuoso> Also they are both strings that have a length of less-than-or-equals 17395
<allisio> dminuoso: It turns out there are more /yrrh/ words than I anticipated, so those ones aren't as special as I thought.
__Yiota has joined #ruby
<allisio> I'm so glad this is what I thought it might be: https://en.wikipedia.org/wiki/Byrrh
__Yiota has quit [Client Quit]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
KnownSyntax has quit [Ping timeout: 246 seconds]
enterprisey has quit [Remote host closed the connection]
milardovich has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
evertversteeg has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
JeanCarloMachado has quit [Ping timeout: 268 seconds]
nowhereman has quit [Ping timeout: 258 seconds]
xen0fon has quit [Quit: xen0fon]
lxsameer has joined #ruby
blackwind_123 has joined #ruby
postmodern has quit [Ping timeout: 246 seconds]
nertzy has joined #ruby
tomphp has joined #ruby
dionysus69 has quit [Remote host closed the connection]
jenrzzz has joined #ruby
dionysus70 has joined #ruby
KnownSyntax has joined #ruby
ozcanesen has quit [Quit: Textual IRC Client: www.textualapp.com]
eclecticjohny has joined #ruby
elifoster has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
dionysus70 is now known as dionysus69
isomorphismes has quit [Ping timeout: 245 seconds]
ta_ has joined #ruby
eclecticjohny has quit [Client Quit]
evertversteeg has quit [Quit: Ex-Chat]
eclecticjohny has joined #ruby
eclecticjohny has quit [Client Quit]
eclecticjohny has joined #ruby
eclecticjohny has quit [Client Quit]
SuperLag has quit [Remote host closed the connection]
eclecticjohny has joined #ruby
SuperLag has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
renatosilva has quit [Quit: http://renatosilva.net]
ramortegui has quit [Quit: Ex-Chat]
Polarina has quit [Remote host closed the connection]
patarr_ has quit [Ping timeout: 260 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dar123 has quit [Read error: Connection reset by peer]
milardovich has quit []
pawnbox has joined #ruby
ramfjord has quit [Ping timeout: 258 seconds]
hxegon is now known as hxegon_afk
lxsameer has quit [Quit: WeeChat 1.6]
rkazak_ has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
Lord_of_Life has quit [Excess Flood]
zapata has quit [Ping timeout: 260 seconds]
nowhereman has joined #ruby
postmodern has joined #ruby
pawnbox has quit [Ping timeout: 268 seconds]
CloCkWeRX has joined #ruby
Lord_of_Life has joined #ruby
Coldblackice has quit [Ping timeout: 264 seconds]
ramfjord has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agent_white has quit [Quit: bbl]
guardian has left #ruby ["WeeChat 1.5"]
zapata has joined #ruby
OTORelic has quit [Ping timeout: 264 seconds]
szulak_ has joined #ruby
tomphp has joined #ruby
kolaman has joined #ruby
aspiers has quit [Ping timeout: 268 seconds]
preyalone has joined #ruby
blackwind_123 has quit [Ping timeout: 258 seconds]
renchan has quit [Remote host closed the connection]
tomphp has quit [Client Quit]
AndBobsYourUncle has joined #ruby
blackwind_123 has joined #ruby
mula has joined #ruby
dopamean_ has quit [Ping timeout: 240 seconds]
ldnunes has quit [Quit: Leaving]
rkazak_ has quit [Quit: Sleep.....ing....]
jenrzzz has quit [Ping timeout: 260 seconds]
mula has quit [Remote host closed the connection]
<ineb> How can i fix this regex? The first input must not match. I only want to allow one or two digits which are not followed by 'E'. http://rubular.com/r/KRU5UuaMao
<ineb> The first input matches because the first digit is not followed by 'E' but by another digit
<ineb> is it not possible to use quantifier at this place?
<bougyman> wouldn't matter.
<bougyman> (?! makes what you want tricky
<bougyman> consider re = /(?:\d(?!E)|\d\d(?!E)).+/ and you can see the difficulty
<bougyman> you'd have to add anchors
Suslov has joined #ruby
<ineb> your first suggestion is what i had in mind
<ineb> but is there another way?
<bougyman> it would be possible with anchors.
<bougyman> re = /\b(?:\d(?!E)|\d\d(?!E))$/
<bougyman> but not without
<ineb> i see
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
<dminuoso> bougyman: Please make a habit of anchoring using \A and \z over ^ and $
pawnbox has joined #ruby
<dminuoso> (Unless you actually mean the semantics of ^/$
tomphp has joined #ruby
<dminuoso> While this may seem like senseless nitpicking, it has some serious impact if you use a regular expression to validate some input, and you have something like /^#{pattern}$/ -> now suddenly "<script>funnyStuff</script>\nSafePattern" matches. :-)
<dminuoso> Or it can hide other bugs
Suslov has quit [Remote host closed the connection]
tekniq has joined #ruby
Suslov has joined #ruby
pawnbox has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
Suslo has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
Suslov has quit [Ping timeout: 260 seconds]
xenops has quit [Ping timeout: 240 seconds]
br0d1n has joined #ruby
baked__beans has quit [Ping timeout: 258 seconds]
BabyMario has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Suslo has quit [Ping timeout: 240 seconds]
ddrmanxbxfr has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
xenops has joined #ruby
bruce_lee has quit [Read error: Connection reset by peer]
bkxd has joined #ruby
polishdub has quit [Quit: Leaving]
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
rhyselsmore has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lenwood has quit [Quit: Konversation terminated!]
br0d1n has quit [Remote host closed the connection]
br0d1n has joined #ruby
szulak_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
gloscombe_ has joined #ruby
tomphp has joined #ruby
welfkarling has joined #ruby
tomphp has quit [Client Quit]
workmad3 has joined #ruby
rkazak_ has joined #ruby
ismann has joined #ruby
teddysmoker has quit [Remote host closed the connection]
br0d1n has quit [Ping timeout: 260 seconds]
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ismann has quit [Quit: Leaving]
AndBobsYourUncle has joined #ruby
JeanCarloMachado has joined #ruby
cdg has quit [Remote host closed the connection]
biberu has quit [Read error: Connection reset by peer]
rkazak_ has quit [Quit: Sleep.....ing....]
Milos|WebChat has joined #ruby
<Milos|WebChat> Anyone having SSL issues with https://rubygems.org
<Milos|WebChat> ?
<Cyrus> Nope, no issues.
mula has joined #ruby
mula has quit [Remote host closed the connection]
<Milos|WebChat> Well they just updated the cert today.
mula has joined #ruby
<Cyrus> It was valid starting on Feb 17, 2017.
patarr has joined #ruby
mula has quit [Read error: No route to host]
mula has joined #ruby
<Milos|WebChat> Sounds good - thanks!
Milos|WebChat has quit [Quit: Page closed]
a1fa has left #ruby [#ruby]
mula has quit [Remote host closed the connection]
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
patarr has quit [Ping timeout: 260 seconds]
ozcanesen has joined #ruby
tenderlove has quit [Ping timeout: 256 seconds]
tekniq has quit [Read error: Connection reset by peer]
eyeye has joined #ruby
tenderlove has joined #ruby
Snickers has quit [Ping timeout: 246 seconds]
saneax-_-|AFK is now known as saneax
esObe_ has quit [Remote host closed the connection]
esObe_ has joined #ruby
rkazak_ has joined #ruby
esObe_ has quit [Remote host closed the connection]
BackEndCoder has quit [Excess Flood]
esObe_ has joined #ruby
aspiers has joined #ruby
Lord_of_Life has quit [Excess Flood]
BackEndCoder has joined #ruby
outreachdan has joined #ruby
Lord_of_Life has joined #ruby
<outreachdan> Which error class does Net:HTTP raise when it gets `The IMAP server has too many simultaneous connections. Please try again later.` back from google?
welfkarling has quit [Ping timeout: 260 seconds]
esObe_ has quit [Ping timeout: 240 seconds]
<allisio> outreachdan: Shouldn't you know, having presumably just received that error?
<outreachdan> allisio Negative, I have a production env where the error class is rescued and wrapped in to another exception subclass.
<allisio> outreachdan: You can capture rescued Exceptions.
<outreachdan> Yes, but that's not the code running in production.
<outreachdan> part
outreachdan has left #ruby ["Textual IRC Client: www.textualapp.com"]
cschneid_ has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 240 seconds]
ozcanesen has quit [Ping timeout: 256 seconds]
pawnbox has joined #ruby
<dminuoso> ;o
elifoster has joined #ruby
pawnbox has quit [Ping timeout: 246 seconds]
matcouto has joined #ruby
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
noan_ has joined #ruby
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
TomyLobo has quit [Ping timeout: 264 seconds]
noan has quit [Ping timeout: 264 seconds]