module DomainModel::ClassMethods

Public Instance Methods

field(*args) click to toggle source
# File lib/domain_model.rb, line 97
def field(*args)
  fields << (field = Field.new(*args))
  attr_accessor(field.name)
end
fields() click to toggle source
# File lib/domain_model.rb, line 102
def fields
  @fields ||= begin
    superclass.include?(DomainModel) ? (superclass.fields.dup) : []
  end
end
from_primitive(primitive) click to toggle source
# File lib/domain_model.rb, line 114
def from_primitive(primitive)
  Deserializer.deserialize(self, primitive)
end
validate(*args, &block) click to toggle source
# File lib/domain_model.rb, line 93
def validate(*args, &block)
  validations << Validation.new(*args, &block)
end
validations() click to toggle source
# File lib/domain_model.rb, line 108
def validations
  @validations ||= begin
    superclass.include?(DomainModel) ? (superclass.validations.dup) : []
  end
end