Class: Kitchen::Driver::VmpoolStores::FileStore

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/driver/vmpool_stores/file_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ FileStore

Returns a new instance of FileStore.

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 11

def initialize(options = nil)
  raise ArgumentError unless options['pool_file']
  options ||= { 'pool_file' => 'vmpool.yaml' }
  @pool_file = options['pool_file']
end

Instance Attribute Details

#pool_fileObject (readonly)

Returns the value of attribute pool_file.



8
9
10
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 8

def pool_file
  @pool_file
end

Instance Method Details

#createObject



22
23
24
25
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 22

def create
  write_content(base_content)
  read
end

#pool_dataObject



37
38
39
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 37

def pool_data
  @pool_data ||= YAML.load(read_content)
end

#readObject



27
28
29
30
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 27

def read
  puts "Reading snippet"
  read_content
end

#saveObject



32
33
34
35
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 32

def save
  write_content
  read
end

#update(content) ⇒ Object



17
18
19
20
# File 'lib/kitchen/driver/vmpool_stores/file_store.rb', line 17

def update(content)
  write_content(content)
  read
end