Class: RestModel::Relation

Inherits:
Association show all
Includes:
Response
Defined in:
lib/rest_model/key/relation.rb,
lib/rest_model/key/relation/builder.rb,
lib/rest_model/key/relation/response.rb

Defined Under Namespace

Modules: Builder, Response

Instance Attribute Summary

Attributes inherited from Association

#many

Attributes inherited from Key

#model, #name, #options, #summarize

Instance Method Summary collapse

Methods included from Response

#to_relation, #to_resource

Methods inherited from Association

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

Methods inherited from Key

#convert_input_keys, #present?, #root_path?, #source_path, #visible?

Constructor Details

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

Returns a new instance of Relation.



6
7
8
9
# File 'lib/rest_model/key/relation.rb', line 6

def initialize(name, options = {})
  super
  @has = options.fetch(:has, false)
end

Instance Method Details

#belongs?Boolean

Returns:



15
16
17
# File 'lib/rest_model/key/relation.rb', line 15

def belongs?
  !has?
end

#from_source(value, resource = nil) ⇒ Object Also known as: parse



19
20
21
# File 'lib/rest_model/key/relation.rb', line 19

def from_source(value, resource = nil)
  nil
end

#has?Boolean

Returns:



11
12
13
# File 'lib/rest_model/key/relation.rb', line 11

def has?
  @has
end