Class: MetadataPresenter::Flow

Inherits:
Metadata
  • Object
show all
Defined in:
app/models/metadata_presenter/flow.rb

Instance Attribute Summary collapse

Attributes inherited from Metadata

#metadata

Instance Method Summary collapse

Methods inherited from Metadata

#==, #editor?, #id, #method_missing, #respond_to_missing?, #to_json, #type

Constructor Details

#initialize(uuid, flow) ⇒ Flow

Returns a new instance of Flow.



5
6
7
8
9
# File 'app/models/metadata_presenter/flow.rb', line 5

def initialize(uuid, flow)
  @uuid = uuid

  super(flow)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MetadataPresenter::Metadata

Instance Attribute Details

#uuidObject (readonly)

Returns the value of attribute uuid.



3
4
5
# File 'app/models/metadata_presenter/flow.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#all_destination_uuidsObject



19
20
21
# File 'app/models/metadata_presenter/flow.rb', line 19

def all_destination_uuids
  conditionals.map(&:next).append(default_next)
end

#branch?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/metadata_presenter/flow.rb', line 11

def branch?
  type == 'flow.branch'
end

#conditionalsObject



23
24
25
26
27
# File 'app/models/metadata_presenter/flow.rb', line 23

def conditionals
  Array(['next']['conditionals']).map do ||
    Conditional.new()
  end
end

#default_nextObject



15
16
17
# File 'app/models/metadata_presenter/flow.rb', line 15

def default_next
  ['next']['default']
end

#group_by_pageObject



29
30
31
# File 'app/models/metadata_presenter/flow.rb', line 29

def group_by_page
  conditionals.group_by(&:next)
end