Class: Integrity::Author

Inherits:
DataMapper::Type
  • Object
show all
Defined in:
lib/integrity/author.rb

Defined Under Namespace

Classes: AuthorStruct

Class Method Summary collapse

Class Method Details

.dump(value, property) ⇒ Object



25
26
27
28
29
# File 'lib/integrity/author.rb', line 25

def self.dump(value, property)
  return nil if value.nil?

  value.to_s
end

.load(value, property) ⇒ Object



21
22
23
# File 'lib/integrity/author.rb', line 21

def self.load(value, property)
  AuthorStruct.parse(value) unless value.nil?
end

.typecast(value, property) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/integrity/author.rb', line 31

def self.typecast(value, property)
  case value
  when AuthorStruct then value
  when NilClass     then load(nil, property)
  else load(value.to_s, property)
  end
end