Class: GunDog::CallRecord
- Inherits:
-
Object
- Object
- GunDog::CallRecord
- Defined in:
- lib/gun_dog/call_record.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#cyclical ⇒ Object
writeonly
Sets the attribute cyclical.
-
#internal ⇒ Object
writeonly
Sets the attribute internal.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#return_value ⇒ Object
Returns the value of attribute return_value.
-
#stack ⇒ Object
Returns the value of attribute stack.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #class_method? ⇒ Boolean
- #cyclical? ⇒ Boolean
-
#initialize(klass, method_name, class_method: false) ⇒ CallRecord
constructor
A new instance of CallRecord.
- #internal? ⇒ Boolean
- #method_location ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(klass, method_name, class_method: false) ⇒ CallRecord
Returns a new instance of CallRecord.
24 25 26 27 28 |
# File 'lib/gun_dog/call_record.rb', line 24 def initialize(klass, method_name, class_method: false) @klass = klass @method_name = method_name @class_method = class_method end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/gun_dog/call_record.rb', line 3 def args @args end |
#cyclical=(value) ⇒ Object (writeonly)
Sets the attribute cyclical
6 7 8 |
# File 'lib/gun_dog/call_record.rb', line 6 def cyclical=(value) @cyclical = value end |
#internal=(value) ⇒ Object (writeonly)
Sets the attribute internal
6 7 8 |
# File 'lib/gun_dog/call_record.rb', line 6 def internal=(value) @internal = value end |
#method_name ⇒ Object
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/gun_dog/call_record.rb', line 3 def method_name @method_name end |
#return_value ⇒ Object
Returns the value of attribute return_value.
3 4 5 |
# File 'lib/gun_dog/call_record.rb', line 3 def return_value @return_value end |
#stack ⇒ Object
Returns the value of attribute stack.
4 5 6 |
# File 'lib/gun_dog/call_record.rb', line 4 def stack @stack end |
Class Method Details
.from_json(json) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gun_dog/call_record.rb', line 8 def self.from_json(json) cr = new(const_get(json['klass']), json['method_name'], class_method: json['class_method']) cr.instance_eval do @internal = json['internal'] @cyclical = json['cyclical'] @args = json['args'] @return_value = json['return_value'] @stack = json['stack'] end cr end |
Instance Method Details
#as_json ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/gun_dog/call_record.rb', line 50 def as_json { "klass" => @klass, "method_name" => method_name, "class_method" => class_method?, "internal" => internal?, "cyclical" => cyclical?, "args" => args, "return_value" => return_value, "stack" => stack }.reject { |_,v| v.nil? } end |
#class_method? ⇒ Boolean
42 43 44 |
# File 'lib/gun_dog/call_record.rb', line 42 def class_method? !!@class_method end |
#cyclical? ⇒ Boolean
38 39 40 |
# File 'lib/gun_dog/call_record.rb', line 38 def cyclical? !!@cyclical end |
#internal? ⇒ Boolean
34 35 36 |
# File 'lib/gun_dog/call_record.rb', line 34 def internal? !!@internal end |
#method_location ⇒ Object
30 31 32 |
# File 'lib/gun_dog/call_record.rb', line 30 def method_location "#{@klass}#{method_separator}#{method_name}" end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/gun_dog/call_record.rb', line 46 def to_s "def #{method_name}(#{type_signatures(args)}) => #{return_value}" end |