Class: Tinychef::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/tinychef/node.rb

Defined Under Namespace

Classes: NofileError

Constant Summary collapse

EXT =
'.json'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Node

Returns a new instance of Node.



12
13
14
15
16
# File 'lib/tinychef/node.rb', line 12

def initialize(name)
  @name = name
  normalize_name
  find_file
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/tinychef/node.rb', line 10

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/tinychef/node.rb', line 10

def path
  @path
end

Instance Method Details

#hostObject



18
19
20
# File 'lib/tinychef/node.rb', line 18

def host
  path.basename.to_s.gsub(EXT, '')
end