Class: SObjectModel::Schema::Relations

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sobject_model/schema.rb

Instance Method Summary collapse

Constructor Details

#initialize(relations) ⇒ Relations

Returns a new instance of Relations.



230
231
232
# File 'lib/sobject_model/schema.rb', line 230

def initialize(relations)
  @relations = relations.map{|r| Relation.new(name: r[:name], field: r[:field], class_name: r[:class_name])}
end

Instance Method Details

#each(&block) ⇒ Object



234
235
236
# File 'lib/sobject_model/schema.rb', line 234

def each(&block)
  relations.each(&block)
end

#find(name) ⇒ Object



242
243
244
# File 'lib/sobject_model/schema.rb', line 242

def find(name)
  relations.find{|r| r.name == name.to_sym}
end

#namesObject



238
239
240
# File 'lib/sobject_model/schema.rb', line 238

def names
  map(&:name).sort
end