Class: Gardefou::CallSignature
- Inherits:
-
Object
- Object
- Gardefou::CallSignature
- Defined in:
- lib/gardefou/storage.rb
Overview
Utility class for creating call signatures for duplicate detection
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#fn_name ⇒ Object
readonly
Returns the value of attribute fn_name.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(fn_name, args, kwargs) ⇒ CallSignature
constructor
A new instance of CallSignature.
- #to_s ⇒ Object
Constructor Details
#initialize(fn_name, args, kwargs) ⇒ CallSignature
Returns a new instance of CallSignature.
9 10 11 12 13 |
# File 'lib/gardefou/storage.rb', line 9 def initialize(fn_name, args, kwargs) @fn_name = fn_name @args = args @kwargs = kwargs end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
7 8 9 |
# File 'lib/gardefou/storage.rb', line 7 def args @args end |
#fn_name ⇒ Object (readonly)
Returns the value of attribute fn_name.
7 8 9 |
# File 'lib/gardefou/storage.rb', line 7 def fn_name @fn_name end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
7 8 9 |
# File 'lib/gardefou/storage.rb', line 7 def kwargs @kwargs end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
25 26 27 |
# File 'lib/gardefou/storage.rb', line 25 def ==(other) other.is_a?(CallSignature) && to_s == other.to_s end |
#hash ⇒ Object
29 30 31 |
# File 'lib/gardefou/storage.rb', line 29 def hash to_s.hash end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/gardefou/storage.rb', line 15 def to_s # Create deterministic string representation sorted_kwargs = @kwargs.sort.to_h { fn_name: @fn_name, args: @args, kwargs: sorted_kwargs }.to_json end |