Class: BusinessFlow::DSL::ClassMethods::Inputs
- Inherits:
-
Object
- Object
- BusinessFlow::DSL::ClassMethods::Inputs
- Defined in:
- lib/business_flow/dsl.rb
Overview
Holds metadata about inputs to a flow
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
-
#needs ⇒ Object
readonly
Returns the value of attribute needs.
-
#optionals ⇒ Object
readonly
Returns the value of attribute optionals.
Instance Method Summary collapse
- #add_needs(fields) ⇒ Object
- #add_optional(fields) ⇒ Object
- #add_wants(field) ⇒ Object
-
#initialize(klass) ⇒ Inputs
constructor
A new instance of Inputs.
Constructor Details
#initialize(klass) ⇒ Inputs
Returns a new instance of Inputs.
13 14 15 16 17 |
# File 'lib/business_flow/dsl.rb', line 13 def initialize(klass) @needs = FieldList.new([], ParameterField, klass) @optionals = FieldList.new([], ParameterField, klass) @all = [] end |
Instance Attribute Details
#all ⇒ Object (readonly)
Returns the value of attribute all.
11 12 13 |
# File 'lib/business_flow/dsl.rb', line 11 def all @all end |
#needs ⇒ Object (readonly)
Returns the value of attribute needs.
11 12 13 |
# File 'lib/business_flow/dsl.rb', line 11 def needs @needs end |
#optionals ⇒ Object (readonly)
Returns the value of attribute optionals.
11 12 13 |
# File 'lib/business_flow/dsl.rb', line 11 def optionals @optionals end |
Instance Method Details
#add_needs(fields) ⇒ Object
19 20 21 22 23 |
# File 'lib/business_flow/dsl.rb', line 19 def add_needs(fields) @all += fields @all.uniq! @needs.add_fields(fields) end |
#add_optional(fields) ⇒ Object
25 26 27 28 29 |
# File 'lib/business_flow/dsl.rb', line 25 def add_optional(fields) @all += fields @all.uniq! @optionals.add_fields(fields) end |
#add_wants(field) ⇒ Object
31 32 33 34 35 |
# File 'lib/business_flow/dsl.rb', line 31 def add_wants(field) @all << field.name @all.uniq! @optionals.add_field(field) end |