Class: BusinessFlow::DSL::ClassMethods::Inputs

Inherits:
Object
  • Object
show all
Defined in:
lib/business_flow/dsl.rb

Overview

Holds metadata about inputs to a flow

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#allObject (readonly)

Returns the value of attribute all.



11
12
13
# File 'lib/business_flow/dsl.rb', line 11

def all
  @all
end

#needsObject (readonly)

Returns the value of attribute needs.



11
12
13
# File 'lib/business_flow/dsl.rb', line 11

def needs
  @needs
end

#optionalsObject (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