Class: CrossStub::Stubber::Klass

Inherits:
Object
  • Object
show all
Defined in:
lib/cross-stub/stubber.rb

Instance Method Summary collapse

Constructor Details

#initialize(thing) ⇒ Klass

Returns a new instance of Klass.



113
114
115
# File 'lib/cross-stub/stubber.rb', line 113

def initialize(thing)
  @thing = thing
end

Instance Method Details

#has_method?(method) ⇒ Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/cross-stub/stubber.rb', line 125

def has_method?(method)
  @thing.respond_to?(method)
end

#m_eval(str) ⇒ Object



117
118
119
# File 'lib/cross-stub/stubber.rb', line 117

def m_eval(str)
  (class << @thing ; self ; end).instance_eval(str)
end

#t_eval(str) ⇒ Object



121
122
123
# File 'lib/cross-stub/stubber.rb', line 121

def t_eval(str)
  @thing.instance_eval(str)
end