Class: PluckMap::Relationships::Base
- Inherits:
-
StructuredAttribute
- Object
- Attribute
- StructuredAttribute
- PluckMap::Relationships::Base
- Defined in:
- lib/pluck_map/relationships/base.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Attributes inherited from StructuredAttribute
Attributes inherited from Attribute
#block, #id, #indexes, #model, #name, #selects, #value
Instance Method Summary collapse
-
#initialize(attribute_name, scope, block, options) ⇒ Base
constructor
A new instance of Base.
Methods inherited from StructuredAttribute
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, ) @scope = scope @scope = @scope.instance_exec(&[:scope_block]) if [:scope_block] super(attribute_name, scope.klass, block, ) end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
6 7 8 |
# File 'lib/pluck_map/relationships/base.rb', line 6 def scope @scope end |