Class: Transcriber::Resource::Embeddable

Inherits:
Association show all
Includes:
Parser::Embeddable, Response::Embeddable
Defined in:
lib/transcriber/resource/key/embeddable.rb

Instance Attribute Summary collapse

Attributes inherited from Association

#many

Attributes inherited from Key

#model, #name, #options, #summarize

Instance Method Summary collapse

Methods included from Response::Embeddable

#to_resource

Methods included from Parser::Embeddable

#digg, #from_hash, #parse, #parse_fields, #to_input

Methods inherited from Association

#create_from_hash, #default_class_name, #from_hash, #many?, #one?, #resource_class, #update_from_hash

Methods inherited from Key

#convert_input_keys, #input_path, #present?, #root_path?, #visible?

Constructor Details

#initialize(name, options = {}) ⇒ Embeddable

Returns a new instance of Embeddable.



9
10
11
12
13
14
15
16
# File 'lib/transcriber/resource/key/embeddable.rb', line 9

def initialize(name, options = {})
  super

  if fields = options[:fields]
    @class_name = :array
    @fields = fields
  end
end

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields.



7
8
9
# File 'lib/transcriber/resource/key/embeddable.rb', line 7

def fields
  @fields
end

Instance Method Details

#raw?Boolean

Returns:



18
19
20
# File 'lib/transcriber/resource/key/embeddable.rb', line 18

def raw?
  [Hash, Array].include?(resource_class)
end