Class: Pipefitter::Inventory

Inherits:
Object
  • Object
show all
Defined in:
lib/pipefitter/inventory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Inventory

Returns a new instance of Inventory.



8
9
10
11
# File 'lib/pipefitter/inventory.rb', line 8

def initialize(path)
  @path = path
  FileUtils.mkdir_p(path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/pipefitter/inventory.rb', line 6

def path
  @path
end

Instance Method Details

#get(key) ⇒ Object



18
19
20
# File 'lib/pipefitter/inventory.rb', line 18

def get(key)
  data[key]
end

#put(key, value) ⇒ Object



13
14
15
16
# File 'lib/pipefitter/inventory.rb', line 13

def put(key, value) 
  data[key] = value
  save
end