Module: Cieloz::Helpers

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/cieloz/helpers.rb', line 51

def self.included base
  base.send :include, ActiveModel::Validations
  base.extend ClassMethods
  base.class_eval do
    alias :_valid? :valid?
    attr_accessor :source, :opts
  end
  base.send :include, InstanceMethods
end

Instance Method Details

#attributes=(attrs) ⇒ Object



65
66
67
68
69
70
# File 'lib/cieloz/helpers.rb', line 65

def attributes= attrs
  attrs.each {|k,v|
    m = "#{k}="
    send(m, v) if respond_to? m
  }
end

#initialize(attrs = {}) ⇒ Object



61
62
63
# File 'lib/cieloz/helpers.rb', line 61

def initialize attrs={}
  self.attributes = attrs
end