ur5us has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Swyper has joined #ruby
pi__ has joined #ruby
pi__ has quit [Client Quit]
Pit has joined #ruby
Pit has quit [Client Quit]
_mossplix has quit [Remote host closed the connection]
ajunior_ has joined #ruby
weird_error has joined #ruby
troulouliou_divn has quit [Remote host closed the connection]
troulouliou_div2 has joined #ruby
Fridtjof has quit [Ping timeout: 245 seconds]
weird_error has quit [Quit: weird_error]
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
TomyWork has joined #ruby
Fridtjof has joined #ruby
AJA4350 has joined #ruby
ajunior_ has joined #ruby
ajunior_ has quit [Client Quit]
_mossplix has joined #ruby
ajunior_ has joined #ruby
DaniG2k has quit [Quit: leaving]
DTZUZO has joined #ruby
ajunior_ has quit [Client Quit]
ajunior_ has joined #ruby
ajunior_ has quit [Client Quit]
ajunior_ has joined #ruby
nahra has quit [Remote host closed the connection]
_mossplix has quit [Read error: Connection reset by peer]
yann-kaelig has joined #ruby
vondruch_ has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 276 seconds]
vondruch has quit [Ping timeout: 245 seconds]
vondruch_ is now known as vondruch
cyclonis has quit [Read error: Connection reset by peer]
grilix has joined #ruby
absolutejam4 has quit [Ping timeout: 265 seconds]
absolutejam4 has joined #ruby
DTZUZO has joined #ruby
banisterfiend has joined #ruby
fanta1 has quit [Ping timeout: 264 seconds]
grilix has quit [Read error: Connection reset by peer]
grilix_ has joined #ruby
jmcgnh has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 245 seconds]
iAmDecim has joined #ruby
cow[moo] has joined #ruby
dbz_ has joined #ruby
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cow[moo] has quit [Ping timeout: 265 seconds]
dbz_ has quit [Ping timeout: 240 seconds]
cyclonis_ has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
ramfjord has joined #ruby
drincruz has quit [Ping timeout: 245 seconds]
tdy1 has quit [Ping timeout: 265 seconds]
jmcgnh has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
Swyper has quit [Remote host closed the connection]
poontangmessiah has joined #ruby
stryek has joined #ruby
mossplix has joined #ruby
jmcgnh has quit [Ping timeout: 240 seconds]
jrafanie has joined #ruby
donofrio has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
mossplix_ has joined #ruby
jmcgnh has joined #ruby
mossplix_ has quit [Read error: Connection reset by peer]
mossplix_ has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
jmcgnh has quit [Excess Flood]
golevka6489 has joined #ruby
golevka has quit [Ping timeout: 264 seconds]
grilix_ has quit [Ping timeout: 250 seconds]
jmcgnh has joined #ruby
luminousnine has quit [Quit: Toodles]
luminousnine- has joined #ruby
luminousnine- has quit [Changing host]
luminousnine- has joined #ruby
cd has joined #ruby
mossplix_ has quit [Read error: Connection reset by peer]
dar123 has joined #ruby
mossplix has joined #ruby
<Bish>
is ruby dying? this channel was alot more active a while ago
<Bish>
fukin elixir! and all those hip languages!
<Corey[m]>
Bish, phaul: You could pass in a lambda that will enforce the arity
<Corey[m]>
&>> def foo; yield 1, 2, 3; end; foo(&lambda{|a| p a })
<rubydoc>
stderr: -e:4:in `block in <main>': wrong number of arguments (given 3, expected 1) (ArgumentError)... check link for more (https://carc.in/#/r/7qdb)
<Bish>
i used it, but i wonder why i never seen that
<Bish>
it's an odd name for a hash
<Corey[m]>
Well... I'm one of those elixir converts (prepares to get stoned to death)
<Bish>
bleh
<Bish>
gonna hear alot of elixir at the end of this motnh i again i suppose
cow[moo] has quit [Read error: Connection reset by peer]
<havenwood>
Bish: In 2.6, you can #to_h with a block:
<havenwood>
%i[id name].to_h { |k| [k, h[k]] }
<Bish>
hm, i don't know if that's better or rowse :o
<havenwood>
Bish: Different than #slice in that it'll give default args: {:id=>nil, :name=>nil}
<havenwood>
When neither key present: h.slice(:id, :name) #=> {}
<havenwood>
Bish: Saves a method call and intermediary Array.
<havenwood>
Just `to_h { }` instead of `map { }.to_h`.
<Bish>
Corey[m]: what is elixir good at anyways?
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
<Corey[m]>
Bish: It depends on what you want out of your language I suppose, binary pattern matching, immutable data, concurrency out of the box
<Corey[m]>
Can I stress binary pattern matching?
<Bish>
what is that exactly?
<Bish>
like ruby's a,b = [1,2] just everywhere?
<Corey[m]>
Let's say you have a ISO8601 timestamp, `2019-08-01T00:23:10Z`
<nisstyre>
I mean, Erlang has that too
<nisstyre>
:p
<Bish>
i mean haskell ONLY has that
<nisstyre>
Haskell does not have binary pattern matching
<nisstyre>
at least not out of the box
<Bish>
well, i don't know yet what exactly it is
<havenwood>
I didn't implement binary pattern matching >.> (that'd be fun), but here was my stab at Elixir stdlib in Ruby: https://github.com/havenwood/elixir.rb
<nisstyre>
you can use OverloadedStrings maybe
<Corey[m]>
nisstyre: P: really
<Bish>
how is that a cool feature?
<Bish>
i mean what can u use it for
<havenwood>
I'd like Stream.unfold/2 in Ruby.
<nisstyre>
Bish: writing network protocol parsers
<nisstyre>
image parsers
<nisstyre>
anything like that
<Corey[m]>
havenwood: I'd run back to ruby in a flash if it has binary pattern matching, believe me
<Bish>
yeah i do that everyday
<Corey[m]>
It made parsing heaven
<Corey[m]>
parsing in general
<Bish>
that's a weird thing to say
<nisstyre>
Erlang is really good at dealing with parsing binary streams
<Bish>
i bet you can write a DSL that does abstract that quite beautifully
<nisstyre>
so?
<nisstyre>
why go to the effort?
<Corey[m]>
nisstyre: And elixir is built atop BEAM and use erlang
<nisstyre>
yep
<Bish>
well, i never had the need, i was referring to the fact "he would come back if ruby had that"
<Corey[m]>
So I get the best of both worlds
<havenwood>
Corey[m]: I'm glad Matz is enjoying Elixir. I was glad to see a more usable, non-case pattern matching commit on trunk.
<Bish>
if i wrote parsers with ruby i always were happy with pack and stuff
<nisstyre>
you've probably never tried writing a parser with pattern matching and without
<nisstyre>
it ends up being a lot fewer lines with pattern matching
<Bish>
well, i also never write parsers
<nisstyre>
you probably do, you just don't call them that
<Bish>
i doubt it
<nisstyre>
how often do you split strings by a delimiter?
<havenwood>
Corey[m]: The new syntax is: if json in {foo:, bar:}
<nisstyre>
or break them up into tokens
* Bish
greps his job-project for split
<nisstyre>
how often do you shell out to the system for some command and use the output?
<Bish>
also never
<nisstyre>
clearly you've never had to do much automation then
<Bish>
well, how so?
<Bish>
i have docker for such tasks
<nisstyre>
docker is for containerization
<Bish>
yeah, but what task would i have to automate
<Bish>
in a usual web-app
<Corey[m]>
havenwood: Is json a hash in this case, and you can partially match against another hash, does foo and bar get stored into a local variable I can use inside the if block?
<nisstyre>
but not everyone writes just web apps, anyway it doesn't really matter
<havenwood>
Corey[m]: The syntax is experimental, so it might be yanked, and there are admittedly edge cases that could be problematic for this implementation. Still, I find it super enouraging.
<Bish>
i don't get why automation implies using external programs and pipes
chalkmonster has joined #ruby
<Bish>
and why that would imply i had to parse that output (with or without binary pattern matching)
Rapture has joined #ruby
dviola has joined #ruby
<nisstyre>
Bish: say you have a bunch of servers and you want to figure out how long they've been up. All you have is SSH access. How would you do that without calling `uptime` on them?
<Corey[m]>
havenwood: I'm just glad that ruby is still trying new things, even with all the "ruby is dying" going around
<Bish>
hm, i wrote a tool for that, or rather i am making in a tool for that
<bougyman>
nisstyre: well you messed up a long time ago if you don't already know uptime of those servers :)
<bougyman>
monitor much?
<Bish>
which one would you parse, /proc/self/auxv or the output of "uptime"
<Corey[m]>
havenwood: Interesting
<Bish>
i don't know, it sounds like regex with benefits
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Mia has quit [Read error: Connection reset by peer]
<Bish>
i suppose it's fast, tho
grilix_ has joined #ruby
<Corey[m]>
Bish: I'd find it easier to deal with auxv once I read the spec for the structure
DTZUZO_ has joined #ruby
<Bish>
well, but you find a "c struct to ruby parser" thingie for sure, why would you go the hazzle to write it
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Rapture_ has joined #ruby
<Corey[m]>
Bish: personally I enjoy the challenge of parsing a binary format, not sure anyone else would
Rapture has quit [Ping timeout: 264 seconds]
jmcgnh has quit [Ping timeout: 265 seconds]
<Bish>
well, if it's a simple struct, a binary pattern matching whatever thing is not really helpful
DTZUZO has quit [Ping timeout: 264 seconds]
<bougyman>
Binary parsers are fun and all, but it's been a small minority of parsing over the years.
<bougyman>
MOst is far more simple.
<bougyman>
while read up idle; do echo $((up/60)) seconds; done < /proc/uptime
<bougyman>
2119.3218333333334 seconds
<bougyman>
and such.
bogn has joined #ruby
<Bish>
datpatternmatch.png
<Corey[m]>
touche`
jeremycw has joined #ruby
<nisstyre>
bougyman: just an example
<nisstyre>
it could be anything, like getting versions of packages off of it
<nisstyre>
pre-existing tools don't always exist that do exactly what you want
<Corey[m]>
In my case it's dealing with SMPP
<bougyman>
Other than wire protocols, the most common reason for me to want a pattern matching parser has been for syntax highlighting I think, heh.
<nisstyre>
writing anything using recursion becomes much easier with pattern matching
<bougyman>
It's lovely for wire protocols, for certain.
chalkmonster has quit [Quit: WeeChat 2.6]
<nisstyre>
and actor-model style programs that do different things depending on the messages sent to a method
<bougyman>
But I've always used LISP for those.
<bougyman>
cause it's better than * at recursion, pattern matching, and templating.
<nisstyre>
yes, I use Racket for that
<nisstyre>
I'm not arguing that Ruby is better than Racket there
<bougyman>
Racket is a hipster lisp variant, is it?
jmcgnh has joined #ruby
<nisstyre>
just pointing out use cases for it
<nisstyre>
Scheme
<bougyman>
Right.
Intelo has quit [Remote host closed the connection]
<havenwood>
"If you ... do like the concept of LISP, but don't like too many parentheses, Ruby might be your language of choice."
<havenwood>
Straight from the Ruby manpage.
<havenwood>
I thought CHICKEN scheme was the hipster LISP? Or is that Ruby? :P
SeepingN has joined #ruby
<nisstyre>
yeah Racket is the snooty academic lisp
<nisstyre>
Guile is the free software neckbeard lisp
conta1 has quit [Ping timeout: 240 seconds]
<nisstyre>
Chicken/Gambit/etc are the ones nobody uses
<bougyman>
eh, I'm on the CL side of things.
<nisstyre>
MIT Scheme is the one from those funny videos
<bougyman>
I'm too spoiled by CLoS
ravenousmoose has quit [Ping timeout: 252 seconds]
* Corey[m]
scoots away from the lisp crowd
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 265 seconds]
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
freedom has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
greengriminal has quit [Quit: This computer has gone to sleep]
KeyJoo has quit [Quit: KeyJoo]
schne1der has joined #ruby
brool has joined #ruby
greengriminal has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
RiPuk has quit [Ping timeout: 240 seconds]
mossplix has quit [Ping timeout: 240 seconds]
absolutejam4 has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
jmcgnh has quit [Ping timeout: 252 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has quit [Ping timeout: 240 seconds]
Inline has joined #ruby
jmcgnh has joined #ruby
wildtrees has joined #ruby
kilic has joined #ruby
<kilic>
Hello
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
andikr has quit [Remote host closed the connection]
Swyper has joined #ruby
cthulchu_ has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
dviola has quit [Quit: WeeChat 2.6]
Swyper has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
sgen has joined #ruby
kilic has quit [Ping timeout: 265 seconds]
dar123 has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
Ai9zO5AP has joined #ruby
Guest47 has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 246 seconds]
Guest47 has left #ruby [#ruby]
yann-kaelig has quit [Quit: yann-kaelig]
Swyper has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 268 seconds]
yokel has joined #ruby
kilic has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
<brool>
i'm trying to nest one sinatra app in a subfolder of another. so in config.ru i have map '/' run my main website app, and map '/hangman' runs a hangman app located in /my/website/hangman. i have public & view dirs in /hangman such as /hangman/public etc. now when i go to localhost/hangman i get the view, but none of the javascript is loading, which are in ./hangman/public, and i can't find a setting in the
<brool>
sinatra app that will make them load
orbyt_ has joined #ruby
<brool>
oh nevermind i had to change my URIs in the view to prepend /hangman/
iAmDecim has joined #ruby
brendan- has joined #ruby
cthulchu has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
fphilipe has joined #ruby
Rapture_ has quit [Ping timeout: 240 seconds]
jacksoow has quit [Ping timeout: 264 seconds]
jacksoow has joined #ruby
ramfjord has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 240 seconds]
davor_ is now known as davor
kilic1 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
jud has quit [Ping timeout: 240 seconds]
Mia has quit [Read error: Connection reset by peer]
hays_ has quit [Remote host closed the connection]
hays_ has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
bambanx has joined #ruby
gix has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has quit [Ping timeout: 245 seconds]
rippa has joined #ruby
Tempesta has quit [Quit: AdiIRC is updating to v3.6 Beta Build (2019/10/07 UTC) 64 Bit]
Tempesta has joined #ruby
ellcs has joined #ruby
sgen has quit [Ping timeout: 250 seconds]
absolutejam4 has joined #ruby
Intelo has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
hays_ has quit [Remote host closed the connection]
hays_ has joined #ruby
postmodern has joined #ruby
bogn has quit [Ping timeout: 265 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 252 seconds]
Mia has quit [Read error: Connection reset by peer]
hightower2 has joined #ruby
hiroaki_ has quit [Ping timeout: 252 seconds]
drincruz has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
Intelo has quit [Ping timeout: 246 seconds]
iAmDecim has joined #ruby
Intelo has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
iAmDecim has joined #ruby
gigetoo has quit [Ping timeout: 276 seconds]
Tinto_Brass has joined #ruby
Fernando-Basso has joined #ruby
CableNinja_ has joined #ruby
gigetoo has joined #ruby
ur5us has joined #ruby
<CableNinja_>
hey all, I'm reading a file from a site as JSON, in some of the nodes is a path, but I want to create that path so that its a ruby variable in the json, and then parsed when I read it in. EX JSON: { "target": "#{baseDir}/path/" }
<CableNinja_>
right now it just reads is exactly as that, and then I end up with the final string being "#{baseDir}/path/myfile"
<CableNinja_>
(literal, unparsed #{baseDir})
<CableNinja_>
running eval against the string's variable doesnt seem to work (EX: eval(filePath) )
fphilipe has quit [Ping timeout: 268 seconds]
<havenwood>
CableNinja_: Is baseDir a local variable or a method?
<havenwood>
CableNinja_: Ruby convention would be camel_case for either, no headlessCamelCase in Ruby.
<havenwood>
CableNinja_: What doesn't work about evaling?
<CableNinja_>
baseDir is a local var
<CableNinja_>
hold on I'll paste code
schne1der has quit [Ping timeout: 276 seconds]
ramfjord has joined #ruby
<adam12>
CableNinja_: Not to sidetrack you too much, but I'd probably look at using sprintf/format instead of eval. You could then do something like `"target": "%<basedir>s/path/"` and format it with `format(target, { basedir: basedir, moreStuff: here })`. Less risk and more control.
<adam12>
havenwood: I think using sprintf cripples the self-expanatory name of it, since it has the nice bits about supporting named arguments. If it was a dumb wrapper about sprintf in C then I'd argue that format is a horrible name :P
<havenwood>
adam12: and either is less confusing than %
<adam12>
havenwood: Tho both are better IMHO than String#% when it comes to explainging to newcomers what it is.
<adam12>
lol
<havenwood>
agreed
<adam12>
It's already a challenge explaining where some things come from (ala Kernel)
<adam12>
CableNinja_: I still recommend String#format, but just for clarity, you're example would of worked with a second wrapping of quotes. You created a string but instance eval would of expected a string of Ruby code (a string with a string).
<rubydoc>
stderr: (eval):1:in `<main>': undefined local variable or method `baseDir' for main:Object (NameError)... check link for more (https://carc.in/#/r/7qok)
<adam12>
Eh you get the idea.
nowhere_man has joined #ruby
SCHAPiE has joined #ruby
<CableNinja_>
adam12, your suggestion worked for format(), thanks
<CableNinja_>
eval is a crazy piece of work I try to avoid at all costs, but I couldnt think of a better way of doin it, heh