Class: Fog::Associations::OracleManyIdentities

Inherits:
OracleDefault
  • Object
show all
Defined in:
lib/fog/oracle/models/associations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OracleDefault

#create_setter

Constructor Details

#initialize(model, name, collection_name, options) ⇒ OracleManyIdentities

Returns a new instance of OracleManyIdentities.



69
70
71
72
# File 'lib/fog/oracle/models/associations.rb', line 69

def initialize(model, name, collection_name, options)
  @all_name = options[:all_name]
  super(model, name, collection_name, options)
end

Instance Attribute Details

#all_nameObject (readonly)

Returns the value of attribute all_name.



67
68
69
# File 'lib/fog/oracle/models/associations.rb', line 67

def all_name
  @all_name
end

Instance Method Details

#create_getterObject



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fog/oracle/models/associations.rb', line 74

def create_getter
  super

  model.class_eval <<-EOS, __FILE__, __LINE__
    def #{all_name}
      return [] if associations[:#{name}].nil?
      data = Array(associations[:#{name}]).map do |association|
        service.send(self.class.associations[:#{name}]).get(association)
      end
      #{association_class}.new(data)
    end
  EOS
end