<apeiros>
one reason being that the correctness depends on server settings communicated during connecting to the server
<vutral|kali>
apeiros, ?
<vutral|kali>
what do you mean
<apeiros>
[\w|\#] <-- in a character class, the | is a literal pipe, not an "or"
<apeiros>
[ab] already is "a" or "b"
<dminuoso>
vutral|kali: So you allow for a##aaa# as a channel name
<apeiros>
and [a|b] is "a", "b" or "|"
<vutral|kali>
i know its not perfect
<dminuoso>
vutral|kali: No its not just "not perfect" its just "wrong"
<apeiros>
vutral|kali: I mean that irc messages only seem simple. they are not.
<vutral|kali>
apeiros, i still can match channels for correctness later
<dminuoso>
vutral|kali: Wrong regular expressions mean you accept wrong input. Accepting wrong input means your program has a good basis for misbehaving.
<dminuoso>
vutral|kali: Either you intend to pattern match, then do it right, or dont do it at all and just split on whitespace.
<apeiros>
vutral|kali: channelnames are actually one thing where you can't use a generic expression, as max channel name length is one of the things communicated when you first connect
<apeiros>
also iirc valid channelname prefixes
<apeiros>
let me see whether I find my set of expressions…
<dminuoso>
apeiros: In all fairness it's not inherently wrong to separate tokenization and semantic checking
claudiuinberlin has joined #ruby
<apeiros>
dminuoso: yeah, sure, but then not even # would be a part
<vutral|kali>
thats correct
<vutral|kali>
its a nick sometimes not a channel
<apeiros>
as in, your "allow for a##aaa#" would be part of semantic checking too
<apeiros>
fun fact: freenode sometimes has users with invalid nicknames (in case of collisions, their ircd sometimes uses invalid replacement nicks)
<dminuoso>
vutral|kali: So just do something along the lines of /(?<source>\w+) PRIVMSG (?<target>\w+) (?<message>\w+)/
<apeiros>
that seems to be doable with plain regex in ruby? as they're perfectly composable.
<dminuoso>
apeiros: not exactly
<apeiros>
an example of what doesn't work?
<dminuoso>
apeiros: You could do something like..
<dminuoso>
apeiros: `token p = p <* spaces`
<apeiros>
yeah, in words, not in cryptic
<apeiros>
I can't know what '<*' means in that context.
<dminuoso>
apeiros: sec
<apeiros>
but yeah, recursive is difficult / requires creativity :D
<dminuoso>
apeiros: So lets say you have a regex that knows how to extract an "identifier", and you have a regex that knows how to extract spaces - how do you combine them into a regex that extracts an identifier _and_ spaces, but disregards the spaces?
<apeiros>
/#{spaces}(#{identifier})#{spaces}/
<apeiros>
if by extract you mean "advances the cursor"
<dminuoso>
apeiros: Except that just matches - but doesn't build.
<dminuoso>
apeiros: It doesnt produce results
<apeiros>
um, yes? of course?
<apeiros>
a regex never will produce results on its own. so kinda stating the obvious?
<dminuoso>
apeiros: That's my point. ;-)
<apeiros>
neither will a parser?
<dminuoso>
apeiros: parser combinators do
<apeiros>
you have to "use" it at some point
TvL2386_ has quit [Quit: leaving]
<dminuoso>
apeiros: That's the thing, you can talk about results without having to use it
<apeiros>
o0
<dminuoso>
let me show you how it would look in ruby
TvL2386 has joined #ruby
ta_ has quit [Remote host closed the connection]
ta_ has joined #ruby
guille-moe has joined #ruby
amatas has joined #ruby
ta_ has quit [Ping timeout: 276 seconds]
ta_ has joined #ruby
beauby has joined #ruby
gregf_ has quit [Ping timeout: 260 seconds]
maum has quit [Remote host closed the connection]
cdg has joined #ruby
hahuang65 has quit [Ping timeout: 276 seconds]
Matthew1 has quit [Ping timeout: 264 seconds]
cdg_ has joined #ruby
Guest56947 has quit [Ping timeout: 240 seconds]
ams__ has joined #ruby
cdg has quit [Ping timeout: 255 seconds]
cdg_ has quit [Ping timeout: 240 seconds]
ta_ has quit [Remote host closed the connection]
ta_ has joined #ruby
aupadhye has quit [Quit: Leaving]
aupadhye has joined #ruby
n13z has joined #ruby
ta_ has quit [Ping timeout: 255 seconds]
gary has joined #ruby
gary is now known as Guest56907
gregf_ has joined #ruby
Guest56907 has quit [Ping timeout: 240 seconds]
gary_ has joined #ruby
gary_ is now known as Guest31891
<dminuoso>
apeiros: Haha. I need to think about how to do mutual recursion in Ruby.
<dminuoso>
Im missing the most crucial combinator
alfiemax has quit [Remote host closed the connection]
ta_ has joined #ruby
Guest31891 has quit [Ping timeout: 248 seconds]
alfiemax has joined #ruby
<apeiros>
more complex than expected? :)
<dminuoso>
apeiros: well let me show you what I have already
<arne_>
and they use websockets alot and abstracted over it?
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<havenwood>
arne_: WebSockets are an optional transport, but I don't think they're actually favored. I can't recall where I found it, but there's an interesting piece where Sam discusses why.
<havenwood>
arne_: Elixir with Phoenix Channels starts to look appealing at some point. ;-)
<arne_>
context is that i am writing my own framework, which i am happy with, and i'd like a SPA-app that only communicates with ruby over websockets with normal-http as fallback
<arne_>
and optional usage of http
<havenwood>
arne_: HTTP/2 is nice.
<havenwood>
I like that Phoenix supports H2 now. Cowboy 2 ftw.
<arne_>
i never looked at elixir
<havenwood>
it's quite nice
<havenwood>
arne_: I'm waiting for someone to make a nice Ruby framework using the http-2 gem - speaking of quite nice: https://github.com/igrigorik/http-2
gary_ has joined #ruby
<arne_>
yeah last time i aked the exact same question in there
<arne_>
i was brought to http-2, too
gary_ is now known as Guest24546
<arne_>
do you think, if you wrote an app with that, you would get a problem with incompatible clients
mikeiniowa has quit [Remote host closed the connection]
<havenwood>
arne_: Basically everything would be different, and that's the problem. Rack is built for request/response.
<havenwood>
HTTP/2 the request/response is always streaming--persistent, message-oriented and bi-directional.
<arne_>
sounds like exactly what i would love about a webframework
mikeiniowa has joined #ruby
<arne_>
always message-oriented? but.. would a answer to a request not still be a reponse?
<arne_>
what's the problem, i don.t follow
<workmad3>
arne_: it's a response, but the response doesn't have a fixed end knowable in advance
<arne_>
that's od
<arne_>
and that's required for rack?
<havenwood>
arne_: You can't handle H2 with Rack's expected inputs and outputs. They can change Rack to support H2, but it'd break all the existing apps that expect the Rack spec.
<workmad3>
arne_: no, that's the change that http2 made (and websockets)
<arne_>
that's also the reason streaming isn't default in rack, i get it
<arne_>
workmad3: are websockets still needed considering the asynchron nature of http2?
<havenwood>
andersh: no
<workmad3>
arne_: depends on who you ask
<havenwood>
oops, MT
<arne_>
workmad3: if i ask someone who says websockets are still needed, why?
<arne_>
is the http2 gem a server already, or just a protocol implementation?
<workmad3>
arne_: if you ask someone with a lot of deep knowledge who thinks they're still needed, you'll probably get a lot of technical details that goes into the weeds about why websockets are better or how http2 messed up X, Y or Z
<arne_>
i will play around with it, thanks alot, http2 might be want i want
gary__ has joined #ruby
<arne_>
the http-2 gem looks weird
<arne_>
is ruby really good at stuff like stream.on(:event_name)
<arne_>
i mean, is ruby performing well in those asynchron-style code?
<workmad3>
but yeah, I'd mostly go with http2 nowadays if you're not tying yourself to an existing framework that only supports http1 + websockets
<arne_>
there is no full featured http2 server for ruby i guess?
sundhell_away is now known as sundhell
clemens3 has joined #ruby
<arne_>
evented ruby code looks weird
<havenwood>
arne_: Someone was working on one based off the http-2 gem. I haven't seen it lately.
dionysus69 has joined #ruby
synthroid has joined #ruby
<havenwood>
arne_: The Elixir/Phoenix folk are well ahead on that front. There are lots of opportunities in Ruby to blaze the trail related to H2.
surrounder has left #ruby ["WeeChat 2.0.1"]
<arne_>
i am not willing to learn a language that looks like ruby but isn't, would really confuse me
shinnya has quit [Ping timeout: 256 seconds]
<havenwood>
arne_: Elixir doesn't really look like Ruby.
<havenwood>
arne_: Okay, I see what you mean. But I don't get confused.
<workmad3>
arne_: you should probably get used to it if you're going to have a career in software development... you'll end up going through lots of languages that look like other languages but aren't
<dminuoso>
arne_: It does not look like ruby.
<arne_>
workmad3: im programming quite a while now, it's more like a "i don't want to"
<arne_>
than a "i can't
<dminuoso>
Like almost every language on this planet they merely took some syntax inspiration.
<dminuoso>
If elixir looks like ruby, your ruby code is non-idiomatic.
<arne_>
havenwood: okay fine :D i look at elixir
<workmad3>
I need to get back to learning elixir and phoenix... keep on getting started on that route and getting distracted
<arne_>
if i read this, i already lost motivation
jenrzzz has quit [Ping timeout: 240 seconds]
<arne_>
redirect(conn, to: article_path(conn, :index))
<arne_>
i want it like roda does it or not at all
<havenwood>
arne_: In Elixir land, Plug is similar to Ruby's Rack.
<havenwood>
arne_: You can make a pure Plug app.
<dminuoso>
My main beef with Elixir is just the heavy use of macros.
<havenwood>
arne_: But it turns out, Phoenix isn't much on top of plug. it's nice conventions.
<havenwood>
dminuoso: Phoenix uses a ton of macros...
<dminuoso>
havenwood: It's not similar. It's 10 times better.
<dminuoso>
Writing efficient Rack middlewares is a PITA.
<havenwood>
<3 Plug
<dminuoso>
They are mindtwisting.
<dminuoso>
:)
<arne_>
i'd love to write stuff in haskell but i am still to stoopid :(
conta has quit [Read error: Connection reset by peer]
<arne_>
but i am confident i could write something good in/for ruby
gary__ has joined #ruby
conta has joined #ruby
Serpent has joined #ruby
Serpent7776 has quit [Ping timeout: 252 seconds]
Serpent is now known as Serpent7776
portage is now known as minimalism
gary__ has quit [Ping timeout: 256 seconds]
<havenwood>
dminuoso: monadic parser combinators in... on my
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
mtkd has quit []
dinfuehr has quit [Ping timeout: 248 seconds]
mtkd has joined #ruby
dinfuehr has joined #ruby
k0mpa has quit [Remote host closed the connection]
drewmcmillan has joined #ruby
drewmcmillan has quit [Ping timeout: 255 seconds]
gary has joined #ruby
gary is now known as Guest59550
drewmcmillan has joined #ruby
Guest59550 has quit [Ping timeout: 260 seconds]
Puffball has joined #ruby
memo1 has joined #ruby
marr has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
AJA4350 has quit [Quit: AJA4350]
dalitom has joined #ruby
<memo1>
Hi, in the following expression, what is the meaning of ".." if day == :mon .. day == :tues
lxsameer has quit [Quit: WeeChat 1.9.1]
<dalitom>
hey guys.. please help!! So I have class1.rb amd class2.rb files, I want to use class2 functions in class1 so in class 2 I do require 'class1', right ?
<havenwood>
memo1: look up flipflop operator
<dalitom>
So now I do not know how to use it in class2, :/
<dalitom>
please help
Puffball has quit [Quit: Puffball]
jenrzzz has joined #ruby
Puffball has joined #ruby
jcalla has joined #ruby
<dminuoso>
dalitom: Top level functions are scoped to files.
<dminuoso>
dalitom: The regular solution is to place them into the singleton class of a module if you just want to have "plain" functions.
<dalitom>
right I just want to use some function from class1
<dminuoso>
You can require the other file, and then refer to `Foo` to access that module.
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dalitom>
Thank you guys
<dalitom>
!!
gary_ has joined #ruby
troys has joined #ruby
gary_ is now known as Guest32334
<memo1>
havenwood: ok, thank you
Guest32334 has quit [Ping timeout: 240 seconds]
ineb has quit [Ping timeout: 240 seconds]
ineb has joined #ruby
memo1 has quit [Ping timeout: 256 seconds]
jcalla has joined #ruby
DLSteve_ has joined #ruby
za1b1tsu has joined #ruby
clemens3 has quit [Ping timeout: 240 seconds]
ta_ has quit [Remote host closed the connection]
ta_ has joined #ruby
memo1 has joined #ruby
sundhell is now known as sundhell_away
ta_ has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
alex`` has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
setchp has joined #ruby
setchp has left #ruby [#ruby]
Cavallari1 has joined #ruby
synthroid has quit [Remote host closed the connection]
synthroid has joined #ruby
lxsameer has joined #ruby
Cavallari has quit [Ping timeout: 240 seconds]
Cavallari1 has quit [Ping timeout: 248 seconds]
alex``` has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
memo1 has quit [Ping timeout: 256 seconds]
nadir has quit [Quit: Connection closed for inactivity]
tvw has quit [Ping timeout: 256 seconds]
lavamind has left #ruby [#ruby]
marr has joined #ruby
gary has joined #ruby
Rapture has joined #ruby
gary is now known as Guest7366
Guest7366 has quit [Ping timeout: 252 seconds]
dionysus69 has joined #ruby
Mike11 has joined #ruby
delaz has joined #ruby
jnollette_ has quit [Remote host closed the connection]
delaz has left #ruby [#ruby]
delaz has joined #ruby
jnollette has joined #ruby
Gnut has joined #ruby
mostlybadfly has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
GeorgesLeYeti has joined #ruby
<GeorgesLeYeti>
Hi
InfinityFye has joined #ruby
<havenwood>
GeorgesLeYeti: hi
<GeorgesLeYeti>
It is possible to associate values in array to variable. Like [a, b] = [1, 2] => a = 1 and b = 2
despai has joined #ruby
<workmad3>
GeorgesLeYeti: you can do `a, b = [1,2]
schneide_ has quit [Remote host closed the connection]
<GeorgesLeYeti>
Ho ok
<GeorgesLeYeti>
Ty :D
<workmad3>
GeorgesLeYeti: and if you want to catch 'all the rest', you can use a *... e.g. `a,b,*c = [1,2,3,4,5]` will assign [3,4,5] to c
<GeorgesLeYeti>
Perfect ty a lot workmad3
memo1 has joined #ruby
schneide_ has joined #ruby
Silthias has joined #ruby
gary_ has joined #ruby
aufi has quit [Quit: Leaving]
gary_ is now known as Guest10835
Mia has quit [Remote host closed the connection]
kapil___ has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
nowhereman_ has joined #ruby
snath has quit [Ping timeout: 240 seconds]
memo1 has quit [Ping timeout: 240 seconds]
TomyWork has joined #ruby
Guest10835 has quit [Ping timeout: 256 seconds]
anisha has quit [Quit: This computer has gone to sleep]
apparition has quit [Quit: Bye]
mtkd has quit [Ping timeout: 252 seconds]
gary has joined #ruby
za1b1tsu has quit [Quit: Leaving]
gary is now known as Guest90575
mtkd has joined #ruby
sgen has joined #ruby
clemens3 has joined #ruby
sgen has quit [Client Quit]
Guest90575 has quit [Ping timeout: 255 seconds]
<apeiros>
GeorgesLeYeti: a,b = 1,2 # works fine too
memo1 has joined #ruby
sgen has joined #ruby
haylon has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 248 seconds]
rippa has joined #ruby
Silthias1 has joined #ruby
Silthias1 has left #ruby [#ruby]
Silthias has quit [Ping timeout: 276 seconds]
chocoelho has quit [Ping timeout: 255 seconds]
Silthias has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
zacts has quit [Quit: WeeChat 1.9.1]
zacts has joined #ruby
<kspencer>
I'm seeing alot of varied information about this, but if I want to write tests, what is it I should be doing in terms of gem files and vcs files, from what I read I should have a source_code_uri metadata entry, spec.files should exclude test-like directories, and I should be pushing tests to a vcs, but just the gem library itself + needed other files like Gemfile, LICENSE to rubygems.org or other gemcutter-compatible gem repository
reber has joined #ruby
vondruch has quit [Quit: vondruch]
synthroid has quit [Remote host closed the connection]
synthroid has joined #ruby
<havenwood>
kspencer: it sounds like you're on the right track. can you show code or do you have any more specific questions?
<apeiros>
kspencer: into the repository belongs everything necessary to develop/work on the gem (except for credentials, like usernames/passwords/tokens)
synthroid has quit [Ping timeout: 256 seconds]
<apeiros>
kspencer: into the .gem file (which you build via `gem build your.gemspec` or potentially indirectly since you use gemcutter) belongs everything necessary to use the gem (again, except config/credentials)
<apeiros>
(there is an argument to be made to include the tests into the .gem file, though)
<kspencer>
well, I've also been looking, and my gem is a thor + highline CLI app, and I've also been wondering what the best course of action is with making tests, I see many different ways, although I'm currently trying out is https://github.com/dergachev/rspec-tutorial/tree/master/spec
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kspencer>
aka 'test files should not be installed'
<apeiros>
that's a *shrug* issue IMO :D
<apeiros>
I mean the only downside this "bug" has is that you load a ridiculously small amount of additional data to the users drives
<kspencer>
I've not seen many minitest with cli's though so I can't say I'd have any luck with that out of the box
<apeiros>
(unless you have massive fixture data)
<apeiros>
eh?
<kspencer>
I don't see many cli's with minitest testing, unless I'm looking in the wrong place
<apeiros>
is your cli interactive? if not, then a well built cli is just an adapter to your library anyway.
<apeiros>
so the distinction library/cli-app is largely meaningless
mtkd has quit []
<apeiros>
I think the cli<->lib connection is one of the rare cases where I'd do a whitebox test (ensure e.g. `foo bar` invokes `Foo::Cli.run(["bar"])`) and then rely on the unit tests for the lib.
<kspencer>
My code may be a mess, but if I could properly make that distinction, I'll send you the gh repo if that's alright? apeiros
gary_ has joined #ruby
gary_ is now known as Guest12268
<apeiros>
kspencer: sure, feel free to paste the repo url in the channel
<apeiros>
I'm not sure I'll get around to look at it today, though
<apeiros>
seems to me like you can just write unit tests
Guest12268 has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
halt has joined #ruby
<workmad3>
apeiros: even if it is interactive, a well written CLI should be testable... make sure you're accepting an input source rather than hard-coding $stdin, and then you can test by passing in appropriate inputs as StringIO objects
<apeiros>
workmad3: absolutely
halt is now known as Guest16299
<workmad3>
but yeah, I'll typically take the actual bin-script as a 'too obvious to need a test' type thing, as it'll usually be a single invocation of a class passing in stdin, stdout and ARGV when I write them...
<apeiros>
workmad3: I was more getting at "if you know unit testing, then you can unit test a CLI app without additional knowledge". but I guess that was actually somewhat pointless since you'll want to test the output anyway, no matter how well you separated the concerns.
<kspencer>
workmad3: Thor (the gem I'm using for the #start method) allows you to create an instance of your 'App' without running it using #new, as #start will run everything
<workmad3>
yeah, I'll pass in a StringIO for output too :)
<kspencer>
so how should I go about creating a test for say the outputs or should I test for status on some and regex and success on others
<workmad3>
(also, annoyingly, it seems from that page that Thor doesn't allow you to inject stdin or stdout for other environments... I've not noticed that before as when I use Thor I tend to treat the steps as close to rake tasks, so I'll keep them single line and move the actual behaviour into testable objects, etc)
apeiros has quit []
chocoelho has joined #ruby
sgen has quit [Remote host closed the connection]
vdl has joined #ruby
aguestuser has quit [Remote host closed the connection]
gary__ has joined #ruby
aguestuser has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
<kspencer>
I'll see what I can do with this but I'm not too sure how to go from here
synthroid has joined #ruby
jeffreylevesque has joined #ruby
Silthias has left #ruby [#ruby]
conta has quit [Ping timeout: 256 seconds]
mtkd has quit []
jenrzzz has joined #ruby
drewmcmillan has joined #ruby
Gnut has quit [Ping timeout: 268 seconds]
jaruga has quit [Quit: jaruga]
gary__ has quit [Ping timeout: 260 seconds]
GeorgesLeYeti has quit [Quit: Leaving]
schneide_ has quit [Remote host closed the connection]
despai has quit [Quit: ...]
memo1 has quit [Ping timeout: 255 seconds]
gary has joined #ruby
QCF has joined #ruby
gary is now known as Guest50254
Chuguniy has quit [Read error: Connection reset by peer]
schneide_ has joined #ruby
Chuguniy has joined #ruby
schneide_ has quit [Read error: Connection reset by peer]
regedit_ has joined #ruby
Guest50254 has quit [Ping timeout: 248 seconds]
mcr1 has quit [Ping timeout: 265 seconds]
aufi has joined #ruby
regedit_ is now known as regedit
gary_ has joined #ruby
gary_ is now known as Guest46703
elcontrastador has joined #ruby
QCF is now known as ecnelises
memo1 has joined #ruby
Guest46703 has quit [Ping timeout: 240 seconds]
despai has joined #ruby
gary__ has joined #ruby
snath has joined #ruby
andikr has quit [Remote host closed the connection]
apeiros_ has joined #ruby
ecnelises has quit []
Mike11 has quit [Quit: Leaving.]
Chuguniy has quit [Quit: Leaving]
troys has quit [Read error: Connection reset by peer]
gary__ has quit [Ping timeout: 252 seconds]
mtkd has joined #ruby
gary__ has joined #ruby
troys has joined #ruby
alfiemax has joined #ruby
Azure has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
despai has quit [Quit: ...]
gary__ has quit [Ping timeout: 248 seconds]
herbmillerjr has quit [Quit: Konversation terminated!]
mostlybadfly has quit [Quit: Connection closed for inactivity]
karapetyan has joined #ruby
karapetyan has quit [Client Quit]
<dminuoso>
The obvious solution: cons = -> (e, a) { [e, *a] }; some = -> v { v.fmap(cons).ap(many[v]) }; many = -> v { some v | pure([]) } kind of blows up any call stack in existence.
hoylemd has joined #ruby
kapil___ has quit [Ping timeout: 255 seconds]
kapil___ has joined #ruby
hoylemd has quit [Client Quit]
n008f4g_ has joined #ruby
hoylemd has joined #ruby
conta has joined #ruby
hoylemd has quit [Client Quit]
n0m4d1c has joined #ruby
RougeR has quit [Ping timeout: 260 seconds]
jaruga has joined #ruby
hoylemd has joined #ruby
alfiemax has quit [Remote host closed the connection]
conta has quit [Remote host closed the connection]
jaruga has quit [Quit: jaruga]
PaulCapestany has quit [Quit: .]
hahuang65 has joined #ruby
memo1 has quit [Ping timeout: 252 seconds]
gary has joined #ruby
gary is now known as Guest57458
mcr1 has quit [Ping timeout: 276 seconds]
n008f4g_ has quit [Ping timeout: 240 seconds]
PaulCapestany has joined #ruby
zkv has quit [Ping timeout: 265 seconds]
hahuang65 has quit [Ping timeout: 260 seconds]
Guest57458 has quit [Ping timeout: 240 seconds]
Psybur_ has joined #ruby
ledestin has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
dionysus69 has quit [Remote host closed the connection]
_aeris_ has quit [Ping timeout: 255 seconds]
RougeR has joined #ruby
<leitz>
Have things really gone quiet?
jnollette has quit [Ping timeout: 255 seconds]
alfiemax has joined #ruby
<apeiros_>
sssshhh
* leitz
's head makes a loud popping sound as it explodes. He was trying to comprehend block to proc conversion.
_aeris_ has joined #ruby
TomyWork has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
hahuang65 has joined #ruby
rexan has joined #ruby
<raynold>
Ahh it's a wonderful day
levifig has joined #ruby
<dminuoso>
leitz: blocks are procs are lambdas
<dminuoso>
leitz: They only differ in subtle, annoying but largely irrelevant semantics.
mcr1 has joined #ruby
jnollette has joined #ruby
claudiuinberlin has joined #ruby
gary_ has joined #ruby
gary_ is now known as Guest71663
jenrzzz has quit [Ping timeout: 256 seconds]
<leitz>
dminuoso, I'm still newbie enough to get confused by it. I think this is the third time I've read this chapter and am still grokking "yield".
rexan has quit [Ping timeout: 256 seconds]
Guest71663 has quit [Ping timeout: 276 seconds]
sumobob has joined #ruby
<sumobob>
can anyone think of a better way to do something like this? Module::Client.new.get_all.map(&method(:new))
mkroman has quit [Quit: Reconnecting]
mkroman has joined #ruby
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
sumobob: What is that supposed to do?
<dminuoso>
And what are you trying to do?
<sumobob>
all those models inherit from faraday middleware
<sumobob>
it fetches data from external, and saves it
xenops has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<jamesaxl>
hi ruby
quobo has joined #ruby
InfinityFye has quit [Quit: Leaving]
<havenwood>
jamesaxl: hi
gary__ has joined #ruby
<dminuoso>
leitz: Is the notion of passing functions as values strange to you?
<dminuoso>
leitz: like passing callbacks to functions.
<leitz>
dminuoso, not strange as in "bad", just getting my head around it. Ruby makes it easier in a way, since everything is an object.
<dminuoso>
leitz: Except that's the thing about blocks.
<leitz>
I just read about "send".
jenrzzz has quit [Ping timeout: 240 seconds]
<dminuoso>
leitz: A block is basically a proc.. except without the object shell.
<dminuoso>
leitz: And because it's not an object, you cant ever see it directly.
<dminuoso>
But Ruby gives you primitives to somehow use these "invisible" functions. `yield` is basically Proc#call =)
<leitz>
dminuoso, hence using the "&" for conversion?
<dminuoso>
leitz: Right. & turns either a block into a proc or vice versa.
mtkd has quit []
<dminuoso>
leitz: it simply just reifies or strips the object shell.
<dminuoso>
def foo(&m) basically means "take the hidden parameter, put it inside an object and name it `m`"
<dminuoso>
And when I say object I mean Proc.
gary__ has quit [Ping timeout: 240 seconds]
<dminuoso>
And likewise foo(&f) means "take the proc f, throw the Object shell away, and pass it as a block"
<leitz>
The book actually explained that bit well. I'm not sure I have it memorized yet, but it gave a pretty simple explination similar to yours.
<leitz>
I'm on chapter 3, after 3 weeks. :P
<type1team>
Do you know if Jekyll has any channels?
n0m4d1c_ has joined #ruby
<dminuoso>
leitz: Basically if blocks throw you off, just rewrite into lambdas.
* leitz
is more comfortable with blocks.
<dminuoso>
leitz: The main quirky thing is just that visually it does not look like a block is a real parameter, although it kind of is - but it doesn't appear inside params.
<dminuoso>
leitz: The reason we have this quirky block syntax that actually just passes another argument has two roots: a) it tends to be a bit cleaner for DSLs and b) its a miniscule performance optimization because no object creation is involved
<dminuoso>
I rarely write blocks anymore because they hamper the reading flow
mtkd has joined #ruby
<leitz>
The quirkiness doesn't bother me in its existance, just takes me a bit to learn. I mis-stated above; went back to redo chapter 2 because I didn't really get it. Procs and lambdas are in chapter 3. :)
<dminuoso>
leitz: If it was up to me I'd throw away Procs. =P
<leitz>
I have this mental fantasy of getting a job as a coder one day. Will have to understand other people's code. :/
n0m4d1c has quit [Ping timeout: 256 seconds]
gary has joined #ruby
amatas_ has quit [Remote host closed the connection]
ta_ has joined #ruby
gary is now known as Guest7301
sumobob has quit [Read error: Connection reset by peer]
sumobob has joined #ruby
Guest7301 has quit [Ping timeout: 276 seconds]
suhdood has joined #ruby
alfiemax has quit [Remote host closed the connection]
jenrzzz has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
clemens3 has quit [Ping timeout: 248 seconds]
guille-moe has joined #ruby
rcs has quit [Ping timeout: 248 seconds]
rcs has joined #ruby
kenichi has quit [Ping timeout: 248 seconds]
kenichi has joined #ruby
mtkd has quit []
suhdood has quit [Ping timeout: 265 seconds]
conta has joined #ruby
karapetyan has joined #ruby
mostlybadfly has joined #ruby
conta has quit [Remote host closed the connection]
guille-moe has quit [Ping timeout: 265 seconds]
dviola has quit [Quit: WeeChat 2.0.1]
Xeago has quit [Ping timeout: 260 seconds]
mtkd has joined #ruby
* leitz
thinks he needs a guidance counselor.
LocaMocha has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
memo1 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
gary_ has joined #ruby
gary_ is now known as Guest71185
mtkd has quit []
Guest71185 has quit [Ping timeout: 256 seconds]
ogres has joined #ruby
<al2o3-cr>
leitz: why would you need a guidence thingymabob?
sumobob has quit [Ping timeout: 252 seconds]
<al2o3-cr>
leitz: the more you code the better you'll be
sumobob has joined #ruby
<leitz>
al2o3-cr, the amount of learning I need is huge. The idea is to have someone look at my code and let me know what the next big learning "things" are for someone at my level.
<al2o3-cr>
it's easy reading code, putting code into a perspective t actually function as it should is hard.
<leitz>
I tried looking at the Tk stuff and wasn't able to "get" it. Pretty sure my skill level is less than a 2 on a 1 to 10 scale. Maybe even 1-100. ;)
<jcalla>
learning to code takes time
gary has joined #ruby
<al2o3-cr>
leitz: stop doubting yourself. pretty sure you understand the basics of ruby?
<jcalla>
a lot of trying and failing along the way
gary is now known as Guest79237
* leitz
has the failing down pat...
<al2o3-cr>
absolutley.
<jcalla>
then you're on your way!
<leitz>
Sorry if I seem depressed about it; moving to be a coder has been a long, bumpy, and not really successful journey.
<jcalla>
what do you currently do?
<leitz>
I like Ruby enough to *want* to code in it more than most other leisure activities.
<leitz>
jcalla, I'm a linux weenie by trade.
<al2o3-cr>
leitz: if you're not sure, just ask.
<jcalla>
what do you mean "linux weenie"?
<leitz>
jcalla, my RHCE is dated 2003 and I haven't really moved off that track sense.
<leitz>
since
AJA4350 has joined #ruby
<jcalla>
what did you do with your RHCE?
<leitz>
I support Linux servers and make derogatory comments about Java programmers who consume all system resources.
schneide_ has joined #ruby
<jcalla>
ahh so you're a sysadmin?
suhdood has joined #ruby
<al2o3-cr>
leitz: ruby should be a joy then =)
Guest79237 has quit [Ping timeout: 248 seconds]
<jcalla>
if so, then you should start by rewriting your bash scripts in ruby
alfiemax has joined #ruby
<jcalla>
then make your own ruby scripts to automate some tasks you do regularly
gary_ has joined #ruby
<al2o3-cr>
try doing what ruby does in C my god ...
<jcalla>
programming is a means, not an end
<al2o3-cr>
ruby is simple
gary_ is now known as Guest17633
sameerynho has joined #ruby
<jcalla>
that is how i got really good with programming, writing programs in my previous job to automate tasks that would normally take a while to complete
RougeR has quit [Ping timeout: 256 seconds]
<leitz>
jcalla, took the SAGE lists of tasks and the Red Hat objectives and built myself a learning plan. The Ruby certification layout seems a bit light on detail besides "Well-used built-in classes and modules"
<leitz>
jcalla, that was the plan until last year. The issue is me getitng tired of people *cough* griping about using an old version of Ruby.
<al2o3-cr>
leitz: speak up.
<jcalla>
leitz: try the scripting approach first. once you're comfortable with that, try making your way into an upstream ruby-based project that you can also use in your job
nowhereman_ has quit [Read error: Connection reset by peer]
<leitz>
So I moved to coding a personal project. It holds my best work to date but there's still a lot to do in terms of more code as well as better.
alfiemax has quit [Ping timeout: 240 seconds]
Guest17633 has quit [Ping timeout: 256 seconds]
<al2o3-cr>
leitz: better coder comes with experience like anything else. practice makes perfect
<jcalla>
great! then keep going. do another project and then even more
<al2o3-cr>
and understanding
terens has quit [Ping timeout: 264 seconds]
<al2o3-cr>
put anyone in the deep end and they will sink.
<leitz>
al2o3-cr, perfect practice makes perfect. My old basketball coach said that. I hate sports.
<al2o3-cr>
leitz: but you love ruby
<leitz>
Yeah, that's the thing; trying to figure out which bites to chew off next.
<jcalla>
you aren't shooting for perfect yet. just good
<al2o3-cr>
leitz: baby steps
<jcalla>
hell... even working before good!
<leitz>
al2o3-cr, yup, really enjoy Ruby. Can't install updated versions at work and many/most tools now don't work on Ruby 1.8.7.
<jcalla>
everyone makes mistakes, which is why bugs exist
apeiros_ is now known as apeiros
<al2o3-cr>
leitz: you got a computer yourself, install upto date ruby and practice in you spare time.
<jcalla>
i work with some amazing developers, but they make mistakes. this is why our bugzilla is always active!
<jcalla>
also, don't limit yourself to ruby for the sake of it, if you can't use it at work
phenom has joined #ruby
<jcalla>
though if your work allows you to run containers, then you can always isolate a project in one
aufi has joined #ruby
<dminuoso>
An environment that forces Ruby 1.8.7 onto you is worth reconsidering.
Dimik has joined #ruby
<leitz>
jcalla, my theory is to learn better coding (OOP/TDD) using Ruby. The idea is that the language that inspires me to code gets more code written, even if Python or C are more direclty job related.
<dminuoso>
I mean it may be a different story if its some isolated system, but if that's what your IT landscape looks like..
<leitz>
In theory possible to move to another language after getting "good enough".
<lupine>
leitz: read practical object-oriented design in ruby
<lupine>
job done
<leitz>
dminuoso, work is 1.8.7 or bust. I told them to use Python. At home it's Ruby 2.6.
<al2o3-cr>
leitz: 1.8.7 is older than me
<leitz>
lupine, read it twice.
<dminuoso>
Ruby 2.6?
<dminuoso>
Boy you are fast.
<jcalla>
leitz: in my previous job, we had extremely restrictive environments! the only tool i had to use for programming was MS Office applications!
<lupine>
sounds like you're all set then
<jcalla>
so you bet i wrote a ton of programs for work in excel and access
aufi has quit [Client Quit]
schneide_ has quit [Remote host closed the connection]
<al2o3-cr>
python is a cool language
<dminuoso>
lupine: I stick to my point.
<dminuoso>
If your IT landscape forces Ruby 1.8.7 onto you, it suggests that you are in an antiquated shop.
<al2o3-cr>
just prefer ruby
<jcalla>
i love python. my primary language. but ruby has some neat tricks and interesting quirks
<leitz>
dminuoso, haven't had anyone tell me I'm on an old version in a while. ;)
<lupine>
dminuoso: sure, but plenty of those shops exist
<jcalla>
10.times is much nicer than for _ in range(10):
<dminuoso>
lupine: Any such shop is worth jumping.
<dminuoso>
jcalla: Want to know whats even better?
<lupine>
if you have the option, sure
<dminuoso>
jcalla: 1.step.lazy
RougeR has joined #ruby
<jcalla>
dminuoso: always
<dminuoso>
jcalla: That's when the _real_ fun begins.
jenrzzz has quit [Ping timeout: 240 seconds]
<dminuoso>
Generate an infinite and gain loop fusion for free.
<leitz>
dminuoso, this shop pays the bills and is stable.
<dminuoso>
*infinite list
<leitz>
We don't use Ruby so version is irrelevant.
<al2o3-cr>
dminuoso: like a generator in python?
<dminuoso>
al2o3-cr: Nope
<al2o3-cr>
ah
<dminuoso>
al2o3-cr: It's basically an infinite but lazy list.
<al2o3-cr>
you never seem to amaze me mr dminuoso
sumobob has quit [Ping timeout: 260 seconds]
<dminuoso>
>> 1.step.lazy.map(&:to_s).map { |e| "Hi " + e }.take(10).map(&:reverse).force
<dminuoso>
>> 1.step.lazy.map(&:to_s).map { |e| "Hi " + e }.map(&:reverse).take(5).force
* dminuoso
kicks ruby[bot]
<al2o3-cr>
take and force?
<dminuoso>
oh wait
dminuoso has quit [Changing host]
dminuoso has joined #ruby
<dminuoso>
>> 1.step.lazy.map(&:to_s).map { |e| "Hi " + e }.map(&:reverse).take(5).force
<dminuoso>
al2o3-cr: You dont have to .force usually
sumobob has joined #ruby
<dminuoso>
The beauty is that this fuses the loops.
<al2o3-cr>
i was gonna say
mcr1 has quit [Ping timeout: 264 seconds]
<al2o3-cr>
so simple though
<al2o3-cr>
simplicity is one of the greatest things you can do to food.
<al2o3-cr>
simplicity is one of the greatest things you can do to food.
<al2o3-cr>
oops
<al2o3-cr>
like carbonara. simple.
gary__ has joined #ruby
<dminuoso>
al2o3-cr: You can do a lot of cool things with it
<dminuoso>
like
<al2o3-cr>
believe me a played them all =)
* al2o3-cr
waits...
* jcalla
waits....
jenrzzz has joined #ruby
<leitz>
al2o3-cr, jcalla here's a good example of where I struggle. I read dminuoso's code and have not the slightest clue what it does. Part of me assumes this is something for "much later" while another part says "well, do you really have what it takes?"
nadir has joined #ruby
suhdood_ has joined #ruby
<jcalla>
leitz: take it one step at a time. and actually say to yourself what each part does
<al2o3-cr>
leitz: understand the basics first.
sumobob has quit [Ping timeout: 265 seconds]
<dminuoso>
leitz: 1.step.lazy generates an infinite list [1,2,3,4,5,6,7....]
<leitz>
al2o3-cr, that's what I'm looking for; the definition of "the basics".
<dminuoso>
>> to = -> (t, n) { (n / t).round * t }.curry; 1.step.lazy.map(&to[5]).take(20).zip(1.step.lazy).force # al2o3-cr / jcalla
<leitz>
jcalla, my code passed Travis-CI, how's that? :)
<al2o3-cr>
dminuoso: yeah :p
<dminuoso>
:P
<leitz>
And I do better learning from books.
<jcalla>
leitz: what do you mean?
<dminuoso>
al2o3-cr: You should see my other library..
<jcalla>
for an upstream project?
<al2o3-cr>
but dminuoso ruby isn't haskell ;)
<dminuoso>
al2o3-cr: Ruby has a fairly strong FP influence
<al2o3-cr>
even how nice it is
<leitz>
jcalla, I read a few TDD things and started writing tests before code. Sandi Metz's "99 Bottles of OOP" was a great help too.
<dminuoso>
Im just turning on the knob a bit
<dminuoso>
al2o3-cr: And honestly what Im doing is very basic FP stuff, nothing advanced.
<leitz>
Big lesson is "change one line at a time". I really needed that as I often confused myself.
<jcalla>
dminuoso: you should play around with brainf*ck
<dminuoso>
al2o3-cr: The real crazy stuff is not possible because it mostly relies on a powerful type system.
<al2o3-cr>
dminuoso: you can't even do `def foo; def bar; return :blah; end; end`
<leitz>
jcalla, so I keep my project on github and linked it to Travis-CI to test on pushes.
<jcalla>
leitz: and you write your own tests?
<dminuoso>
al2o3-cr: Im an AMP proponent, so it's pure all the way.
<leitz>
Though I need to figure out how to test for a bug I found a few days ago.
<leitz>
jcalla, yep.
alfiemax has joined #ruby
<dminuoso>
al2o3-cr: If I had used my Q library some of it would have been cleaner because it monkey patches half of ruby core to curry properly and accept lambdas everywhere.
<jcalla>
leitz: then you're further along than you think
<dminuoso>
al2o3-cr: I even have fully polymorphic functions like.. fmap or pure work for any Functor/Monad/Applicative.
<al2o3-cr>
fp in is not
sumobob has quit [Ping timeout: 240 seconds]
<al2o3-cr>
python lua maybe
<dminuoso>
al2o3-cr: Reality begs to differ, FP is coming back more and more. :)
<leitz>
I have, but haven't comprehedned, Binder's "Testing OO systems", Have read Beck's TDD book.
<leitz>
Set Binder aside for a little bit as I moved from 1.8.7 to 2.6.
<dminuoso>
al2o3-cr: Even if you look at the most popular languages, the FP influence is high. C++ type system takes a lot of inspiration, they got optional types, lambdas, higher kinded types..
dviola has joined #ruby
<dminuoso>
Java - same stuff (no HKTs though), they even have interfaces (which are kind of like C++ concepts or Haskell typeclasses)
<dminuoso>
A lot of the core libraries in those languages have been transformed into HOFs
<dminuoso>
C++ is slowly moving away from iterator pattern to more <algorithm> heavy stuff using lambdas
<al2o3-cr>
dminuoso: yeah, ruby is based on message sending and no way in fp paradigm whatsoever.
<dminuoso>
al2o3-cr: It absolutely is.
<dminuoso>
Every time you use a block
<dminuoso>
It's a higher order function.
<al2o3-cr>
a closure in fp
<weaksauce>
leitz eloquent ruby is a great book if you are looking for something that touches on the basics and good practices
<dminuoso>
al2o3-cr: The closure is not the important part.
<dminuoso>
The HOF part is.
<dminuoso>
The fact that you pass functions as values is one of the main driving ideas of FP.
<dminuoso>
and foo.map { |e| e * 2 } passes a function to map.
alfiemax has quit [Ping timeout: 256 seconds]
Xeago has joined #ruby
<al2o3-cr>
dminuoso: you're probably right =)
<dminuoso>
The fact that we have Proc with #curry gives you the remaining power to use this
<dminuoso>
>> to = -> (t, n) { (n / t).round * t }.curry; 1.step.lazy.map(&to[5]).take(20).zip(1.step.lazy).force
<dminuoso>
The main problem is just purity in that Ruby allows referentially intransparent functions, mutation of arguments
<dminuoso>
You can think of Ruby as an amalgation of Smalltalks message sending and FP ideas.
<dminuoso>
Its just that most ruby developers dont dive deep into the latter
<al2o3-cr>
i understand your ideas
drewmcmillan has joined #ruby
clemens3 has joined #ruby
<leitz>
weaksauce, I had a short but pleasent e-mail chat with Russ Olsen. Have both ER and his Design Patterns book. Working through "Masting Ruby Closures" and need to plan on the next book to dive into after that.
<leitz>
Hence my "guidance counselor" note.
<weaksauce>
nice leitz... very well written book imo and probably one of the best programming books i have read
gary__ has quit [Ping timeout: 240 seconds]
<leitz>
weaksause, ER, DP, or MRC?
<leitz>
Have read some of each and like them all.
<weaksauce>
ER
<leitz>
and I need to spell weaksauce correctly next time.
<weaksauce>
haven't seen his dp book.
<weaksauce>
weaksalsa
<al2o3-cr>
pico de gallo
<weaksauce>
just looked up his blog... last post was in 2015...
<dminuoso>
al2o3-cr: Also then there's things like flat_map which expose the Monadic interface of Array. ;p
<dminuoso>
(or Array#join if you are a categorical theory purist)
<leitz>
weaksauce, I like his DP book, same level of easy to read and lots of info.
<dminuoso>
Which I think is widely underused.
alfiemax has joined #ruby
<leitz>
I would like to use more patterns, but not just for pattern's sake.
Skoom has quit [Read error: Connection reset by peer]
<al2o3-cr>
dminuoso: i'm not that smart =)
<leitz>
The theory is that it would push me to learn even more.
<dminuoso>
al2o3-cr: flat_map { ... } is just map { ... }.flatten
<al2o3-cr>
it is.
<weaksauce>
looks to be a worthy book leitz
<dminuoso>
That's all there is to it. :P
<al2o3-cr>
dminuoso: a-ok ;)
<guardian>
hello, this is a thing difficult to google: I'm launching a test with bundle exec m ./path/to/test.rb. Inside test.rb I try to use pry but when launching the test the debugger doesn't break. Does someone know how to debug such tests?
mtkd has joined #ruby
reber has quit [Remote host closed the connection]
<morenoh149>
is anyone experienced in compiling ruby on osx. I'm having some issues and it's been blocking me for a week now
sumobob has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
<dminuoso>
morenoh149: Gist your problem
Psybur_ has quit [Ping timeout: 260 seconds]
<dminuoso>
guardian: Normally it should work. If it doesn't break it either means execution never hits that line of code or perhap stdin/stdout is being redirected and you do not see it.
<morenoh149>
weaksauce: but ruby-install doesn't list 2.4.2 which is what I need
<dminuoso>
morenoh149: That is truly strange.
Papierkorb has joined #ruby
<guardian>
dminuoso: nope it doesn't for some reason
mcr1 has joined #ruby
<dminuoso>
morenoh149: What are you compiling from?
<weaksauce>
morenoh149 it does for me
<weaksauce>
update your ruby install?
<morenoh149>
weaksauce: I did ruby-install -L is that enough?
Papierkorb has left #ruby ["Konversation terminated!"]
<weaksauce>
or just do ruby-install ruby-2.4.2 and see what happens
<dminuoso>
weaksauce: Honestly "dont use the vanilla way" is not a real good solution in #ruby
<dminuoso>
This should work.
<weaksauce>
dminuoso well if banging your head into the wall for a week is the vanilla way perhaps a change of course is applicable
* leitz
steps away for a bit.
amatas has quit [Quit: amatas]
jenrzzz has quit [Ping timeout: 256 seconds]
<dminuoso>
weaksauce: Ive never had a single problem with this. If there are issues that block users from compiling the most recent version, it's a bug and needs fixing.
amatas has joined #ruby
<dminuoso>
or it's some system misconfig
<morenoh149>
I'll try 2.4.3 and see what happens
<weaksauce>
i've seen openssl problems all the time
<morenoh149>
I thought maybe it was a discrepancy between zsh and bash but both have access to the homebrew ssl
<dminuoso>
morenoh149: What revision are you compiling from?irb
<dminuoso>
oops ignore that
<dminuoso>
Was trying to redraw =)
<dminuoso>
morenoh149: What's your RUBY_PLATFORM?
Antiarc_ has joined #ruby
<morenoh149>
dminuoso: empty
<dminuoso>
morenoh149: That sounds wrong.
gary has joined #ruby
<morenoh149>
as an env var?
<dminuoso>
morenoh149: No inside Ruby ;
<dminuoso>
;)
gary is now known as Guest53393
<dminuoso>
It should read "x86_64-darwin17"
<morenoh149>
=> "x86_64-darwin15"
kapil___ has quit [Quit: Connection closed for inactivity]
Antiarc_ has quit [Client Quit]
amatas has quit [Client Quit]
Antiarc has quit [Remote host closed the connection]
amatas has joined #ruby
n008f4g_ has joined #ruby
<weaksauce>
morenoh149 did you add the path to your ssl libs?
Antiarc has joined #ruby
<weaksauce>
to your .zshenv
Guest53393 has quit [Ping timeout: 240 seconds]
<dminuoso>
weaksauce: Its not necessary
<weaksauce>
well. in the time we just talked i installed 2.4.3 using ruby-install
<morenoh149>
all I added to .zshrc is source /usr/local/share/chruby/chruby.sh; source /usr/local/share/chruby/auto.sh
<morenoh149>
so I installed ruby 2.4.3p205 and chruby into it, but when running the project `bundle install` I get Your Ruby version is 2.5.0, but your Gemfile specified 2.4.2
alfiemax has joined #ruby
Antiarc has quit [Client Quit]
<dminuoso>
morenoh149: Be sure to rehash
<dminuoso>
morenoh149: Otherwise you might get the wrong bundle binstub
<dminuoso>
At least with rails I've had weird issues like that before.
<morenoh149>
how do you rehash
<morenoh149>
well I can search
<dminuoso>
morenoh149: just `rehash` in your zsh
workmad3 has joined #ruby
gary_ has joined #ruby
<morenoh149>
til
<dminuoso>
morenoh149: You should _actually_ get a command not found error since you probably have not installed the `bundle` gem for your new gem version
Antiarc has joined #ruby
Antiarc has quit [Remote host closed the connection]
gary_ is now known as Guest60620
Antiarc has joined #ruby
xfbs has joined #ruby
sumobob has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
synthroi_ has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
Guest60620 has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<morenoh149>
dminuoso: I chruby into 2.4.2 and still get `Your Ruby version is 2.5.0, but your Gemfile specified 2.4.2`
<dminuoso>
morenoh149: Did you `rehash` again?
<morenoh149>
to clarify I have compiled and installed 2.4.2 but without openssl (because it wasn't found)
<morenoh149>
dminuoso: just did, same error
<dminuoso>
morenoh149: What does `which bundler` give you?
alfiemax has joined #ruby
synthroid has quit [Ping timeout: 276 seconds]
delaz has left #ruby [#ruby]
<morenoh149>
/usr/local/bin/bundler
<weaksauce>
morenoh149 do gem install bundle and then run bundle again
<weaksauce>
er s/bundle/bundler
jnollette has quit [Ping timeout: 255 seconds]
<weaksauce>
bundler for me fell back to system ruby when there wasn't a gem for it for the current ruby
<morenoh149>
`ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository` probably due to lack of https support
<dminuoso>
morenoh149: That's the problem. You have a global installation shadowing your chruby's PATH.
alfiemax has quit [Ping timeout: 248 seconds]
<morenoh149>
dminuoso: so do I have to fix whatever is updating the PATH or is the PATH updated dynamically by chruby?
<dminuoso>
morenoh149: Lets fix the actual problem and build ruby with OpenSSL
jnollette has joined #ruby
<dminuoso>
morenoh149: I think I found the problem
<dminuoso>
morenoh149: Do you happen to have pkg-config from brew?
ldnunes has quit [Quit: Leaving]
<morenoh149>
dminuoso: yes
<dminuoso>
morenoh149: That's the issue on 2.4.2. Unlink pkg-config from brew, install, then relink again
<dminuoso>
Or do anything to prevent ruby from picking up that brew's pkg-config =)
<morenoh149>
dminuoso: unlink: pkg-config: No such file or directory
<dminuoso>
morenoh149: no with brew.
<dminuoso>
morenoh149: `brew unlink pkg-config`
<morenoh149>
got it
biberu has quit []
<morenoh149>
then recompile ruby?
<dminuoso>
morenoh149: just `make` should be sufficient
<dminuoso>
you might have to `make clean` first if it doesn't work
<morenoh149>
still `../.././ext/openssl/extconf.rb:0: Failed to configure openssl. It will not be installed.`
<morenoh149>
I ran make from the downloaded 2.4.2 sourcecode
<dminuoso>
morenoh149: do a fresh configure
<dminuoso>
its possible that the relevant paths are set at configure time
<dminuoso>
cagomez: Well you can reify blocks using the first and last method I just mentioned, but it will not really help you because you can't tell much about a Proc beyond its arity.
workmad3 has quit [Ping timeout: 248 seconds]
<dminuoso>
cagomez: So & is the block<>proc conversion operator
<cagomez>
^ is &:upcase converting :upcase to a block?
xelkarin has joined #ruby
<dminuoso>
cagomez: &:foo calls Symbol#to_proc which is implemented as class Symbol; def to_proc; proc{ |s| s.public_send(s) }; end
<dminuoso>
(or .send Im not sure from the top off my head)
<dminuoso>
And then it strips the Proc object away, turning it into a Block.
<cagomez>
excellent, nice. so @value is being passed in as `s` in that proc?
<dminuoso>
cagomez: Also a cool trick I use is to use lambdas as argument together with >>, > and >=
ferox has joined #ruby
<dminuoso>
cagomez: that allows me to make code look like: m >-> e { puts e }
<dminuoso>
m >=-> e { puts e }
<dminuoso>
m >>-> e { puts e }
<dminuoso>
m <-> e { puts e }
<dminuoso>
m <<-> e { puts e }
<dminuoso>
m <=-> e { puts e }
bijan_ has joined #ruby
Guest53604 has quit [Ping timeout: 240 seconds]
xelkarin has quit [Quit: WeeChat 1.9.1]
alfiemax has joined #ruby
xelkarin has joined #ruby
<xelkarin>
#sgvlug
<dminuoso>
cagomez: If you want something like elixir's |> I have something better for you.
<cagomez>
what is that doing, exactly? are >>, >, >= your own operators, or does Ruby do something special when used with a lamba? I'm not sure what those snippets are doing
<dminuoso>
cagomez: Its just a syntax trick. They do whatever I want
moei has quit [Quit: Leaving...]
<dminuoso>
cagomez: class Proc; def *(o); ->(x) { self[o[x]] }; end; end
<craysiii>
m O-|-< e { puts e }
ferox has quit [Changing host]
ferox has joined #ruby
<craysiii>
m O-\-< e { puts e }
<craysiii>
m O-/-< e { puts e }
<dminuoso>
cagomez: That thing is essentially the same as |> except in reverse and point free.
<dminuoso>
cagomez: if you want _exactly_ |> then upgrade to ruby 2.5
<cagomez>
ah ok. I really want to define my own operator but I have to consider others that will be working with this class, so I think I'll keep `and_then`
<dminuoso>
You could even create a refinement to do: class Object; def -(l); yield_self(&l) end; end
<dminuoso>
And then go crazy: object |-> (o) { o.increase } |-> (v) { ... }
<dminuoso>
not sure whether that will parse
<dminuoso>
Seems so.
<dminuoso>
cagomez: Proc#* is a safe monkey patch.
alfiemax has quit [Ping timeout: 264 seconds]
<dminuoso>
cagomez: *and_then is already implemented in Ruby 2.5 as yield_self :)
<cagomez>
ah ok, thanks for your help. I've been playing with procs, lambdas, and I feel like I unlocked a new part of the language
<cagomez>
seriously wow
<dminuoso>
and with my miniscule hack you can make it look cool
<dminuoso>
`add` gives you a curried lambda. `add 2` gives you a curried lambda, applied with one argument
<cagomez>
what is the use case?
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
<dminuoso>
cagomez: I hate having to specify .() or [] when invoking lambdas
sumobob has quit [Ping timeout: 248 seconds]
<dminuoso>
cagomez: But at the same time I want to be able to use a method as first class value (without having to go through the hoops of extracting it with .method() )
karapetyan has quit [Remote host closed the connection]
ghormoon has quit [Ping timeout: 256 seconds]
karapetyan has joined #ruby
<cagomez>
so would `add 3` in your example (after `add 2) produce 5?
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<cagomez>
same. is there a way to pass a non-op block? like yield to a block, but have it do nothing with the arg passed to the block? maybe { |x| x } ?
<dminuoso>
cagomez: I have a function called id =)
<dminuoso>
Q.id is exactly that
alfiemax has quit [Ping timeout: 248 seconds]
<dminuoso>
cagomez: Though you can do this with vanilla ruby already