havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview1: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
eddof13_ has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<johnjaye> in ruby if I want an object to take a block like a { |x| ...x } type thing do I include Enumerable and define the 'each' method?
<johnjaye> i think this is true but i don't know if the docs say that explicitly anywhere
b3lm0nt has quit [Ping timeout: 245 seconds]
eddof13_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<leftylink> *any* function can take a block. Enumerable and each have nothing to do with it
<leftylink> pandabot rb def foo; end; foo { :my_awesome_block }
<pandabot> nil - https://carc.in/#/r/fqpy
<leftylink> see? foo took a block
<johnjaye> well this is an object
<johnjaye> but i see what you mean
seydar has joined #ruby
<johnjaye> namely i was lookging in gemspec file and saw it says Gem::Specification.new do { ...
<johnjaye> so I assumed it was related to Enumerable somehow. unless it just goes over all instance variables or something
rhe has quit [*.net *.split]
ross has quit [*.net *.split]
Huckleberry777 has quit [*.net *.split]
Cork has quit [*.net *.split]
hexology has quit [*.net *.split]
eddof13 has joined #ruby
<leftylink> then we look in `initialize` for that. it's not uncommon for `initialize` to `yield self` to allow arbitrary code to be run on the object
ross has joined #ruby
hexology has joined #ruby
rhe has joined #ruby
Huckleberry777 has joined #ruby
<leftylink> pandabot rb class Foo; attr_accessor :bar; def initialize; yield self end end; Foo.new { _1.bar = 819 }
<pandabot> #<Foo:0x0000563dcdf6e1e8 @bar=819> - https://carc.in/#/r/fqq3
Cork has joined #ruby
seydar has quit [Ping timeout: 245 seconds]
<leftylink> of course, initialize may very well choose to yield something other than self. that's the decision of the author of the class.
<leftylink> and what API the class wants to offer.
<johnjaye> oh ok
<leftylink> hmmm.... if someone has sabotaged one of my classes by redefining new and allocate, is there still a way I can get an instance of that class?
<leftylink> pandabot rb class C; def self.new; :sabotaged end; def self.allocate; :sabotaged end; def goal; :congrats end end; C.new.goal
<pandabot> stderr: -e:2:in `<main>': undefined method `goal' for :sabotaged:Symbol (NoMethodError) - exit 1 - https://carc.in/#/r/fqqa
<leftylink> anything that can go in place of `C.new.goal` to correctly call goal here?
egality has quit [Remote host closed the connection]
<leftylink> okay, I guess we can just remove_method the sabotage. I'll accept that answer
<leftylink> pandabot rb class C; def self.new; :sabotaged end; def self.allocate; :sabotaged end; def goal; :congrats end end; class C; class << self; remove_method(:new) end end; C.new.goal
<pandabot> :congrats - https://carc.in/#/r/fqqd
<leftylink> congrats
seydar has joined #ruby
seydar has quit [Ping timeout: 260 seconds]
<leftylink> is it valid Ruby syntax to remove that second class C?
<leftylink> pandabot rb class C; def self.new; :sabotaged end; def self.allocate; :sabotaged end; def goal; :congrats end end; class << C; remove_method(:new) end; C.new.goal
<pandabot> :congrats - https://carc.in/#/r/fqqi
<leftylink> oh it is. okay, great.
keb has quit [Quit: Leaving]
<leftylink> now my enemies won't be able to sabotage me anymore, for if they try, I will have a ready answer for them and be able to foil their plan
<leftylink> wasn't there some conference talk that discusses this?
<leftylink> it was like a story of two people one who copied the other but didn't really understand what was going on
<leftylink> ahhhhh found it
<leftylink> it's "The Case of the Missing Method -- A Ruby Mystery Story"
<pandabot> RubyConf 2018 - The Case of the Missing Method — A Ruby Mystery Story by Nadia Odunayo by Confreaks @ 2018-11-30T17:12:50Z (1740d8h ago) 33m46s: https://youtu.be/mn2D_k-X-es
seydar has joined #ruby
seydar has quit [Ping timeout: 246 seconds]
reset has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 255 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Linux_Kerio has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
Vonter has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
seydar has joined #ruby
polishdub has quit [Read error: Connection reset by peer]
polishdub has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
rubin55 has quit [Server closed connection]
rubin55 has joined #ruby
OverCoder has joined #ruby
axsuul has quit [Quit: 👋]
axsuul has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 255 seconds]
_ht has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 245 seconds]
otisolsen70 has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 245 seconds]
constxqt_ has quit [Ping timeout: 245 seconds]
mexen has joined #ruby
grenierm has joined #ruby
CrazyEddy has quit [Ping timeout: 245 seconds]
CrazyEddy has joined #ruby
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
seydar has joined #ruby
constxqt_ has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
_ht has quit [Quit: _ht]
constxqt_ has quit [Ping timeout: 246 seconds]
otisolsen70_ has joined #ruby
otisolsen70 has quit [Ping timeout: 246 seconds]
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
hd1 has joined #ruby
hd1 has left #ruby [#ruby]
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
goldfish has joined #ruby
seydar has joined #ruby
Doc_X has quit [Ping timeout: 246 seconds]
constxqt_ has joined #ruby
teclator has joined #ruby
seydar has quit [Ping timeout: 260 seconds]
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
goldfish has quit [Ping timeout: 258 seconds]
grenierm has quit [Quit: Client closed]
taupiqueur_shiny has joined #ruby
seydar has joined #ruby
grenierm has joined #ruby
seydar has quit [Ping timeout: 245 seconds]
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
Linux_Kerio has quit [Ping timeout: 245 seconds]
willfish has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
taupiqueur_shiny has quit [Remote host closed the connection]
teclator has quit [Quit: No Ping reply in 180 seconds.]
konsolebox has joined #ruby
teclator has joined #ruby
taupiqueur_shiny has joined #ruby
seydar has joined #ruby
Fusl_ has quit [Quit: K-Lined]
seydar has quit [Ping timeout: 258 seconds]
OverCoder has quit [Quit: Connection closed for inactivity]
OverCoder has joined #ruby
Fusl has joined #ruby
grenierm has quit [Quit: Client closed]
RDMengineer has quit [Quit: Ping timeout (120 seconds)]
RDMengineer has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 255 seconds]
brokkoli_origin has quit [Quit: (Leaving)]
seydar has joined #ruby
Nixkerna- has joined #ruby
seydar has quit [Ping timeout: 245 seconds]
Nixkerna- has quit [Client Quit]
brokkoli_origin has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
taupiqueur_shiny has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
konsolebox has quit [Quit: Leaving]
teclator has quit [Ping timeout: 245 seconds]
teclator has joined #ruby
otisolsen70_ has quit [Quit: Leaving]
infinityfye has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 246 seconds]
blop has quit [Read error: Connection reset by peer]
blop_ has joined #ruby
konsolebox has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
taupiqueur_shiny has joined #ruby
seydar has joined #ruby
seydar has quit [Ping timeout: 250 seconds]
konsolebox has quit [Ping timeout: 258 seconds]
u0_a115 has joined #ruby
u0_a115 is now known as misper
seydar has joined #ruby
konsolebox has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
taupiqueur_shiny has quit [Remote host closed the connection]
Linux_Kerio has joined #ruby
seydar has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
misper has quit [Read error: Connection reset by peer]
u0_a115 has joined #ruby
seydar has quit [Ping timeout: 258 seconds]
taupiqueur_shiny has joined #ruby
u0_a115 is now known as misper
blop_ has quit [Remote host closed the connection]
blop_ has joined #ruby
graaff has quit [Server closed connection]
seydar has joined #ruby
graaff has joined #ruby
seydar has quit [Ping timeout: 255 seconds]
seydar has joined #ruby
yassernasc has joined #ruby
seydar has quit [Ping timeout: 246 seconds]
misper has quit [Ping timeout: 250 seconds]
misper has joined #ruby
seydar has joined #ruby
ctk has joined #ruby
ctk has quit [Changing host]
keb has joined #ruby
konsolebox has quit [Quit: Leaving]
yassernasc has quit [Remote host closed the connection]
misper has quit [Ping timeout: 258 seconds]
misper has joined #ruby
axsuul has quit [Quit: 👋]
taupiqueur_shiny has quit [Remote host closed the connection]
misper has quit [Read error: Connection reset by peer]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
Vonter has quit [Ping timeout: 245 seconds]
Vonter has joined #ruby
Vonter has quit [Ping timeout: 246 seconds]
eddof13 has joined #ruby
Vonter has joined #ruby
axsuul has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Vonter has quit [Read error: Connection reset by peer]
willfish has quit [Ping timeout: 246 seconds]
teclator has quit [Ping timeout: 258 seconds]
Doc_X has joined #ruby
konsolebox has joined #ruby
taupiqueur_shiny has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
taupiqueur_shiny has joined #ruby
ctk is now known as CalimeroTeknik
_ht has joined #ruby
weatheredwatcher has quit [Ping timeout: 244 seconds]
Linux_Kerio has quit [Read error: Connection reset by peer]
weatheredwatcher has joined #ruby
misper has joined #ruby
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
grenierm has joined #ruby
grenierm has quit [Ping timeout: 245 seconds]
misper has quit [Ping timeout: 258 seconds]
graaff has quit [Quit: Leaving]
misper has joined #ruby
graaff has joined #ruby
seydar has quit [Quit: leaving]
yziquel has joined #ruby
llua has quit [Ping timeout: 246 seconds]
llua has joined #ruby
infinityfye has quit [Quit: Leaving]
teclator has joined #ruby
konsolebox has quit [Ping timeout: 255 seconds]
misper has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
llua has quit [Ping timeout: 246 seconds]
llua has joined #ruby
yziquel has quit [Quit: Client closed]
Guest8 has joined #ruby
Guest8 has quit [Client Quit]
goldfish has joined #ruby
yziquel has joined #ruby
svdasein__ has quit [Ping timeout: 255 seconds]
svdasein has quit [Ping timeout: 255 seconds]
svdasein has joined #ruby
svdasein_ has joined #ruby
OverCoder has quit [Quit: Connection closed for inactivity]
misper has joined #ruby
constxqt_ has quit [Ping timeout: 258 seconds]
mexen has quit [Quit: Connection closed for inactivity]
teclator has quit [Ping timeout: 246 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
misper has quit [Ping timeout: 258 seconds]
yziquel has quit [Quit: Client closed]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
constxqt has joined #ruby
yziquel has joined #ruby
newton has quit [Server closed connection]
newton has joined #ruby