You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not understand this safe import. Does this allow "if bond.testing" ? Why do we need the DUMMY_BOND name, can't we just assign to bond directly?
begin
require 'bond'
rescue LoadError
module BondTargetable
DUMMY_BOND = Class.new { def method_missing(meth, *args); end }.new
def self.included(base); base.extend(BondTargetable); end
def bond; DUMMY_BOND; end
end
end
The text was updated successfully, but these errors were encountered:
It doesn't allow for 'if bond.testing' at the moment; good point. I created
DUMMY_BOND so that it isn't creating and instantiating a new class on each
call to Bond, since this is supposed to be for production code, but it's
definitely not ideal. I was hoping to discuss some of the implementation
details with you when we met these week because there are some oddities
that I was hoping to get your opinion on.
Erik
On Wednesday, October 21, 2015, George Necula [email protected]
wrote:
I do not understand this safe import. Does this allow "if bond.testing" ?
Why do we need the DUMMY_BOND name, can't we just assign to bond directly?
begin
require 'bond'
rescue LoadError
module BondTargetable
DUMMY_BOND = Class.new { def method_missing(meth, *args); end }.new
def self.included(base); base.extend(BondTargetable); end
def bond; DUMMY_BOND; end
end
end
—
Reply to this email directly or view it on GitHub #16.
I do not understand this safe import. Does this allow "if bond.testing" ? Why do we need the DUMMY_BOND name, can't we just assign to bond directly?
begin
require 'bond'
rescue LoadError
module BondTargetable
DUMMY_BOND = Class.new { def method_missing(meth, *args); end }.new
def self.included(base); base.extend(BondTargetable); end
def bond; DUMMY_BOND; end
end
end
The text was updated successfully, but these errors were encountered: