Class: Bogy::FileHandler

Inherits:
Handler show all
Includes:
Writeable
Defined in:
lib/bogy/file_handler.rb

Instance Method Summary collapse

Methods inherited from Handler

#hash, #load_to_hash

Constructor Details

#initialize(path) ⇒ FileHandler

Returns a new instance of FileHandler.



5
6
7
# File 'lib/bogy/file_handler.rb', line 5

def initialize(path)
  @path = path
end

Instance Method Details

#loadObject



9
10
11
# File 'lib/bogy/file_handler.rb', line 9

def load
  YAML.load_file(@path)
end

#writeObject



13
14
15
# File 'lib/bogy/file_handler.rb', line 13

def write
  IO.write(@path, hash.to_yaml)
end