class Bogy
Constants
- VERSION
Public Class Methods
new(options = {})
click to toggle source
# File lib/bogy.rb, line 8 def initialize(options = {}) # If user provides incorrect number of arguments (not one) raise ArgumentError, "wrong number of arguments (#{options.length} for 1)" unless options.length == 1 @handler = HandlerManager.find_handler(options) end
Public Instance Methods
[](key)
click to toggle source
# File lib/bogy.rb, line 15 def [](key) @handler.hash[key] end
[]=(key, value)
click to toggle source
# File lib/bogy.rb, line 19 def []=(key, value) @handler.hash[key] = value @handler.write if @handler.is_a? Writeable end
delete(key)
click to toggle source
# File lib/bogy.rb, line 24 def delete(key) deleted = @handler.hash.delete(key) @handler.write if @handler.is_a? Writeable deleted end
to_h()
click to toggle source
# File lib/bogy.rb, line 30 def to_h @handler.hash end
to_yaml()
click to toggle source
# File lib/bogy.rb, line 34 def to_yaml @handler.hash.to_yaml end
write_to_file(path)
click to toggle source
# File lib/bogy.rb, line 38 def write_to_file(path) IO.write(path, @handler.hash.to_yaml) end