class Conflagration
Constants
- Unset
- VERSION
Public Class Methods
attribute(name, *args)
click to toggle source
Calls superclass method
# File lib/conflagration.rb, line 17 def self.attribute name, *args super name, *args define_method "#{name}!" do val = public_send(name) raise Unset.new "'#{name}' is not sent" unless val.present? val end end
path(new_path=nil)
click to toggle source
# File lib/conflagration.rb, line 13 def self.path new_path=nil new_path ? (@path = new_path) : @path end
read()
click to toggle source
# File lib/conflagration.rb, line 27 def self.read new JSON.parse File.read path end
Public Instance Methods
update(attrs)
click to toggle source
# File lib/conflagration.rb, line 31 def update attrs attrs.each { |k,v| send "#{k}=", v } File.write self.class.path, JSON.pretty_generate(as_json) end