Class: PluckMap::Relationships::Base

Inherits:
StructuredAttribute show all
Defined in:
lib/pluck_map/relationships/base.rb

Direct Known Subclasses

Many, One

Instance Attribute Summary collapse

Attributes inherited from StructuredAttribute

#attributes

Attributes inherited from Attribute

#block, #id, #indexes, #model, #name, #selects, #value

Instance Method Summary collapse

Methods inherited from StructuredAttribute

#nested?, #will_map?

Methods inherited from Attribute

#==, #apply, #eql?, #exec, #hash, #nested?, #preload!, #to_ruby, #value?, #values, #will_map?

Constructor Details

#initialize(attribute_name, scope, block, options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/pluck_map/relationships/base.rb', line 8

def initialize(attribute_name, scope, block, options)
  @scope = scope
  @scope = @scope.instance_exec(&options[:scope_block]) if options[:scope_block]
  super(attribute_name, scope.klass, block, options)
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



6
7
8
# File 'lib/pluck_map/relationships/base.rb', line 6

def scope
  @scope
end