module Obvious::EntityMixin::ClassMethods

Attributes

shape[R]
validations[R]

Public Instance Methods

validation(name, method) click to toggle source
# File lib/obvious/entity.rb, line 22
def validation name, method
  name = "#{name}_validation".to_sym
  @validations ||= [] 
  @validations << name 
  define_method(name) { instance_exec &method }
end
value(name, type) click to toggle source
# File lib/obvious/entity.rb, line 15
def value name, type 
  name = name.to_sym
  @shape ||= {}
  @shape[name] = type   
  define_method(name) { @values[name] }
end