Class: VerifiedDouble::SimpleDouble

Inherits:
Object
  • Object
show all
Defined in:
lib/verified_double/simple_double.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(internal) ⇒ SimpleDouble

Returns a new instance of SimpleDouble.



5
6
7
# File 'lib/verified_double/simple_double.rb', line 5

def initialize(internal)
  @internal = internal
end

Instance Attribute Details

#internalObject (readonly)

Returns the value of attribute internal.



3
4
5
# File 'lib/verified_double/simple_double.rb', line 3

def internal
  @internal
end

Instance Method Details

#build_recorded_method_signature(method) ⇒ Object



9
10
11
12
13
14
# File 'lib/verified_double/simple_double.rb', line 9

def build_recorded_method_signature(method)
  RecordedMethodSignature.new(
    class_name: class_name,
    method_operator: method_operator,
    method: method.to_s)
end

#class_double?Boolean

Returns:



21
22
23
# File 'lib/verified_double/simple_double.rb', line 21

def class_double?
  internal.respond_to?(:verified_class_double?)
end

#class_nameObject



17
18
19
# File 'lib/verified_double/simple_double.rb', line 17

def class_name
  class_double? ? internal.name : internal.instance_variable_get('@name')
end

#method_operatorObject



25
26
27
# File 'lib/verified_double/simple_double.rb', line 25

def method_operator
  class_double? ? '.' : '#'
end