havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.7.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
FastJack has quit [Ping timeout: 264 seconds]
DaRock has joined #ruby
elphe has joined #ruby
prestorium has quit [Ping timeout: 272 seconds]
CCDelivery has joined #ruby
<vcavallo> hahah i love it giuseppe1
<vcavallo> i could't tell you how many times i've typed jkjkjk into windows, wondering why my cursor wasn't moving in the vim split i was looking at
prestorium has joined #ruby
tdy has quit [Ping timeout: 246 seconds]
involans_ has quit [Quit: involans_]
prestorium has quit [Ping timeout: 244 seconds]
involans has joined #ruby
involans has quit [Quit: involans]
CCDelivery has quit [Remote host closed the connection]
prestorium has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lucasb has quit [Quit: Connection closed for inactivity]
fphilipe_ has joined #ruby
Technodrome has joined #ruby
beanie__ has quit [Quit: Thanks for your help, nice to see you, take care.]
tpanarch1st has joined #ruby
prestorium has quit [Ping timeout: 245 seconds]
wildtrees has quit [Quit: Leaving]
pebble2016 has quit [Quit: Connection closed for inactivity]
timmow has quit [Ping timeout: 245 seconds]
timmow has joined #ruby
SCHAPiE has quit [Quit: ZNC - https://znc.in]
quintasan has quit [Quit: No Ping reply in 180 seconds.]
olblak has quit [Ping timeout: 245 seconds]
quintasan has joined #ruby
olblak has joined #ruby
greengriminal has joined #ruby
SCHAPiE has joined #ruby
jtdowney has quit [Quit: jtdowney]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jtdowney has joined #ruby
prestorium has joined #ruby
fphilipe_ has quit [Ping timeout: 246 seconds]
jtdowney has quit [Client Quit]
jtdowney has joined #ruby
ramfjord has quit [Ping timeout: 245 seconds]
prestorium has quit [Ping timeout: 248 seconds]
prestorium has joined #ruby
tdy has joined #ruby
bruce_lee has quit [Remote host closed the connection]
gix has quit [Ping timeout: 258 seconds]
prestorium has quit [Ping timeout: 245 seconds]
cd has quit [Quit: cd]
jtdowney has quit [Quit: jtdowney]
jtdowney_ has joined #ruby
jtdowney_ has left #ruby [#ruby]
cako has quit [Ping timeout: 245 seconds]
prestorium has joined #ruby
cadeskywalker has quit [Ping timeout: 248 seconds]
prestorium has quit [Ping timeout: 245 seconds]
cadeskywalker has joined #ruby
duderonomy has joined #ruby
teardown has quit [Read error: Connection reset by peer]
jtdowney has joined #ruby
prestorium has joined #ruby
involans has joined #ruby
cako has joined #ruby
prestorium has quit [Ping timeout: 248 seconds]
cako has quit [Ping timeout: 272 seconds]
prestorium has joined #ruby
cako has joined #ruby
henninb has joined #ruby
involans has quit [Quit: involans]
cako has quit [Ping timeout: 248 seconds]
duderonomy has quit [Ping timeout: 246 seconds]
cako has joined #ruby
r29v has quit [Quit: r29v]
cako has quit [Ping timeout: 258 seconds]
henninb has quit [Quit: Lost terminal]
prestorium has quit [Ping timeout: 245 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
code_zombie has quit [Quit: Leaving]
teardown has joined #ruby
duderonomy has joined #ruby
skyikot has joined #ruby
aither has quit [Ping timeout: 248 seconds]
prestorium has joined #ruby
skyikot has quit [Quit: skyikot]
skyikot has joined #ruby
skyikot has quit [Client Quit]
skyikot has joined #ruby
skyikot has quit [Client Quit]
skyikot has joined #ruby
skyikot has quit [Client Quit]
podlech has joined #ruby
skyikot has joined #ruby
fphilipe_ has joined #ruby
prestorium has quit [Ping timeout: 248 seconds]
impermanence has joined #ruby
cako has joined #ruby
aither has joined #ruby
cako has quit [Ping timeout: 272 seconds]
podlech has quit [Quit: WeeChat 2.5-dev]
prestorium has joined #ruby
cako has joined #ruby
giuseppe1 has quit [Remote host closed the connection]
Skarlso has quit [Quit: The Lounge - https://thelounge.chat]
prestorium has quit [Ping timeout: 246 seconds]
Skarlso has joined #ruby
kapilp has joined #ruby
pwnd_nsfw has joined #ruby
fphilipe_ has quit [Ping timeout: 245 seconds]
cako has quit [Ping timeout: 245 seconds]
cako has joined #ruby
Skarlso has quit [Quit: The Lounge - https://thelounge.chat]
impermanence has quit [Ping timeout: 244 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
orbyt_ has joined #ruby
Skarlso has joined #ruby
_rubik has joined #ruby
cako has quit [Ping timeout: 245 seconds]
prestorium has joined #ruby
Skarlso has quit [Quit: The Lounge - https://thelounge.chat]
Skarlso has joined #ruby
fphilipe_ has joined #ruby
prestorium has quit [Ping timeout: 272 seconds]
prestorium has joined #ruby
Frobozz has quit [Read error: Connection reset by peer]
mostlybadfly has joined #ruby
Frobozz has joined #ruby
FastJack has joined #ruby
oetjenj has joined #ruby
fphilipe_ has quit [Ping timeout: 258 seconds]
sandstrom has joined #ruby
elphe has quit [Quit: leaving]
tpanarch1st has quit [Ping timeout: 272 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe_ has joined #ruby
codefriar has joined #ruby
SCHAPiE has quit [Quit: ZNC - https://znc.in]
keden has quit [Ping timeout: 250 seconds]
rainer_tm has quit [Ping timeout: 246 seconds]
Mon_Ouie has quit [Ping timeout: 246 seconds]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
galaxie has quit [Remote host closed the connection]
SCHAPiE has joined #ruby
sauvin has joined #ruby
galaxie has joined #ruby
keden has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
cako has joined #ruby
ramfjord has joined #ruby
rainer_tm has joined #ruby
Mon_Ouie has joined #ruby
_rubik has quit [Ping timeout: 245 seconds]
ramfjord has quit [Ping timeout: 268 seconds]
codefriar has quit [Ping timeout: 258 seconds]
stryek has quit [Quit: Connection closed for inactivity]
za1b1tsu has joined #ruby
prestorium has quit [Ping timeout: 268 seconds]
howdoi has joined #ruby
ur5us has joined #ruby
haxx0r has joined #ruby
pwnd_nsfw has quit [Ping timeout: 245 seconds]
skyikot has quit [Quit: skyikot]
thebananaking has quit [Quit: Connection closed for inactivity]
Mrgoose8 has quit [Remote host closed the connection]
kapilp has quit [Quit: Connection closed for inactivity]
fphilipe_ has quit [Ping timeout: 272 seconds]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
Mrgoose8 has joined #ruby
oetjenj has quit [Client Quit]
fphilipe_ has joined #ruby
oetjenj has joined #ruby
kyrylo has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
fphilipe_ has quit [Ping timeout: 246 seconds]
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
schne1der has joined #ruby
aupadhye has joined #ruby
Ring0` has quit [Quit: bb 0_o]
andikr has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
schne1der has quit [Ping timeout: 268 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
alem0lars_ has joined #ruby
alem0lars_ has quit [Remote host closed the connection]
Nicmavr has joined #ruby
sagax has quit [Remote host closed the connection]
alem0lars has joined #ruby
fritzroy15 has joined #ruby
<fritzroy15> hello, I'm changing some logging variables in a rails app that are defined under config/environments/dev.rb and want to include a class here; i've added the class under app/helpers/class.rb; how do I go about requiring it under dev.rb?
<phaul> ?crosspost
<ruby[bot]> Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
mostlybadfly has quit [Quit: Connection closed for inactivity]
TomyWork has joined #ruby
fphilipe_ has joined #ruby
matheusmoreira has quit [Ping timeout: 245 seconds]
matheusmoreira has joined #ruby
lxsameer has joined #ruby
prestorium has joined #ruby
alem0lars has quit [Read error: Connection reset by peer]
meinside has quit [Quit: Connection closed for inactivity]
alem0lars has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
ramfjord has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
ellcs has joined #ruby
fphilipe_ has quit [Ping timeout: 245 seconds]
sandstrom has quit [Quit: My computer has gone to sleep.]
ramfjord has quit [Ping timeout: 246 seconds]
cako has quit [Ping timeout: 248 seconds]
cako has joined #ruby
deepredsky has joined #ruby
schne1der has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
cako has quit [Read error: Connection reset by peer]
cako has joined #ruby
jmcgnh has quit [Ping timeout: 244 seconds]
jmcgnh_ has joined #ruby
jmcgnh_ is now known as jmcgnh
suukim has joined #ruby
sandstrom has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
x86sk has quit [Quit: Connection closed for inactivity]
fphilipe_ has joined #ruby
sylario has joined #ruby
alem0lars has quit [Read error: Connection reset by peer]
rindolf has joined #ruby
fphilipe_ has quit [Ping timeout: 272 seconds]
alem0lars has joined #ruby
andikr has quit [Remote host closed the connection]
sagax has joined #ruby
haxx0r has quit [Remote host closed the connection]
stooj has quit [Ping timeout: 245 seconds]
rafadc has joined #ruby
cisco has joined #ruby
stooj has joined #ruby
cisco is now known as Guest99651
rafadc_ has quit [Ping timeout: 248 seconds]
nerdius has joined #ruby
DaRock has quit [Ping timeout: 245 seconds]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
gabschemoul has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
TomyWork has quit [Remote host closed the connection]
TomyLobo2 has joined #ruby
axyjo has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 246 seconds]
DaRock has joined #ruby
nowhereman has quit [Ping timeout: 252 seconds]
nowhere_man has joined #ruby
stan has quit [Ping timeout: 245 seconds]
ellcs has joined #ruby
axyjo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ober has quit [Ping timeout: 268 seconds]
akkad has joined #ruby
alem0lars has quit [Read error: Connection reset by peer]
alem0lars has joined #ruby
tdy has quit [Ping timeout: 246 seconds]
stan has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
fphilipe_ has joined #ruby
<leftylink> q: can I make my struct's `new` take kwargs instead... a: turns out I can, in 2.5 and later (`keyword_init: true` to Struct.new)
Huck777 has joined #ruby
aupadhye has quit [Ping timeout: 258 seconds]
fphilipe_ has quit [Ping timeout: 276 seconds]
andikr has joined #ruby
mwlang has quit [Quit: mwlang]
xco has joined #ruby
<xco> Hi, i’m sure there’s a better way to write this, any refactoring hero around today? https://gist.github.com/xcobar/80e81b9394de9d93e093facfdb6d5ff3
<xco> i feel it could be made to look simpler but not sure how
<canton7> xco, seems fairly clear and concise?
<xco> i thought it could be made better :P
<xco> always on the lookout for a better approach :)
<xco> canton7: thanks ;)
kapilp has joined #ruby
ramfjord has joined #ruby
<leftylink> yeah dunno what anyone could expect from that. there's stilly stuff like [(a if b), (c if d), (e if f)].join.html_safe (don't even need to `compact`!) but I see no advantage provided by this
<leftylink> or there's "{a if b}{c if d}{e if f}".html_safe but I don't like how that looks on multiple lines
<leftylink> the list at least looks decent on multiple lines, one line per element
ramfjord has quit [Ping timeout: 245 seconds]
Huck777 has quit [Ping timeout: 246 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe_ has joined #ruby
darris has quit [Max SendQ exceeded]
darris has joined #ruby
AJA4350 has joined #ruby
chalkmonster has joined #ruby
stan has quit [Ping timeout: 258 seconds]
GodFather has joined #ruby
stan has joined #ruby
GodFather_ has joined #ruby
cow[moo] has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
_falsebay_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TomyLobo2 is now known as TomyWork
fphilipe_ has quit [Ping timeout: 264 seconds]
stryek has joined #ruby
cd has joined #ruby
yalue has joined #ruby
GodFather has quit [Ping timeout: 248 seconds]
GodFather_ has quit [Ping timeout: 268 seconds]
stan has quit [Remote host closed the connection]
stan has joined #ruby
grilix has joined #ruby
Tuor has joined #ruby
aupadhye has joined #ruby
involans has joined #ruby
cca4 has joined #ruby
<cca4> Hello, How to do a if in a loop each inline Offer.all.each { |o| o.id if o.live? }.count
greengriminal has joined #ruby
stan has quit [Ping timeout: 268 seconds]
JJonah has quit [Read error: Connection reset by peer]
ec has quit [Read error: Connection reset by peer]
JJonah has joined #ruby
ec has joined #ruby
<adam12> cca4: You want `map` instead of `each`
<adam12> cca4: Or depending on your Ruby version, you might be able to use `count` instead of `map`.
<adam12> cca4: Offer.all.map { |o| o.id if o.live? }.count
<adam12> cca4: Offer.all.count { |o| o.live? }
<adam12> cca4: But if this is Rails, there may be better ways to do it. And you might have to cast to array `all.to_a.map` first. You'll have to try it out and see.
dbugger has joined #ruby
greengriminal has quit [Ping timeout: 245 seconds]
greengriminal has joined #ruby
cako has quit [Ping timeout: 248 seconds]
cyclonis_ has joined #ruby
lucasb has joined #ruby
ascarter has joined #ruby
cyclonis has quit [Ping timeout: 258 seconds]
aupadhye has quit [Quit: Leaving]
tdy has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
iffraff has joined #ruby
cako has joined #ruby
fphilipe_ has joined #ruby
<vcavallo> xco canton7 would you use something like this in the future? http://www.ratemyrefactor.com
<vcavallo> re: your ask for refactor help xco
_falsebay_ has joined #ruby
Guest99651 has quit [Ping timeout: 245 seconds]
jbeaudoin_sher has joined #ruby
gabschem_ has joined #ruby
gabschem_ is now known as gabschemoul_
Mrgoose8 has quit [Quit: The Lounge - https://thelounge.chat]
andikr has quit [Remote host closed the connection]
gabschemoul_ has quit [Client Quit]
gabschem_ has joined #ruby
drincruz_ has joined #ruby
Mrgoose8 has joined #ruby
<canton7> vcavallo, seems odd that it's specifically targeted at refactoring
<canton7> even if it was for any sort of change, I'm not sure I'd find it useful, no. 1) Reviews need to be timely and reliable to be of much worth, 2) The value in a review comes mainly from people who are familiar with the project's coding guidelines and the wide context of the change, neither of which will be known by random people
schne1der has quit [Ping timeout: 248 seconds]
<canton7> SO only works when the questions being answered, or code being reviewed, is very self-contained and fairly small, as this reduces the effort required by the people helping. That's not the case when reviewing some random code change to a large codebase
GodFather has joined #ruby
iffraff has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
nerdius has quit [Ping timeout: 246 seconds]
GodFather_ has joined #ruby
DaRock has quit [Ping timeout: 272 seconds]
<vcavallo> canton7: you're probably right, yea
Mrgoose8 has quit [Quit: The Lounge - https://thelounge.chat]
fphilipe_ has quit [Ping timeout: 252 seconds]
Mrgoose8 has joined #ruby
deepredsky has quit [Ping timeout: 246 seconds]
involans has quit [Ping timeout: 244 seconds]
deepredsky has joined #ruby
Tuor has quit [Quit: Konversation terminated!]
fritzroy15 has quit [Quit: Leaving]
sauvin has quit [K-Lined]
<vcavallo> basically, me and some ex-coworkers are trying to figure out how to best scale up this pretty small but very helpful community we have where we help each other out with project issues from large architecture design approaches to small code refactorings
deepredsky has quit [Ping timeout: 268 seconds]
<vcavallo> canton7, this was one idea closer to the "small code refactorings" end of the spectrum
<vcavallo> something more like a threaded conversation with good filtering would likely be better
<vcavallo> (aka discord or slack when used properly :D)
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Huck777 has joined #ruby
cthulchu has joined #ruby
ellcs has quit [Ping timeout: 245 seconds]
<vcavallo> thanks for your input, canton7 !
<vcavallo> sorry to have derailed with this mostly-non-ruby talk
al2o3-cr has joined #ruby
sandstrom has quit [Ping timeout: 264 seconds]
sagax has quit [Remote host closed the connection]
wildtrees has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
cyclonis_ has quit [Read error: Connection reset by peer]
ryouba has joined #ruby
<ryouba> hi!
<ryouba> where is the documentation that lists all the ways of typing Arrays (like [], %w[], %w{}, etc.)? (https://docs.ruby-lang.org/en/2.5.0/Array.html doesn't seem to be it)
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<leftylink> probably somewhere in syntax
<adam12> ryouba: It's under literals doc. https://ruby-doc.com/core/doc/syntax/literals_rdoc.html
<ryouba> adam12: that mentions %w ... but no word on [] vs {} vs ()
<ryouba> h!
<adam12> ryouba: But for clarity, %w is the sigil and the arguments after it can be anything other than a couple reserved characters. %w||, %w"", %w@@ all probably would work.
<ryouba> wait, a grey-ish-ly typed paragraph below, at the bottom!
<adam12> ryouba: As long as the characters are the same, it doesn't really matter.
<adam12> &>> %w"foo bar baz"
<rubydoc> # => ["foo", "bar", "baz"] (https://carc.in/#/r/7bz2)
<ryouba> something new learned! thank you! :)
<adam12> ryouba: Cheers.
involans has joined #ruby
involans has quit [Client Quit]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
jud has joined #ruby
involans has joined #ruby
Technodrome has joined #ruby
bluemage has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<bluemage> howdy
GodFather_ has quit [Ping timeout: 248 seconds]
GodFather has quit [Ping timeout: 246 seconds]
yalue_ has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<bluemage> Unresolved dependency found during sorting - activesupport (>= 4.2.0)
<bluemage> $ gem list activesupport
<bluemage> activesupport (5.2.3, 5.2.2, 4.2.10)
<bluemage> ¯\_(ツ)_/¯
xco has quit [Quit: xco]
codefriar has joined #ruby
yalue has quit [Ping timeout: 258 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
yalue_ has quit [Quit: Leaving]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cow[moo] has quit [Quit: Textual IRC Client: www.textualapp.com]
cca4 has quit [Ping timeout: 260 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
gix has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
codefriar has quit [Quit: Textual IRC Client: www.textualapp.com]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
involans has quit [Read error: Connection reset by peer]
involans has joined #ruby
kssm_ has joined #ruby
cow[moo] has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
rorochan has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cako has quit [Ping timeout: 245 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
fphilipe_ has joined #ruby
ramfjord has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
haxx0r has joined #ruby
Mrgoose8 has quit [Ping timeout: 245 seconds]
prestorium has quit [Ping timeout: 272 seconds]
Mrgoose8 has joined #ruby
gabschem_ has quit [Remote host closed the connection]
gabschem_ has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
lxsameer has quit [Ping timeout: 246 seconds]
xco has joined #ruby
<Technodrome> how does a block like each work internally? get array size (if this is an array) , and then just loop and yield with the argument and going up the index till the end?
gabschem_ has quit [Ping timeout: 248 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<Technodrome> also how is it possible to send a block to a method where there is no parameter, why is that legal?
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<bluemage> can you pastebin what you're looking at Technodrome?
yalue has joined #ruby
<ruby[bot]> Technodrome: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<Technodrome> def yield_with_arguments. , a method definition with no arguments
orbyt_ has joined #ruby
<bluemage> lol ruby[bot]
<leftylink> if there was ay doubt about the name of yield_with_arguments, note that it is indeed because there are args being given to `yield`
SeepingN has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<Technodrome> i'm saying, why isn't their an arg in the method definition itself leftylink ?
<leftylink> that's how the person who wrote the code decided it should be
<Technodrome> why is this legal to have a method, pass it a block, and it looks like a virgin method?
<Technodrome> i'm saying why does ruby allow this do you know? For readability its a bit too implicit
za1b1tsu has quit [Remote host closed the connection]
<leftylink> but args being given to a function don't necessarily have any relation with args being given to a block
gabschem_ has joined #ruby
<Technodrome> i'm not talking about any args going to the block, i'm saying the function is getting a block, yet the function doesn't explicitly tell us that
<leftylink> that is true
<Technodrome> i'm guessing this only works with a single block
<phaul> a block passed is not an argument. its not counted in arity and if there has to be last, and only one can be given
<Technodrome> if you want to pass more than one they would have to be arguments correct?
<Technodrome> if there is more than one though, then it has to be named correct phaul ?
<leftylink> it is not syntactically possible to pass more than one block. however one might consider passing multiple procs or lambdas as regular arguments
<phaul> block are special syntax, you can pass objects like procs or lambdas but block is not a thing
<Technodrome> sure sorry, then it would become a proc i guess
<phaul> "thing" being an object
sagax has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cyclonis_ has joined #ruby
<Technodrome> but you can define like &block correct phaul ?
<Technodrome> or does it convert it to a proc?
<phaul> & converts to proc
<rubydoc> parser error at position 0 around ` '
<leftylink> &>> def f(a, b) a[]; b[]; yield end; f(-> { puts :foo }, -> { puts :bar }) { puts :baz }
<rubydoc> # => foo (https://carc.in/#/r/7bz9)
fphilipe_ has quit [Ping timeout: 250 seconds]
<Technodrome> so the only way to access a true ruby block is with yield and not giving any argument correct?
<Technodrome> or if the block is the last argument its implicit correct?
<leftylink> but didn't you just mention &block ? because of &block, I don't think it's true that `yield` is the only way to access a block
<leftylink> &>> def f(&b) b[] end; f { puts :foo }
<rubydoc> # => foo (https://carc.in/#/r/7bza)
<Technodrome> yes so once you do &block, you would have to do a .call right?
<Technodrome> yield would no longer work?
suukim has quit [Quit: Konversation terminated!]
<leftylink> then you shoudl try it.
<phaul> &>> def f(&b) puts b.class; end; f { nil; }
<rubydoc> # => Proc (https://carc.in/#/r/7bzb)
<leftylink> because why should I let others tell me what is possible and what is not?
orbyt_ has joined #ruby
<leftylink> I should let the language tell me and see it with my own eyes
Nicmavr has quit [Read error: Connection reset by peer]
<xco> i understand Ruby fairly enough but for some reason i want to spend money to buy the print version of The Well-Ground Rubyist 3rd edition and read back to back like im’ a Ruby beginner… what do you make of this idea? Would it be impulse buying? Silly?
Nicmavr has joined #ruby
<bluemage> xco I think all books are good :9 foundations are good
haxx0r has quit [Remote host closed the connection]
sauvin has joined #ruby
<xco> bluemage: :D i hope you’re not related to the author :P
<bluemage> I get 10 cents every time I recommend it ;) ;) ;)
<bluemage> lol
<xco> but seriously i tend to forget some basic think while buried deep in deeper stuff and i think a refresher would be good or just have the book and read a few pages just to get the basics to sink in even more
<Technodrome> ok leftylink , so basically a block can only be sent to a parameter less method, otherwise its converted to a proc etc
<xco> i think a method that’s not “parameter-less” can also take a block… 🤔
<Technodrome> how?
<leftylink> how not?
<xco> :D
<Technodrome> def yield_with_arguments(num)
<Technodrome> how does this method take a block?
<leftylink> def f(a) yield end; f(p) { puts :hello }
<phaul> block passing has nothing to do with parameters
<leftylink> &>> def f(a) yield end; f(p) { puts :hello }
<rubydoc> # => hello (https://carc.in/#/r/7bzl)
<TheMoonMaster> yeah, pretty sure you can pass a block to most method calls
<TheMoonMaster> not that they'll use the block, but it'll be there
<leftylink> f took an arg, did absolutely nothing with it, and called the block
<Technodrome> do the actual arguments have to have parenthesis?
<Technodrome> when calling in that case?
hiroaki has joined #ruby
<TheMoonMaster> i think it's , based so my guess is no
<ruby[bot]> Technodrome: as I told you already, please use https://gist.github.com
<Technodrome> syntax error
<TheMoonMaster> yeah, you don't want the , there
<Technodrome> yield_with_arguments(1) { |hello, world| puts "#{hello} #{world}" }
<Technodrome> this works though
<Technodrome> yield_with_arguments 1 { |hello, world| puts "#{hello} #{world}" }
<Technodrome> this does not
<phaul> do end syntax would
<bluemage> hey ruby[bot] what if I just say pastebin
<bluemage> hey ruby[bot] what if I just say pastebin.com
<bluemage> ...
<bluemage> hey ruby[bot] what if I just say https://pastebin.com
<Technodrome> why doesn't just the {. } work phaul ?
<TheMoonMaster> it works if you use `do end`
<phaul> because the lexer thinks it's a hash
<Technodrome> yes, i get that now
<Technodrome> but with the parenthesis there its not a hash?
<phaul> no that way you remove the ambiguity
<TheMoonMaster> ^
<Technodrome> ambiguity being what? no more arguments of the standard defintiion so it has to be a block?
<TheMoonMaster> yes
<Technodrome> ok, now it makes sense, so it was a syntax error all along making me think methods couldn't have arguments with a block
<Technodrome> i wonder why ruby made blocks special in the sense that they are not arguments
<phaul> they are not even objects. if you could pass them as arguments, you could also store them in variables
<Technodrome> just block syntax with everything being a block and the argument being required in the method definition would take away all wonder
cyclonis_ has quit [Quit: -a- Connection Timed Out]
priodev has quit [Ping timeout: 248 seconds]
<phaul> they are a syntactical construct that are there to do closures, with local variable visibility they play a special role
<Technodrome> what do you mean phaul ?
<phaul> a = 1; f { a + 1 } # and you pass the environment that has local var a along with it
rippa has joined #ruby
<phaul> that allows a lot of meta programming/macro type coding
<Technodrome> sure
ltp has quit [Ping timeout: 244 seconds]
<phaul> so block are fundamentally special
<Technodrome> are you saying if it was passed as a parameter it would loose that frozen piece of the stack?
<Technodrome> lose*
<Technodrome> i mean a Proc has that environment as well when its passed correct?
<phaul> But you would create that Proc with a block, right? Point is we need syntax to exppress that
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<Technodrome> sure, my issue is not the syntax, i guess its just how the block is treated by a method once its passeed , in Groovy for instances Closures are passed as parameters , then called from within the method like a proc
<Technodrome> and of course they enclose the environment as well
<Technodrome> but you can't just assign a block to a variable right, so its not the same as a Closure in groovy , i guess more similar to a Proc
<phaul> yeah Proc is a block that has been objectified, so you can pass it. you can always do that way in ruby too, but with more syntactic noise
<Technodrome> so yeah, in Groovy unless i'm unaware thats all we have
<Technodrome> i think alot of languages have pretty much just that, i think ruby is somewhat special in that it has a few different ways of dealing with closures
cyclonis_ has joined #ruby
xco has quit [Quit: xco]
<phaul> yes, probably to keep the syntax nice
<Technodrome> like i dont think ruby has an implicit block variable if one is not defined, most languages seem to provide that
oetjenj has joined #ruby
fphilipe_ has joined #ruby
xco has joined #ruby
brool has joined #ruby
dbugger has quit [Ping timeout: 264 seconds]
leitz has joined #ruby
Technodrome has quit [Ping timeout: 245 seconds]
kinbiko has joined #ruby
Technodrome has joined #ruby
rorochan has quit [Ping timeout: 248 seconds]
<Technodrome> stupid wifi
<Technodrome> but anyways thanks phaul
<Technodrome> i'll probably need another refresh in another 2 years because i dont use ruby daily
priodev has joined #ruby
<havenwood> Technodrome: Ruby does have an experimental implicit block variable now (currently using @1).
<Technodrome> interesting
<havenwood> Technodrome: [1, 2, 3].map { "#{@1}^#{@1}" } #=> ["1^1", "2^2", "3^3"]
sameerynho has joined #ruby
<Technodrome> do you ever write iterables that take blocks?
CrazyEddy has quit [Ping timeout: 272 seconds]
<Technodrome> i wonder how it works internally, like a .each , just counts the size of the object or items, and runs yield that many times from within a loop?
<Technodrome> assuming its a very basic collection
bluemage is now known as bluemage_unstabl
bluemage_unstabl is now known as bluemage
schneider has joined #ruby
<havenwood> Technodrome: Have you ever made your own Enumerator?
<leftylink> in situations like this, it may be useful to know that ruby-doc.org has "click to toggle source". however, some results may be dsappointing as many of them may be implemented in C.
<leftylink> &ri Array#each
<Technodrome> havenwood hmm not in ruby
<havenwood> Technodrome: Sec, I'll show you examples of Enumerable and Enumerator.
<Technodrome> leftylink so essentially a loop
<al2o3-cr> Technodrome: a for loop, yes.
<Technodrome> yes , exactly how i thought it was implemented
CrazyEddy has joined #ruby
<havenwood> Technodrome: The idiomatic way to add #select, #map, etc to a class is to include Enumerable and define #each.
<Technodrome> yeah, but if you passed in an array, you would have to loop it somewhere based on size as well correct?
<Technodrome> and yield each item
<havenwood> Technodrome: Array includes Enumerable and implements #each.
<Technodrome> sure, but assuming it didn't
<Technodrome> well i guess thats stupid
<havenwood> Technodrome: You can convert an Array to an Enumerator with #each without a block: [1, 2, 3].each.class #=> Enumerator
sauvin has quit [Read error: Connection reset by peer]
<havenwood> Technodrome: #each will convert the Array to a sized Enumerator, specifically - so it has a lazily calculated #size.
<havenwood> Technodrome: The `4` in the gist above is the lazy size.
<Technodrome> yeah, pretty simple
cyclonis_ has quit [Read error: Connection reset by peer]
kapilp has quit [Quit: Connection closed for inactivity]
<havenwood> Enumerator is backed internally by a Fiber, so it has state.
<havenwood> You can rewind Enumerators.
<havenwood> I wrote a gem that actually uses a memoizing Enumerator for caching cursor based-pagination.
<Technodrome> &:to_string is just shorthand for |s| s.to_string correct?
<rubydoc> parser error at position 0 around `:'
<havenwood> Technodrome: Yes, it is. The `:to_string` is a Symbol. The ampersand in front of the Symbol does two things. It calls #to_proc on the Symbol and passes the result as a block, rather than an argument.
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<havenwood> Technodrome: It's also work with an ugly, explicit #to_proc: &:to_string.to_proc
<havenwood> It'd*
GodFather has joined #ruby
GodFather_ has joined #ruby
<Technodrome> good old ruby , this is my 4th time in 10 years revisiting this
fphilipe_ has quit [Ping timeout: 250 seconds]
<havenwood> &>> [1, 2, 3].map(&:to_s)
<rubydoc> # => ["1", "2", "3"] (https://carc.in/#/r/7bzz)
<havenwood> &>> [1, 2, 3].map(&:to_s.to_proc)
<rubydoc> # => ["1", "2", "3"] (https://carc.in/#/r/7c00)
<havenwood> &>> [1, 2, 3].map(&->(i) { i.to_s })
<rubydoc> # => ["1", "2", "3"] (https://carc.in/#/r/7c01)
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
bluemage has quit [Remote host closed the connection]
<Technodrome> havenwood couldn't they in theory just remove the & , figure it was implicit and just apply the symbol method
<havenwood> Technodrome: How would you then use a Symbol as a regular argument?
<Technodrome> is it treating &:to_s as a single arugment?
<havenwood> Technodrome: It's treating it as a block.
<Technodrome> err yeah
<havenwood> Technodrome: & means call #to_proc and pass as a block.
<Technodrome> so just send :to_s, and map should realize a block si needed
<havenwood> Technodrome: The problem is, :to_s is a perfectly valid non-block argument.
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<havenwood> Technodrome: It's just a Symbol.
<Technodrome> yeah, sure
<havenwood> Technodrome: Also, you can pass procs as arguments too - so you can't assume they're a block either.
<havenwood> Technodrome: The reason to even have the block at all, rather than just passing procs, is to save having to allocate the object.
<Technodrome> sure yeah, i get it
<havenwood> Technodrome: Recent Rubies have improved handling where a block is passed through a function, by not instantiating an intermediary object.
SeepingN has quit [Ping timeout: 258 seconds]
<Technodrome> i hate the whole proc / block part of ruby , java does it more simple
<Technodrome> but once you understand it , its easy as well, but i always run into these quirks
<Technodrome> when i come back to ruby after some time
<havenwood> I'd rather pass functions and have the block optimization somehow magically happen under the hood, but I don't mind how Ruby works with blocks and procs.
LtHummus has joined #ruby
<Technodrome> the whole way of a block in general is a bit magical how it works, not really an argument, methods have a special yield, then if its a proc its similar but now an argument etc
<Technodrome> just would have been easier to make every block a proc with a required argument then just call it from that
<havenwood> Technodrome: That would be slower and take more memory. ¯\_(ツ)_/¯
<havenwood> Technodrome: You can write Ruby that way though, as it is.
englishm has quit [Excess Flood]
<Technodrome> sure i know you can, but you know , most people use blocks and rarely use procs i assume
cyclonis_ has joined #ruby
SeepingN has joined #ruby
englishm has joined #ruby
<Technodrome> then again its one of those things where most people dont care how or why it works, it just does
<havenwood> yes, and the performant path becomes standardized.
<Technodrome> i was talking to this rails team at a local startup, and they dont really know what an eigenclass is or how all that all works, they just look at it as a class method and move on
prestorium has joined #ruby
<havenwood> Technodrome: Here's a simple re-implementation of Array#map but taking a function rather than a block: https://gist.github.com/havenwood/743065a10a1c1796f8245b1befcf9f72
queip has quit [Ping timeout: 268 seconds]
xco has quit [Quit: xco]
<Technodrome> sure thats the more normal closure type of way i do it in other languages
xco has joined #ruby
gabschem_ has quit [Remote host closed the connection]
gabschem_ has joined #ruby
yalue has quit [Quit: Leaving]
queip has joined #ruby
d9a has joined #ruby
gabschem_ has quit [Ping timeout: 250 seconds]
prestorium has quit [Quit: prestorium]
Xiti has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
cyclonis_ has quit [Read error: Connection reset by peer]
nowz has quit [Quit: WeeChat 1.6]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
nowz has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
nowz has quit [Quit: WeeChat 1.6]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cako has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
kinbiko has quit [Ping timeout: 272 seconds]
involans has quit [Quit: involans]
iffraff has joined #ruby
reber has joined #ruby
duderonomy has joined #ruby
involans has joined #ruby
prestorium has joined #ruby
grilix has quit [Quit: Ooops]
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
code_zombie has joined #ruby
conta1 has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe_ has joined #ruby
conta1 has quit [Ping timeout: 245 seconds]
oetjenj has joined #ruby
wildtrees has quit [Remote host closed the connection]
jenrzzz has joined #ruby
Xiti has quit [Quit: Xiti]
Xiti has joined #ruby
involans_ has joined #ruby
involans has quit [Ping timeout: 246 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
qbrd[m] has joined #ruby
iffraff has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
iffraff has joined #ruby
ur5us has joined #ruby
fphilipe_ has quit [Ping timeout: 264 seconds]
leitz has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 272 seconds]
r29v has joined #ruby
dogweather has joined #ruby
schneider has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
rindolf has quit [Quit: http://www.shlomifish.org/ ; Some people grow older and wiser. Not I. I grow older and more foolish.]
involans_ has quit [Quit: involans_]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe_ has joined #ruby
n13z has quit [Ping timeout: 245 seconds]
involans has joined #ruby
n13z has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
prestorium has quit [Quit: prestorium]
gabschem_ has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
ellcs has joined #ruby
graft has quit [Quit: leaving]
mb^ has quit []
gabschem_ has quit [Remote host closed the connection]
Fernando-Basso has joined #ruby
gabschem_ has joined #ruby
xco has quit [Quit: xco]
tdy has quit [Ping timeout: 245 seconds]
tsrt^ has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fernando-Basso has joined #ruby
gabschem_ has quit [Ping timeout: 250 seconds]
reber has quit [Read error: Connection reset by peer]
ltp has joined #ruby
prestorium has joined #ruby
prestorium has quit [Client Quit]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
cow[moo] has quit [Read error: Connection reset by peer]
iffraff has quit [Ping timeout: 248 seconds]
iffraff has joined #ruby
dogweather has quit [Quit: dogweather]
jenrzzz has quit [Ping timeout: 246 seconds]
kyrylo has joined #ruby
fphilipe_ has quit [Ping timeout: 264 seconds]
kyrylo has quit [Ping timeout: 245 seconds]
x86sk has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
cako has quit [Read error: Connection reset by peer]
cako has joined #ruby
sameerynho has quit [Ping timeout: 245 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
thebananaking has joined #ruby
tdy has joined #ruby
involans has quit [Quit: involans]
involans has joined #ruby
n13z has quit [Ping timeout: 248 seconds]
n13z has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has joined #ruby
<Eiam> those symptoms have more to do with people viewing these things as tools to accomplish goals like 'make this problem go away and get paid money'. the foundation upon which all advancement rests!
r29v has quit [Quit: r29v]
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
chalkmonster has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
SuperLag has quit [Remote host closed the connection]
Technodrome has joined #ruby
mozzarella has quit [Remote host closed the connection]
tdy has quit [Read error: Connection reset by peer]
mozzarella has joined #ruby
tdy has joined #ruby
drincruz_ has quit [Ping timeout: 272 seconds]
involans has quit [Quit: involans]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has quit [Ping timeout: 245 seconds]
bmurt has joined #ruby
bruce_lee has quit [Remote host closed the connection]
hiroaki has joined #ruby
bruce_lee has joined #ruby
leitz has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
leitz has quit [Quit: Leaving]
cako has quit [Read error: Connection reset by peer]
rorochan has joined #ruby
bambanx has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
duderonomy has quit [Ping timeout: 258 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
lucasb has quit [Quit: Connection closed for inactivity]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
Eiam has quit [Quit: Textual IRC Client: www.textualapp.com]
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]