<baweaver>
Considering how it conflicts with the regular pipe operator it probably won't happen. I know your code doesn't strictly touch it but that still overloads the operator which they're pretty touchy on
<smhuber>
baweaver true although that's just an alias for syntactic sugar, the real method is __pipe__. I was curious and did take a look at the existing `|` definitions in the stdlib, looks like there's 10 and all of them expect an argument to be passed to it https://gist.github.com/shuber/b4d0a10c272d36f6b482ffd491e4cfba
bijan_ has quit [Ping timeout: 252 seconds]
cnsvc_ has quit [Ping timeout: 256 seconds]
<al2o3-cr>
smhuber: personally i don't like the syntax.
<smhuber>
does it feel confusing? too abstract?
cthulchu has quit [Ping timeout: 268 seconds]
<al2o3-cr>
it's not confusing, just nah
carbone5 has quit [Quit: carbone5]
bijan_ has joined #ruby
<al2o3-cr>
that's me though, others might agree.
<smhuber>
ah ok gotcha - do you like the new proc composition and method reference operators that were proposed? the `<<` and `>>` and `map(&Method.:sqrt)`?
carbone5 has joined #ruby
kapil____ has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
bijan_ has quit [Ping timeout: 252 seconds]
Freshnuts has quit [Quit: Leaving]
<smhuber>
al2o3-cr gotcha yea they always look a little strange at first but then end up growing on me lol, thanks for your feedback, much appreciated!
hutch has quit [Ping timeout: 240 seconds]
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has joined #ruby
<al2o3-cr>
smhuber: ruby should be simple, the way it was designed.
bijan_ has quit [Ping timeout: 252 seconds]
uplime has joined #ruby
Fr4n has quit [Remote host closed the connection]
hutch has joined #ruby
<smhuber>
al2o3-cr maybe it was designed to be more "expressive" then "simple"? from https://www.ruby-lang.org/en/about/ - He [Matz] has often said that he is "trying to make Ruby natural, not simple," in a way that mirrors life. Building on this, he adds: Ruby is simple in appearance, but is very complex inside, just like our human body.
cnsvc_ has joined #ruby
<al2o3-cr>
smhuber: ok, so... foo | bar | baz is more expressive?
<smhuber>
more natural in english - read left to right, no other visual noise like parens and temporary vars
<smhuber>
nice lol yea it's been around awhile :P - alrighty cool thanks again for the feedback!
<al2o3-cr>
smhuber: why would you want this?
cliluw has quit [Read error: Connection reset by peer]
uplime is now known as nchambers
<al2o3-cr>
smhuber: seriously?
cliluw has joined #ruby
<smhuber>
al2o3-cr Oh lol I only made this just to prove it could be done - I got tired of reading comments like "Due to that any normal method call will be instantly evaluated so there is no way we will get syntax as nice as Elixir's pipe operator...". But once it was all said and done I thought the syntax felt pretty natural/elegant/concise and could possi
<smhuber>
bly be a good fit as a core Ruby feature like it has been for many other languages
<smhuber>
al2o3-cr my curiosity is completely satisfied - but if there is any interest in making this a real feature then I'll fork Ruby and put in the work, otherwise no big deal to me :P
<al2o3-cr>
smhuber: go ahead, don't go just on my opinion. =)
bijan_ has joined #ruby
<al2o3-cr>
smhuber: i didn't like streems aproach tbh.
bijan_ has quit [Ping timeout: 252 seconds]
<al2o3-cr>
and guilds...is a complex matter.
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
s3nd1v0g1us has quit [Read error: Connection reset by peer]
crankharder has joined #ruby
PaulePanter has quit [Ping timeout: 244 seconds]
<smhuber>
al2o3-cr - agreed - I didn't really like the idea of having to stream _all the time_ like that! I like Ruby style OOP method chaining - it already reads left to right which is very natural.
<smhuber>
al2o3-cr The pipe syntax just feels handy when you need to call out to methods on other objects in chains like that - which in a world where things like decorators, presenters, and dependency inversion principles are popular - can happen pretty regularly
<al2o3-cr>
smhuber: why spoil a good story by telling the truth?
paranoicsan has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
bijan_ has joined #ruby
Puffball has quit [Remote host closed the connection]
bambanxx has joined #ruby
bijan__ has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
StarLord__ has quit [Ping timeout: 246 seconds]
bijan__ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
jokke has quit [Ping timeout: 272 seconds]
tag has quit [Quit: Connection closed for inactivity]
bijan_ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
hutch has quit [Ping timeout: 245 seconds]
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
arescorpio has joined #ruby
hutch has joined #ruby
jhass has quit [Ping timeout: 250 seconds]
bijan_ has quit [Ping timeout: 252 seconds]
bijan__ has joined #ruby
universal has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
biberao has quit [Ping timeout: 246 seconds]
dbz has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
dbz has quit [Remote host closed the connection]
dbz has joined #ruby
bijan__ has quit [Read error: Connection reset by peer]
jhass has joined #ruby
jokke has joined #ruby
universa1 has joined #ruby
Fusl has quit [Ping timeout: 256 seconds]
braincrash has quit [Quit: bye bye]
Fusl has joined #ruby
horst_ has quit [Ping timeout: 240 seconds]
carbone5 has quit [Quit: carbone5]
braincrash has joined #ruby
horst has joined #ruby
carbone5 has joined #ruby
tag has joined #ruby
bambanxx has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
bijan__ has joined #ruby
bijan_ has quit [Ping timeout: 260 seconds]
bijan__ has quit [Ping timeout: 252 seconds]
sauvin has joined #ruby
Exuma has joined #ruby
carbone5 has quit [Quit: carbone5]
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
<marz_d`ghostman>
smhuber: Is there a book or a resource somewhere I can read to about these things? I didn't seem to ready any of it online
houhoulis has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
bijan__ has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
<smhuber>
marz_d`ghostman sure there's probably a bunch of books out there, I've definitely seen some on amazon. I think their online documentation has good examples though, I'd recommend just browsing thru that to get a nice overview of all the things it's capable of
jenrzzz has joined #ruby
<marz_d`ghostman>
smhuber: okay thanks mate. I appreciate it :)
<smhuber>
marz_d`ghostman happy to help!
hutch has quit [Ping timeout: 240 seconds]
bijan_ has joined #ruby
bijan__ has quit [Ping timeout: 268 seconds]
Inline has quit [Quit: Leaving]
kapil____ has quit [Quit: Connection closed for inactivity]
bijan__ has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
bijan_ has quit [Ping timeout: 252 seconds]
cnsvc_ has joined #ruby
paranoicsan has joined #ruby
bijan__ has quit [Ping timeout: 252 seconds]
arescorpio has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
bijan_ has joined #ruby
lunarkitty7 has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
moei has quit [Quit: Leaving...]
bijan_ has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
uplime has joined #ruby
uplime has quit [Client Quit]
nchambers has quit [Ping timeout: 244 seconds]
bijan_ has joined #ruby
houhoulis has quit [Remote host closed the connection]
<marz_d`ghostman>
How do I temporarily override a variable inside a context? It seems that the `before` statement on line 98 is overriding the statement and making the succeeding tests fail as it should have the value 'true' when getting out of that context: https://gist.github.com/marzdgzmn/fe94064b777c084aa4ef0284f0a46290
clemens3 has quit [Ping timeout: 250 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
ElFerna has quit [Ping timeout: 250 seconds]
maufart__ has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
conta has joined #ruby
maufart__ has quit [Ping timeout: 245 seconds]
neuraload has quit [Quit: This computer has gone to sleep]
<jhass>
marz_d`ghostman: it seems you're still confused as to when code inside a context/describe block vs when code inside a before/it/let block is run
<jhass>
I suggest you think about and review that
neuraload has joined #ruby
<jhass>
try with a blank spec file and putting puts statement to confirm the order of execution that you think there is
raulp has quit [Ping timeout: 272 seconds]
neuraload has quit [Client Quit]
neuraload has joined #ruby
neuraload has quit [Client Quit]
neuraload has joined #ruby
neuraload has quit [Client Quit]
neuraload has joined #ruby
neuraload has quit [Client Quit]
paranoicsan has joined #ruby
neuraload has joined #ruby
<marz_d`ghostman>
jhass: I understand before statements on the outer context gets executed first before the before statements in an inner context. However, is there like a mechanism where the overriding variable will be local to the inner context like defining a local block variable e.g. ;x?
sonofentropy has quit [Quit: sonofentropy]
<jhass>
you could probably do exactly that, but it would be quite confusing to most over just consistently using let
sonofentropy has joined #ruby
sonofentropy has quit [Client Quit]
x0f has quit [Ping timeout: 252 seconds]
sonofentropy has joined #ruby
neuraload has quit [Quit: Leaving]
GodFather has joined #ruby
sonofentropy has quit [Client Quit]
x0f has joined #ruby
<marz_d`ghostman>
jhass: Uhhm, so like use let to define a new variable on every context? that was the next step I was thinking to do, just wondering if I can do it with a similar local block variable mechanism. Guess I got into it too deep though hehe
sonofentropy has joined #ruby
<jhass>
inner contexts and before blocks there can of course access let definitions of outer ones
<jhass>
btw describe and context are technically just aliases, don't worry about differences there
<jhass>
another scheme is to use @instance_vars in before blocks, but most people prefer let these days for its cleaner looks and lazy evaluation
ElFerna has joined #ruby
yasserhussain111 has joined #ruby
yasserhussain111 has quit [Client Quit]
ElFerna has quit [Ping timeout: 246 seconds]
<marz_d`ghostman>
jhass: So what I've though is to define a base object on the outer most via `let`. Then just extend that object and assign it to another variable via another `let` on inner context to preserve the base object for another inner context to use. Am I doing it right though?
<jhass>
there's no general answer to that
nickjj has joined #ruby
<marz_d`ghostman>
Okay, guess I'll just do that cause if I modify the variable defined by the outermost let in an inner context it seems to retain the modified value. Which seems to be what should be though now that I think of it :)
jenrzzz has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
<jhass>
yes, let's throw away their value after each example
<marz_d`ghostman>
jhass: thanks, kudos to the test. I'm still currently going through it :)
<jhass>
great :)
<jhass>
oh, useful flag for rspec there might also be -f d
graphene has quit [Remote host closed the connection]
<marz_d`ghostman>
jhass: what's --seed 0 or --order rand:123 for?
<jhass>
rspec by default randomizes the order in which it runs your example
<jhass>
*examples
graphene has joined #ruby
<jhass>
-seed gives a deterministic ordering
<marz_d`ghostman>
I see
reber has joined #ruby
<marz_d`ghostman>
I'm starting to understand it better now. So ruby evaluates the code like in two phases, once for none test-related stuff hence 'ABFJK', then second for the test-related stuff starting with the `before` statement going to the `it` while lazily evaluates any `let` definitions
jenrzzz has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
roshanavand has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
keden has joined #ruby
<jhass>
now looking it --order defined is maybe the nicer option here to achieve that :D
jenrzzz has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
<marz_d`ghostman>
it still gives the same output though, am just gonna save this code for future reference, really appreciate you clearing me from my confusion mate. thanks
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
paranoicsan is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
kapil____ has quit [Quit: Connection closed for inactivity]
dmitch has joined #ruby
mostlybadfly has joined #ruby
crankharder has joined #ruby
sonofentropy has quit [Quit: sonofentropy]
jenrzzz has quit [Ping timeout: 272 seconds]
paranoicsan has joined #ruby
jenrzzz has joined #ruby
roshanavand has quit [Ping timeout: 244 seconds]
awkwords has joined #ruby
Puffball has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
kapil____ has joined #ruby
hutch has joined #ruby
cnsvc_ has joined #ruby
rubydoc has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 250 seconds]
horst has quit [Quit: horst]
Fr4n has joined #ruby
horst_ has joined #ruby
rubydoc has joined #ruby
jenrzzz has joined #ruby
sonofentropy has joined #ruby
phaul has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
cnsvc_ has quit [Ping timeout: 256 seconds]
rippa has joined #ruby
ElFerna has joined #ruby
Guest61854 has quit [Ping timeout: 260 seconds]
paranoicsan is now known as paranoicsan[Away
Guest61854 has joined #ruby
blackswan has quit [Quit: Leaving.]
paranoicsan[Away has quit [Quit: paranoicsan[Away]
anikras has quit [Quit: Ex-Chat]
sonofentropy has quit [Quit: sonofentropy]
paranoicsan has joined #ruby
krawchyk has joined #ruby
hutch has joined #ruby
aupadhye has quit [Ping timeout: 250 seconds]
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
paranoicsan is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
graphene has quit [Remote host closed the connection]
ElFerna has quit [Ping timeout: 245 seconds]
neuraload has quit [Quit: This computer has gone to sleep]
neuraload has joined #ruby
graphene has joined #ruby
paranoicsan has joined #ruby
polishdub has joined #ruby
wlan2 has joined #ruby
conta has quit [Ping timeout: 250 seconds]
<wlan2>
So I was returning to the koans after some time off them due to work. I find myself stranded in the face of about_scoring_project.rb with a big doubt.
sonofentropy has joined #ruby
<wlan2>
Should I restart the koans instead of trying to finish them?
jenrzzz has quit [Ping timeout: 244 seconds]
powerbit has quit [Remote host closed the connection]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<wlan2>
I also don't know if there's a better place to ask.
jenrzzz has joined #ruby
<Inside>
well
<Inside>
I always found the koans a bit of a strange way to approach learning programming
nowhere_man has quit [Ping timeout: 252 seconds]
<Inside>
ah
<Inside>
these are a bit different than what I was thinking of
<Inside>
I guess it depends on what your question is
<Inside>
what are you exactly stuck on
Inline has joined #ruby
<Inside>
I'm looking at someone's solution for this specific test file and there is nothing language specific in there
<Inside>
it's 100% logic
SuperLag has quit [Ping timeout: 272 seconds]
SuperLag has joined #ruby
venmx has joined #ruby
<wlan2>
Well I am 100% sure that I can do it with a crapload of if. And also completely sure I don't want to write a crapload of if nor do I want to copy someone else's solution.
<wlan2>
In case of doubt, everything is a Nyarlatoteph avatar.
Moeh has joined #ruby
wlan2 has quit [Ping timeout: 250 seconds]
<Moeh>
Hi! In my ruby app I'd like to create a class called "File" which should not 'override' the default Ruby File class. Is there a way to access the default Ruby File class within my app using something like Ruby::File (which doesn't work). Or inherit from the default Ruby File class using something like "class File < File # inherits from Ruby File class" (which also doesn't work).
neuraload has quit [Quit: This computer has gone to sleep]
jenrzzz has joined #ruby
<phaul>
First I would put the entire APP in it's own namespace. Then nothing you do collide with anybody elses stuff, including gems, or stdlib
<phaul>
then your file would become MyApp::File, while stdlib file is just File.
cnsvc_ has quit [Ping timeout: 256 seconds]
akaiiro has joined #ruby
keden has quit [Quit: WeeChat 2.3]
themsay has joined #ruby
sonofentropy has joined #ruby
conta has quit [Quit: conta]
wlan2 has joined #ruby
<phaul>
you can achive this by wrapping all your classes , modules inside module MyApp ... end in all your files
cpruitt has joined #ruby
<phaul>
actually.. ::File for Ruby file.
themsay has quit [Ping timeout: 268 seconds]
<phaul>
if you are inside MyApp. Moeh , does this make sense?
<Moeh>
I am using https://github.com/davetron5000/gli to build a CLI and it looks like it already wraps everything in a "class App" which then loads modules. But it looks like inside of the class definition it'd refer to itself. So in: "module MyModule class File File.basename() end end" File actually refers to itself (and throws a method undefined error). However, when I use "::File" inside it refers to the stdlib and works.
sonofentropy has quit [Ping timeout: 252 seconds]
<Moeh>
Yes, thanks, makes sense! I'll use "::File" inside of the class definition and then everything works.
<Moeh>
Outside of the class definition the names are correctly scoped, so if I do "File" outside of the definition I get the stdlib File and MyModule::File returns my own class as expected. Perfect, thanks a lot!
<phaul>
yw
doubledup has joined #ruby
doubledup has quit [Remote host closed the connection]
<phaul>
Moeh, if you are interested, there are some obscure pitfalls around this, namely the difference between module MyApp; class MyClass; end; end; vs class MyApp::MyClass; end. If you write the latter, and use File you don't need ::File, you can use File, but for the former you need the ::
<krawchyk>
does this mean `Enumerable#each_with_object` is more performant than `reduce` or `inject`?
<krawchyk>
because each_with_object doesnt instantiate new accumulator objects each iteration
<krawchyk>
or do i need to read up on my Ruby internals?
<havenwood>
krawchyk: reduce/inject also have a persistent accumulator that's being mutated - just like each_with_object
<havenwood>
krawchyk: there are various performance and memory implications of having frozen arrays non-mutating methods versus unfroze arrays that mutate
<havenwood>
krawchyk: i'd not take this tweet-based cop with too much seriousness :P
<havenwood>
krawchyk: i'd suggest that you do your own benchmarking and check the actual memory and performance implications for your case
<havenwood>
krawchyk: I did a PR a long time ago that changed Rails to use mutating methods. It was eventually rejected with a shrug.
<havenwood>
krawchyk: There's something nice about functional methods.
<havenwood>
krawchyk: an aside, but tenderlove just proposed a commit for Ruby that would allow for a frozen_hash_and_array_literal magic comment.
<slima>
al2o3-cr: yeah, I read that, but this examples is not clear to me.
<havenwood>
krawchyk: frozen arrays wouldn't work with map!, etc.
<slima>
are*
<havenwood>
(I do think frozen_hash_literal should probably be separate from frozen_array_literal with a catch-all frozen_literals.)
SeepingN has joined #ruby
Aqo has quit [Quit: ChatZilla 0.9.92-rdmsoft [XULRunner 35.0.1/20150122214805]]
<phaul>
Ookma-Kyi in the future try pasting error logs / code on dpaste.de or gist.github.com etc. Flashing animated gifs with jpeg screenshots of screen contents are not going to be popular with people trying to help.
<phaul>
Also try to explain what you are doing, unless someone has seen the exact same backtrace it's unlikely that anybody could help