Module: Saver::ClassMethods

Defined in:
lib/saver.rb

Instance Method Summary collapse

Instance Method Details

#save_attribute(attribute, options = {}) ⇒ Object



18
19
20
21
# File 'lib/saver.rb', line 18

def save_attribute(attribute, options = {})
  key "#{attribute}_saver", String
  self.savers[attribute] = options[:method] || :to_s
end

#save_attributes(*attributes) ⇒ Object



12
13
14
15
16
# File 'lib/saver.rb', line 12

def save_attributes(*attributes)
  attributes.each do |attr|
    save_attribute(attr)
  end
end

#saversObject



23
24
25
# File 'lib/saver.rb', line 23

def savers
  @savers ||= {}
end