Class: Igniter::Contracts::Contractable::Definition
- Inherits:
-
Struct
- Object
- Struct
- Igniter::Contracts::Contractable::Definition
- Defined in:
- lib/igniter/contracts/contractable.rb
Instance Attribute Summary collapse
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#role ⇒ Object
Returns the value of attribute role.
-
#stage ⇒ Object
Returns the value of attribute stage.
Instance Method Summary collapse
-
#initialize(method_name:, inputs: [], outputs: [], role: nil, stage: nil, metadata: {}) ⇒ Definition
constructor
A new instance of Definition.
- #to_h ⇒ Object
Constructor Details
#initialize(method_name:, inputs: [], outputs: [], role: nil, stage: nil, metadata: {}) ⇒ Definition
Returns a new instance of Definition.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/igniter/contracts/contractable.rb', line 62 def initialize(method_name:, inputs: [], outputs: [], role: nil, stage: nil, metadata: {}) super( method_name: method_name.to_sym, inputs: inputs.map(&:to_sym).freeze, outputs: outputs.map(&:to_sym).freeze, role: role&.to_sym, stage: stage&.to_sym, metadata: .dup.freeze ) freeze end |
Instance Attribute Details
#inputs ⇒ Object
Returns the value of attribute inputs
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def inputs @inputs end |
#metadata ⇒ Object
Returns the value of attribute metadata
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def @metadata end |
#method_name ⇒ Object
Returns the value of attribute method_name
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def method_name @method_name end |
#outputs ⇒ Object
Returns the value of attribute outputs
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def outputs @outputs end |
#role ⇒ Object
Returns the value of attribute role
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def role @role end |
#stage ⇒ Object
Returns the value of attribute stage
61 62 63 |
# File 'lib/igniter/contracts/contractable.rb', line 61 def stage @stage end |
Instance Method Details
#to_h ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/igniter/contracts/contractable.rb', line 74 def to_h { method_name: method_name, inputs: inputs, outputs: outputs, role: role, stage: stage, metadata: .dup }.compact end |