Class: Chake::Node
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #backend ⇒ Object
-
#initialize(hostname, data = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(hostname, data = {}) ⇒ Node
Returns a new instance of Node.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chake/node.rb', line 18 def initialize(hostname, data = {}) uri = URI.parse(hostname) if !uri.scheme && !uri.host && uri.path uri = URI.parse("ssh://#{hostname}") end if uri.path.empty? uri.path = nil end @backend_name = uri.scheme @hostname = uri.hostname @username = uri.user || Etc.getpwuid.name @path = uri.path || "/var/tmp/chef.#{username}" @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
16 17 18 |
# File 'lib/chake/node.rb', line 16 def data @data end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
13 14 15 |
# File 'lib/chake/node.rb', line 13 def hostname @hostname end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
15 16 17 |
# File 'lib/chake/node.rb', line 15 def path @path end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
14 15 16 |
# File 'lib/chake/node.rb', line 14 def username @username end |