Class: ActiveData::Model::Attributes::Collection

Inherits:
Attribute
  • Object
show all
Defined in:
lib/active_data/model/attributes/collection.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #owner

Instance Method Summary collapse

Methods inherited from Attribute

#default, #defaultize, #enum, #enumerize, #normalize, #write

Methods inherited from Base

#initialize, #inspect_attribute, #pollute, #query, #readonly?, #reflection, #reset, #typecast, #value_present?, #write, #write_value

Constructor Details

This class inherits a constructor from ActiveData::Model::Attributes::Base

Instance Method Details

#readObject



5
6
7
8
9
# File 'lib/active_data/model/attributes/collection.rb', line 5

def read
  @value ||= normalize(read_before_type_cast.map do |value|
    enumerize(typecast(value))
  end)
end

#read_before_type_castObject



11
12
13
# File 'lib/active_data/model/attributes/collection.rb', line 11

def read_before_type_cast
  @value_before_type_cast ||= Array.wrap(@value_cache).map { |value| defaultize(value) }
end