Module: ValidationReflection::MacroReflection

Defined in:
lib/validation_reflection/active_model.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



42
43
44
# File 'lib/validation_reflection/active_model.rb', line 42

def attributes
  [self.name]
end

#kindObject



34
35
36
# File 'lib/validation_reflection/active_model.rb', line 34

def kind
  self.macro.to_s.match(/^[a-z]+_([a-z]+)/)[1].to_sym
end

#kind=(kind) ⇒ Object



38
39
40
# File 'lib/validation_reflection/active_model.rb', line 38

def kind=(kind)
  self.instance_variable_set('@macro', "validates_#{kind}_of".to_sym)
end