Class: Bogus::UndefinedReturnValue

Inherits:
Object
  • Object
show all
Defined in:
lib/bogus/stubbing/undefined_return_value.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interaction) ⇒ UndefinedReturnValue

Returns a new instance of UndefinedReturnValue.



3
4
5
# File 'lib/bogus/stubbing/undefined_return_value.rb', line 3

def initialize(interaction)
  @interaction = InteractionPresenter.new(interaction)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

Raises:

  • (NoMethodError)


11
12
13
# File 'lib/bogus/stubbing/undefined_return_value.rb', line 11

def method_missing(name, *args, &block)
  raise NoMethodError, "undefined method '#{name}' for #{self}"
end

Class Method Details

.undefined?(value) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bogus/stubbing/undefined_return_value.rb', line 15

def self.undefined?(value)
  value.is_a?(self)
end

Instance Method Details

#to_sObject



7
8
9
# File 'lib/bogus/stubbing/undefined_return_value.rb', line 7

def to_s
  "#<UndefinedReturnValue for #{@interaction}>"
end