Class: ImpExp::Utils::RelationScoper

Inherits:
Service
  • Object
show all
Defined in:
app/services/imp_exp/utils/relation_scoper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(records, relation_class, scoping_parent) ⇒ RelationScoper

Returns a new instance of RelationScoper.



8
9
10
11
12
13
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 8

def initialize(records, relation_class, scoping_parent)
  super()
  @records = records
  @relation_class = relation_class
  @scoping_parent = scoping_parent
end

Instance Attribute Details

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6

def records
  @records
end

#relation_classObject (readonly)

Returns the value of attribute relation_class.



6
7
8
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6

def relation_class
  @relation_class
end

#scoping_parentObject (readonly)

Returns the value of attribute scoping_parent.



6
7
8
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6

def scoping_parent
  @scoping_parent
end

Instance Method Details

#callObject



15
16
17
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 15

def call
  records.where(id: imp_exp_model.scoped(scoping_parent))
end