Class: ShafClient::Alps::Extension
- Inherits:
-
Object
- Object
- ShafClient::Alps::Extension
- Defined in:
- lib/shaf_client/alps/extension.rb
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(id:, href: nil, value: nil) ⇒ Extension
constructor
A new instance of Extension.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, href: nil, value: nil) ⇒ Extension
Returns a new instance of Extension.
6 7 8 9 10 |
# File 'lib/shaf_client/alps/extension.rb', line 6 def initialize(id:, href: nil, value: nil) @id = id.to_sym @href = href @value = value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
22 23 24 25 26 27 |
# File 'lib/shaf_client/alps/extension.rb', line 22 def method_missing(method_name, *args, &block) name = method_name.to_s return super unless name.end_with? '?' id.to_s == name[0..-2] end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
4 5 6 |
# File 'lib/shaf_client/alps/extension.rb', line 4 def href @href end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/shaf_client/alps/extension.rb', line 4 def id @id end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/shaf_client/alps/extension.rb', line 4 def value @value end |
Instance Method Details
#to_h ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/shaf_client/alps/extension.rb', line 12 def to_h { id: id, href: href, value: value, } end |