Module: Transcriber::Resource::Builder

Includes:
Embeddable::Builder, Property::Builder, Relation::Builder
Included in:
Transcriber::Resource
Defined in:
lib/transcriber/resource/builder.rb

Instance Method Summary collapse

Methods included from Property::Builder

#id, #properties, #property

Methods included from Embeddable::Builder

#embeds, #embeds_many, #embeds_one

Methods included from Relation::Builder

#belongs_to, #has_many, #has_one, #relation

Instance Method Details

#key(key) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/transcriber/resource/builder.rb', line 8

def key(key)
  fail "you can't define a key with name '#{key.name}'" if not_allowed?(key)
  key.model = self
  attr_accessor key.name
  self.keys  << key
  self.id_key = key if key.options[:id]
end

#summarizes(*args) ⇒ Object



16
17
18
19
20
21
# File 'lib/transcriber/resource/builder.rb', line 16

def summarizes(*args)
  args.each do |name|
    key = keys.find {|key| key.name == name}
    summarized_keys << key if key
  end
end