Class: Metaractor::Parameters::Parameter
- Inherits:
-
Object
- Object
- Metaractor::Parameters::Parameter
- Includes:
- Comparable
- Defined in:
- lib/metaractor/parameters.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #[](key) ⇒ Object
- #dig(name, *names) ⇒ Object
- #has_key?(key) ⇒ Boolean
-
#initialize(name, **options) ⇒ Parameter
constructor
A new instance of Parameter.
- #merge!(**options) ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(name, **options) ⇒ Parameter
Returns a new instance of Parameter.
26 27 28 29 |
# File 'lib/metaractor/parameters.rb', line 26 def initialize(name, **) @name = name.to_sym @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/metaractor/parameters.rb', line 24 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
31 32 33 34 35 |
# File 'lib/metaractor/parameters.rb', line 31 def <=>(other) return nil unless other.instance_of? self.class return nil if name == other.name && != other. name.to_s <=> other.name.to_s end |
#[](key) ⇒ Object
37 38 39 |
# File 'lib/metaractor/parameters.rb', line 37 def [](key) @options[key] end |
#dig(name, *names) ⇒ Object
45 46 47 |
# File 'lib/metaractor/parameters.rb', line 45 def dig(name, *names) @options.dig(name, *names) end |
#has_key?(key) ⇒ Boolean
41 42 43 |
# File 'lib/metaractor/parameters.rb', line 41 def has_key?(key) @options.has_key?(key) end |
#merge!(**options) ⇒ Object
49 50 51 |
# File 'lib/metaractor/parameters.rb', line 49 def merge!(**) @options.merge!(**) end |
#to_s ⇒ Object
53 54 55 |
# File 'lib/metaractor/parameters.rb', line 53 def to_s name.to_s end |
#to_sym ⇒ Object
57 58 59 |
# File 'lib/metaractor/parameters.rb', line 57 def to_sym name end |