class GuidedPath::Node

Attributes

label[RW]
next_node[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/guided_path/node.rb, line 8
def initialize(args = {})

  raise(ArgumentError, "Options must be a hash") unless args.kind_of?(Hash)
  args = args.symbolize_keys
  @label = args[:label]

  @next_node = (args[:next_node] || args[:goto])
  @next_node = @next_node.to_s.strip if @next_node

end

Public Instance Methods

next_node=(value) click to toggle source
# File lib/guided_path/node.rb, line 19
def next_node=(value)
  @next_node = value
end
to_hash() click to toggle source
# File lib/guided_path/node.rb, line 23
def to_hash
  output = {}
  if @next_node
    output[:next_node] = @next_node.respond_to?(:label) ? @next_node.label : @next_node.to_s
  end

  output 
end