Class: Controlrepo::Node
- Inherits:
-
Object
- Object
- Controlrepo::Node
- Defined in:
- lib/controlrepo/node.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#beaker_node ⇒ Object
Returns the value of attribute beaker_node.
-
#fact_set ⇒ Object
Returns the value of attribute fact_set.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(name) ⇒ Node
Returns a new instance of Node.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/controlrepo/node.rb', line 12 def initialize(name) @name = name @beaker_node = nil # If we can't find the factset it will fail, so just catch that error and ignore it begin @fact_set = Controlrepo.facts[(Controlrepo.facts_files.index{|facts_file| File.basename(facts_file,'.json') == name})] rescue TypeError @fact_set = nil end @@all << self end |
Instance Attribute Details
#beaker_node ⇒ Object
Returns the value of attribute beaker_node.
9 10 11 |
# File 'lib/controlrepo/node.rb', line 9 def beaker_node @beaker_node end |
#fact_set ⇒ Object
Returns the value of attribute fact_set.
10 11 12 |
# File 'lib/controlrepo/node.rb', line 10 def fact_set @fact_set end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/controlrepo/node.rb', line 8 def name @name end |
Class Method Details
.all ⇒ Object
39 40 41 |
# File 'lib/controlrepo/node.rb', line 39 def self.all @@all end |
.find(node_name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/controlrepo/node.rb', line 26 def self.find(node_name) @@all.each do |node| if node_name.is_a?(Controlrepo::Node) if node = node_name return node end elsif node.name == node_name return node end end nil end |