Class: Interscript::Node::Item::Stage

Inherits:
Interscript::Node::Item show all
Defined in:
lib/interscript/node/item/stage.rb,
lib/interscript/visualize/nodes.rb

Instance Attribute Summary collapse

Attributes inherited from Interscript::Node::Item

#item

Instance Method Summary collapse

Methods inherited from Interscript::Node::Item

#+, try_convert

Constructor Details

#initialize(name, map: nil) ⇒ Stage

Returns a new instance of Stage.



4
5
6
7
# File 'lib/interscript/node/item/stage.rb', line 4

def initialize(name, map: nil)
  self.name = name
  self.map = map
end

Instance Attribute Details

#mapObject

Returns the value of attribute map.



3
4
5
# File 'lib/interscript/node/item/stage.rb', line 3

def map
  @map
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/interscript/node/item/stage.rb', line 2

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/interscript/node/item/stage.rb', line 16

def ==(other)
  super && self.name == other.name && self.map == other.map
end

#inspectObject



20
21
22
23
24
25
26
# File 'lib/interscript/node/item/stage.rb', line 20

def inspect
  if map
    "map.#{@map}.stage.#{@name}"
  else
    "stage.#{@name}"
  end
end

#to_hashObject



9
10
11
12
13
14
# File 'lib/interscript/node/item/stage.rb', line 9

def to_hash
  { :class => self.class.to_s,
    :name => name,
    :map => map,
  }
end

#to_html(doc) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/interscript/visualize/nodes.rb', line 14

def to_html(doc)
  if map
    n = doc.dep_aliases[map].full_name
    "stage #{name.to_s.gsub("_", " ")} from map #{n}"
  else
    "#{name.to_s.gsub("_", " ")}"
  end
end