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, custom_prefabs_path) ⇒ 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.
-
#inspect ⇒ String
Return name when inspected.
-
#name ⇒ String
Returns the name of the node as specified in the nodeset file.
-
#nodeset ⇒ RSpecSystem::NodeSet
Returns the nodeset this node belongs in.
-
#options ⇒ Hash
Returns the custom object for this node (if any).
-
#prefab ⇒ RSpecSystem::Prefab
Returns the prefab object for this node (if any).
-
#provider_specifics ⇒ Hash
Return provider specific settings.
-
#to_s ⇒ String
Return name when stringified.
Constructor Details
#initialize(options) ⇒ Node
Create a new node object.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rspec-system/node.rb', line 34 def initialize() @name = [:name] prefab = [:prefab] @options = [:options] @nodeset = [:nodeset] @custom_prefabs_path = [:custom_prefabs_path] if prefab.nil? # TODO: do not support not prefabs yet raise "No prefab defined, bailing" else @prefab = RSpecSystem::Prefab.prefab(prefab, @custom_prefabs_path) @facts = @prefab.facts @provider_specifics = @prefab.provider_specifics end end |
Class Method Details
.node_from_yaml(nodeset, k, v, custom_prefabs_path) ⇒ RSpecSystem::Node
Static helper for generating a node direct from the hash returned by the nodeset YAML file.
14 15 16 17 18 19 20 21 22 |
# File 'lib/rspec-system/node.rb', line 14 def self.node_from_yaml(nodeset, k, v, custom_prefabs_path) RSpecSystem::Node.new( :nodeset => nodeset, :custom_prefabs_path => custom_prefabs_path, :name => k, :prefab => v['prefab'], :options => v['options'] ) end |
Instance Method Details
#facts ⇒ Hash
Retreives facts from the nodeset definition or prefab.
75 76 77 |
# File 'lib/rspec-system/node.rb', line 75 def facts @facts end |
#inspect ⇒ String
Return name when inspected
103 104 105 |
# File 'lib/rspec-system/node.rb', line 103 def inspect name end |
#name ⇒ String
Returns the name of the node as specified in the nodeset file.
54 55 56 |
# File 'lib/rspec-system/node.rb', line 54 def name @name end |
#nodeset ⇒ RSpecSystem::NodeSet
Returns the nodeset this node belongs in.
82 83 84 |
# File 'lib/rspec-system/node.rb', line 82 def nodeset @nodeset end |
#options ⇒ Hash
Returns the custom object for this node (if any).
68 69 70 |
# File 'lib/rspec-system/node.rb', line 68 def @options end |
#prefab ⇒ RSpecSystem::Prefab
Returns the prefab object for this node (if any).
61 62 63 |
# File 'lib/rspec-system/node.rb', line 61 def prefab @prefab end |
#provider_specifics ⇒ Hash
Return provider specific settings
89 90 91 |
# File 'lib/rspec-system/node.rb', line 89 def provider_specifics @provider_specifics end |
#to_s ⇒ String
Return name when stringified
96 97 98 |
# File 'lib/rspec-system/node.rb', line 96 def to_s name end |