Class: Smartdown::Model::Flow

Inherits:
Object
  • Object
show all
Defined in:
lib/smartdown/model/flow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, nodes = []) ⇒ Flow

Returns a new instance of Flow.



6
7
8
9
# File 'lib/smartdown/model/flow.rb', line 6

def initialize(name, nodes = [])
  @name = name
  @nodes = nodes
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/smartdown/model/flow.rb', line 4

def name
  @name
end

#nodesObject (readonly)

Returns the value of attribute nodes.



4
5
6
# File 'lib/smartdown/model/flow.rb', line 4

def nodes
  @nodes
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/smartdown/model/flow.rb', line 19

def ==(other)
  other.is_a?(self.class) && other.nodes == self.nodes && other.name == self.name
end

#coversheetObject



11
12
13
# File 'lib/smartdown/model/flow.rb', line 11

def coversheet
  node(name)
end

#node(node_name) ⇒ Object



15
16
17
# File 'lib/smartdown/model/flow.rb', line 15

def node(node_name)
  @nodes.find {|n| n.name.to_s == node_name.to_s } || raise("Unable to find #{node_name}")
end