mossplix has quit [Remote host closed the connection]
mroutis has quit [Remote host closed the connection]
cthu| has quit [Read error: Connection reset by peer]
AJA4351 has joined #ruby
cthu| has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
lucasb has quit [Quit: Connection closed for inactivity]
JohanP has joined #ruby
sameerynho has quit [Ping timeout: 240 seconds]
fphilipe has joined #ruby
JohanP has quit [Ping timeout: 250 seconds]
fphilipe has quit [Ping timeout: 265 seconds]
mossplix has joined #ruby
AJA4351 has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
Emmanuel_Chanel has joined #ruby
jottr has quit [Ping timeout: 246 seconds]
chalkmonster has quit [Ping timeout: 240 seconds]
<dorian>
question: is there a way to tell yard to link to something in a different gem?
mossplix has joined #ruby
<dorian>
like if i want to @see Superclass#method where Superclass is in some other gem
edwardly has joined #ruby
edwardly has joined #ruby
edwardly has quit [Changing host]
mossplix has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Quit: AJA4350]
poontangmessiah has joined #ruby
bmurt has joined #ruby
Esa_ has joined #ruby
poontangmessiah has quit [Quit: Leaving]
schne1der has quit [Ping timeout: 265 seconds]
zlogan has quit [Ping timeout: 246 seconds]
skx86 has joined #ruby
mokha has joined #ruby
mokha has quit [Ping timeout: 265 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 250 seconds]
wildtrees has quit [Quit: Leaving]
itarato has joined #ruby
Esa_ has quit [Ping timeout: 250 seconds]
<itarato>
Hi! I have a pretty made up use case - but the techique behind is just way over my head to understand. I saw this in a gem:
<itarato>
`(Promise.new { 1 }).class === Integer`
<itarato>
This `new` returns 1 from the block. First - how can something change the return of new and how can a different something be that class (Int instead of Promise)?
<itarato>
Without overriding `new` or returning anything from `initialize`.
<itarato>
In my example I used `class` on purpose so it's not a `to_s` or `to_ary`.
<mozzarella>
itarato: BasicObject doesn't have a class method, so the method_missing delegates it to the "result" object
<itarato>
Oh I see. So my question is how is that called on the integer instead of the `Promise` instance?
<itarato>
Since the code instantiates a promise and all of those methods are defined on promise.
<mozzarella>
do you know about method_missing? it's a special method that's called when there's no method found with the specified name
akem__ has joined #ruby
<itarato>
Yes, if you call an unknown method on an instance.
<itarato>
And after `respond_to?` said true.
<itarato>
The debugger only able to stop in `method_missing` - and at that point the instance is already replaced to the integer - so I cannot confirm at what point the swap happened.
<itarato>
Or if it's a swap or not.
akemhp_ has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
<mozzarella>
not sure I'm understanding you
akem__ has quit [Ping timeout: 250 seconds]
<itarato>
It starts with a `Promise.new` call where we pass a block that returns an Int. This, as far as I know should return an instance for Promise. However inside the Promise class `self.class` says Integer.
<itarato>
Even `self.class.ancestors` does not have Promise inside Promise.
<mozzarella>
because Promise doesn't have a class method
<mozzarella>
you only get a class method if you inherit from Object, whereas BasicObject has the strict minimum only
<itarato>
Hmmmm
<mozzarella>
the .class you're getting is from the "result" that's contained inside the promise
<mozzarella>
>> BasicObject.new.class
<ruby[bot]>
mozzarella: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<itarato>
So techically the class is still Promise but calling `class` is in disguise?
fphilipe has joined #ruby
<itarato>
Or lets say delegated?
<mozzarella>
it's being delegated to the result object, from the method_missing method
<itarato>
Right. That might be. Thanks so much for the pointers! Super helpful!!
al2o3-cr has quit [Read error: Connection reset by peer]
iNs has quit [Read error: Connection reset by peer]
lineus has quit [Read error: Connection reset by peer]
galaxie has quit [Write error: Connection reset by peer]
akosednar_ has joined #ruby
iNs has joined #ruby
akosednar has quit [Ping timeout: 246 seconds]
galaxie has joined #ruby
_phaul has quit [Ping timeout: 252 seconds]
lineus has joined #ruby
al2o3-cr has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
_phaul has joined #ruby
drincruz has joined #ruby
drincruz_ has quit [Ping timeout: 246 seconds]
grilix has quit [Ping timeout: 252 seconds]
_phaul has quit [Ping timeout: 250 seconds]
_phaul has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 246 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
im0nde_ has joined #ruby
_phaul has joined #ruby
im0nde has quit [Ping timeout: 250 seconds]
_phaul has quit [Ping timeout: 250 seconds]
_phaul has joined #ruby
itarato has joined #ruby
itarato has left #ruby [#ruby]
itarato has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
fphilipe has joined #ruby
_phaul has joined #ruby
fphilipe has quit [Ping timeout: 246 seconds]
gix- has joined #ruby
gix has quit [Disconnected by services]
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
Swyper has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
Swyper has quit [Remote host closed the connection]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
itarato has quit [Ping timeout: 252 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
RiPuk_ has joined #ruby
_phaul has joined #ruby
RiPuk has quit [Ping timeout: 265 seconds]
Mrbuck has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
_phaul has joined #ruby
cd has quit [Quit: cd]
_phaul has quit [Ping timeout: 268 seconds]
_phaul has joined #ruby
akemhp_ has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
akemhp_ has quit [Remote host closed the connection]
ropeney has quit [Ping timeout: 240 seconds]
akemhp has quit [Ping timeout: 268 seconds]
_phaul has joined #ruby
gix- has quit [Ping timeout: 265 seconds]
_phaul has quit [Ping timeout: 240 seconds]
fphilipe has joined #ruby
_phaul has joined #ruby
ropeney has joined #ruby
fphilipe has quit [Ping timeout: 240 seconds]
_phaul has quit [Ping timeout: 252 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 252 seconds]
Mrbuck has quit [Remote host closed the connection]
_phaul has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
infinityfye has joined #ruby
_whitelogger has joined #ruby
dionysus69 has joined #ruby
_whitelogger has joined #ruby
zlogan has joined #ruby
troulouliou_dev has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
mossplix has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
skx86 has quit [Quit: Connection closed for inactivity]
kapil_ has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
kapil_ has joined #ruby
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
mossplix has joined #ruby
DTZUZO has quit [Ping timeout: 250 seconds]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
DTZUZO has joined #ruby
mossplix has quit [Ping timeout: 265 seconds]
dionysus69 has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
Esa_ has joined #ruby
DTZUZO has joined #ruby
<cxl>
Hi, what's the most idiomatic way to `File.delete file` and not raise if `file` doesn't exist? Is `FileUtils.rm file, force: true` the way to go?
mossplix has joined #ruby
mossplix has quit [Ping timeout: 246 seconds]
DTZUZO has quit [Ping timeout: 276 seconds]
DTZUZO has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
Fernando-Basso has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
Omnilord has joined #ruby
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
fphilipe has joined #ruby
DTZUZO has joined #ruby
helpa has quit [Remote host closed the connection]
infinityfye has quit [Read error: Connection reset by peer]
DTZUZO has joined #ruby
mr-kumar has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
mr-kumar has quit [Client Quit]
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
fphilipe has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
dionysus69 has joined #ruby
mr-kumar has joined #ruby
mr-kumar has quit [Client Quit]
fphilipe has quit [Ping timeout: 240 seconds]
mr-kumar has joined #ruby
DTZUZO has quit [Ping timeout: 250 seconds]
skx86 has joined #ruby
DTZUZO has joined #ruby
AJA4350 has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #ruby
hiroaki has joined #ruby
hiroaki has quit [Remote host closed the connection]
hiroaki has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
ellcs1 has quit [Ping timeout: 245 seconds]
DTZUZO has joined #ruby
nofxx has joined #ruby
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #ruby
bruce_lee has quit [Ping timeout: 246 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
DTZUZO has quit [Ping timeout: 276 seconds]
DTZUZO has joined #ruby
TCZ has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
gix has joined #ruby
PaulePanter has quit [Remote host closed the connection]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
Omnilord has quit [Quit: Leaving]
fphilipe has joined #ruby
conta has quit [Quit: conta]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
drincruz has quit [Ping timeout: 265 seconds]
Mrbuck has joined #ruby
lakrivite[m] has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
johnny56_ has joined #ruby
DTZUZO has joined #ruby
johnny56_ has quit [Remote host closed the connection]
johnny56_ has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
DTZUZO has joined #ruby
Swyper has joined #ruby
Mrbuck has quit [Remote host closed the connection]
mossplix has joined #ruby
DTZUZO has quit [Ping timeout: 276 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
rapha has quit [Quit: WeeChat 2.3]
DTZUZO has joined #ruby
Mrbuck has joined #ruby
<havenwood>
cxl: Yes, or the alias: FileUtils.remove file, force: true
DTZUZO has quit [Ping timeout: 245 seconds]
<havenwood>
cxl: Or: File.delete file if File.exist? file
<havenwood>
cxl: Short answer, "yes."
mossplix has quit [Remote host closed the connection]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
vrih_ has quit [Ping timeout: 252 seconds]
RiPuk has joined #ruby
RiPuk_ has quit [Read error: Connection reset by peer]
cd has joined #ruby
vrih has joined #ruby
<xpitr>
or FileUtils.rm_f for short
DTZUZO has joined #ruby
TCZ has quit [Quit: Bye Bye]
PaulePanter has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
<havenwood>
or its alias: FileUtils.safe_unlink file
<havenwood>
xpitr: Good point, nicer to not have a keyword argument.
<havenwood>
cxl: ^
DTZUZO has joined #ruby
akemhp has joined #ruby
drincruz has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
vrih has quit [Ping timeout: 240 seconds]
vrih has joined #ruby
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
drincruz has quit [Ping timeout: 250 seconds]
dionysus69 has quit [Read error: Connection reset by peer]
vrih has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
vrih has joined #ruby
<xpitr>
hm so i have some class, that has something like attr_accessor :foo, :bar; @foo = Foo.new(self); @bar = Bar.new(self) . is there clean way to have both Foo and Bar have access to each other through that?
DTZUZO has joined #ruby
<xpitr>
with this example^ Bar will have access to Foo but not other way around. the workaround is kinda ugly
Mrbuck has quit [Remote host closed the connection]
skx86 has quit [Quit: Connection closed for inactivity]
dionysus69 has quit [Ping timeout: 252 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
<havenwood>
xpitr: Show the code?
<havenwood>
xpitr: I don't quite follow from what you've written.
reber has joined #ruby
mossplix has joined #ruby
suukim has joined #ruby
<havenwood>
xpitr: Why does Foo not have access to Bar?
<xpitr>
yeah something like this is workaround i mentioned. create both instances first, then manually assign self to both
<leftylink>
to do it in one expression requires that the variable be bound before its value is even known, I would be surprised if it were possible
mossplix has quit [Ping timeout: 268 seconds]
akemhp_ is now known as akem
DTZUZO has quit [Ping timeout: 268 seconds]
_phaul has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
<leftylink>
if it suits your purposes, it may be possible to make at least one of the two lazily computed, but the only real purpose of this would be to create the two in one expression; I don't really see any additional advantages of it
DTZUZO has joined #ruby
<leftylink>
so that would look something like
<leftylink>
&>> A = Struct.new(:b); B = Struct.new(:af) { def a; @a ||= af[] end }; a = A.new(b = B.new(->{a})); [a.b == b, b.a == a]