Class: RSpecSystem::Node
- Inherits:
-
Object
- Object
- RSpecSystem::Node
- Defined in:
- lib/rspec-system/node.rb
Overview
This class represents a node in a nodeset
Class Method Summary collapse
-
.node_from_yaml(nodeset, k, v) ⇒ RSpecSystem::Node
Static helper for generating a node direct from the hash returned by the nodeset YAML file.
Instance Method Summary collapse
-
#facts ⇒ Hash
Retreives facts from the nodeset definition or prefab.
-
#initialize(options) ⇒ Node
constructor
Create a new node object.
-
#name ⇒ String
Returns the name of the node as specified in the nodeset file.
-
#nodeset ⇒ RSpecSystem::NodeSet
Returns the nodeset this node belongs in.
-
#prefab ⇒ RSpecSystem::Prefab
Returns the prefab object for this node (if any).
-
#provider_specifics ⇒ Hash
Return provider specific settings.
Constructor Details
#initialize(options) ⇒ Node
Create a new node object.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rspec-system/node.rb', line 26 def initialize() @name = [:name] prefab = [:prefab] @nodeset = [:nodeset] if prefab.nil? # TODO: do not support not prefabs yet raise "No prefab defined, bailing" else @prefab = RSpecSystem::Prefab.prefab(prefab) @facts = @prefab.facts @provider_specifics = @prefab.provider_specifics end end |
Class Method Details
.node_from_yaml(nodeset, k, v) ⇒ RSpecSystem::Node
Static helper for generating a node direct from the hash returned by the nodeset YAML file.
11 12 13 14 15 16 17 |
# File 'lib/rspec-system/node.rb', line 11 def self.node_from_yaml(nodeset, k, v) RSpecSystem::Node.new( :nodeset => nodeset, :name => k, :prefab => v['prefab'] ) end |
Instance Method Details
#facts ⇒ Hash
Retreives facts from the nodeset definition or prefab.
58 59 60 |
# File 'lib/rspec-system/node.rb', line 58 def facts @facts end |
#name ⇒ String
Returns the name of the node as specified in the nodeset file.
44 45 46 |
# File 'lib/rspec-system/node.rb', line 44 def name @name end |
#nodeset ⇒ RSpecSystem::NodeSet
Returns the nodeset this node belongs in.
65 66 67 |
# File 'lib/rspec-system/node.rb', line 65 def nodeset @nodeset end |
#prefab ⇒ RSpecSystem::Prefab
Returns the prefab object for this node (if any).
51 52 53 |
# File 'lib/rspec-system/node.rb', line 51 def prefab @prefab end |
#provider_specifics ⇒ Hash
Return provider specific settings
72 73 74 |
# File 'lib/rspec-system/node.rb', line 72 def provider_specifics @provider_specifics end |