Class: VerifiedDouble::SimpleDouble
- Inherits:
-
Object
- Object
- VerifiedDouble::SimpleDouble
- Defined in:
- lib/verified_double/simple_double.rb
Instance Attribute Summary collapse
-
#internal ⇒ Object
readonly
Returns the value of attribute internal.
Instance Method Summary collapse
- #build_recorded_method_signature(method) ⇒ Object
- #class_double? ⇒ Boolean
- #class_name ⇒ Object
-
#initialize(internal) ⇒ SimpleDouble
constructor
A new instance of SimpleDouble.
- #method_operator ⇒ Object
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
#internal ⇒ Object (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
21 22 23 |
# File 'lib/verified_double/simple_double.rb', line 21 def class_double? internal.respond_to?(:verified_class_double?) end |
#class_name ⇒ Object
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_operator ⇒ Object
25 26 27 |
# File 'lib/verified_double/simple_double.rb', line 25 def method_operator class_double? ? '.' : '#' end |