Class: Igniter::Contracts::Contractable::DefinitionBuilder
- Inherits:
-
Object
- Object
- Igniter::Contracts::Contractable::DefinitionBuilder
- Defined in:
- lib/igniter/contracts/contractable.rb
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
-
#role_value ⇒ Object
readonly
Returns the value of attribute role_value.
-
#stage_value ⇒ Object
readonly
Returns the value of attribute stage_value.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(method_name) ⇒ DefinitionBuilder
constructor
A new instance of DefinitionBuilder.
- #input(name) ⇒ Object
- #meta(key, value) ⇒ Object
- #output(name) ⇒ Object
- #role(value) ⇒ Object
- #stage(value) ⇒ Object
Constructor Details
#initialize(method_name) ⇒ DefinitionBuilder
Returns a new instance of DefinitionBuilder.
89 90 91 92 93 94 95 96 |
# File 'lib/igniter/contracts/contractable.rb', line 89 def initialize(method_name) @method_name = method_name.to_sym @inputs = [] @outputs = [] @metadata = {} @role_value = nil @stage_value = nil end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def inputs @inputs end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def @metadata end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def method_name @method_name end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def outputs @outputs end |
#role_value ⇒ Object (readonly)
Returns the value of attribute role_value.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def role_value @role_value end |
#stage_value ⇒ Object (readonly)
Returns the value of attribute stage_value.
87 88 89 |
# File 'lib/igniter/contracts/contractable.rb', line 87 def stage_value @stage_value end |
Instance Method Details
#build ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/igniter/contracts/contractable.rb', line 118 def build Definition.new( method_name: method_name, inputs: inputs, outputs: outputs, role: role_value, stage: stage_value, metadata: ) end |
#input(name) ⇒ Object
98 99 100 |
# File 'lib/igniter/contracts/contractable.rb', line 98 def input(name, **) inputs << name.to_sym end |
#meta(key, value) ⇒ Object
114 115 116 |
# File 'lib/igniter/contracts/contractable.rb', line 114 def (key, value) [key.to_sym] = value end |
#output(name) ⇒ Object
102 103 104 |
# File 'lib/igniter/contracts/contractable.rb', line 102 def output(name, **) outputs << name.to_sym end |
#role(value) ⇒ Object
106 107 108 |
# File 'lib/igniter/contracts/contractable.rb', line 106 def role(value) @role_value = value.to_sym end |
#stage(value) ⇒ Object
110 111 112 |
# File 'lib/igniter/contracts/contractable.rb', line 110 def stage(value) @stage_value = value.to_sym end |