Class Lafcadio::ObjectField
In: lafcadio/objectField.rb
lafcadio/test.rb
Parent: Object

ObjectField is the abstract base class of any field for domain objects. Fields can be added to a domain class using DomainObject.string, DomainObject.integer, etc.

  class User < Lafcadio::DomainObject
    string 'fname'
    date   'birthday'
  end

All fields accept the following arguments in hashes:

not_nil
This is true by default. Set it to false to avoid checking for nil values in tests.
db_field_name
By default, fields are assumed to have the same name in the database, but you can override this assumption using db_field_name.
  class User < Lafcadio::DomainObject
    string 'fname', { 'not_nil' => false }
    date   'birthday', { 'db_field_name' => 'bday' }
  end

Methods

Included Modules

Comparable

Attributes

db_field_name  [RW] 
domain_class  [R] 
mock_value  [W] 
name  [R] 
not_nil  [RW] 

Public Class methods

domain_class
The domain class that this field belongs to.
name
The name of this field.

Public Instance methods

Returns a string value suitable for committing this field’s value to MySQL.

Given the SQL value string, returns a Ruby-native value.

[Validate]