Class: RSpecSystem::Node
- Inherits:
-
Object
- Object
- RSpecSystem::Node
- Includes:
- InternalHelpers
- 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.
Methods included from InternalHelpers
#custom_prefabs_path, #rspec_destroy, #rspec_system_config, #rspec_system_node_set, #rspec_system_tmp, #rspec_virtual_env, #start_nodes, #stop_nodes
Constructor Details
#initialize(options) ⇒ Node
Create a new node object.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rspec-system/node.rb', line 36 def initialize() @name = [:name] prefab = [:prefab] = [: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.
16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec-system/node.rb', line 16 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.
77 78 79 |
# File 'lib/rspec-system/node.rb', line 77 def facts @facts end |
#inspect ⇒ String
Return name when inspected
105 106 107 |
# File 'lib/rspec-system/node.rb', line 105 def inspect name end |
#name ⇒ String
Returns the name of the node as specified in the nodeset file.
56 57 58 |
# File 'lib/rspec-system/node.rb', line 56 def name @name end |
#nodeset ⇒ RSpecSystem::NodeSet
Returns the nodeset this node belongs in.
84 85 86 |
# File 'lib/rspec-system/node.rb', line 84 def nodeset @nodeset end |
#options ⇒ Hash
Returns the custom object for this node (if any).
70 71 72 |
# File 'lib/rspec-system/node.rb', line 70 def end |
#prefab ⇒ RSpecSystem::Prefab
Returns the prefab object for this node (if any).
63 64 65 |
# File 'lib/rspec-system/node.rb', line 63 def prefab @prefab end |
#provider_specifics ⇒ Hash
Return provider specific settings
91 92 93 |
# File 'lib/rspec-system/node.rb', line 91 def provider_specifics @provider_specifics end |
#to_s ⇒ String
Return name when stringified
98 99 100 |
# File 'lib/rspec-system/node.rb', line 98 def to_s name end |