Class: SfCli::Sf::Sobject::Schema::Relations

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sf_cli/sf/sobject/schema.rb

Instance Method Summary collapse

Constructor Details

#initialize(relations) ⇒ Relations

Returns a new instance of Relations.



231
232
233
# File 'lib/sf_cli/sf/sobject/schema.rb', line 231

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



235
236
237
# File 'lib/sf_cli/sf/sobject/schema.rb', line 235

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

#find(name) ⇒ Object



243
244
245
# File 'lib/sf_cli/sf/sobject/schema.rb', line 243

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

#namesObject



239
240
241
# File 'lib/sf_cli/sf/sobject/schema.rb', line 239

def names
  map(&:name).sort
end