Class: Dao::Gateway::ScopeTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/dao/gateway/scope_transformer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity) ⇒ ScopeTransformer

Returns a new instance of ScopeTransformer.



8
9
10
11
12
13
14
15
16
# File 'lib/dao/gateway/scope_transformer.rb', line 8

def initialize(entity)
  @associations = []
  @entity = entity

  @pipe = Pipe.new
  @pipe.postprocess(Dao::Gateway::EntityProcessor.new(entity))

  add_processors
end

Instance Attribute Details

#associationsObject

Returns the value of attribute associations.



6
7
8
# File 'lib/dao/gateway/scope_transformer.rb', line 6

def associations
  @associations
end

#entityObject (readonly)

Returns the value of attribute entity.



4
5
6
# File 'lib/dao/gateway/scope_transformer.rb', line 4

def entity
  @entity
end

#pipeObject (readonly)

Returns the value of attribute pipe.



5
6
7
# File 'lib/dao/gateway/scope_transformer.rb', line 5

def pipe
  @pipe
end

Instance Method Details

#export_attributes_black_listObject



30
31
32
# File 'lib/dao/gateway/scope_transformer.rb', line 30

def export_attributes_black_list
  []
end

#many(relation) ⇒ Object



18
19
20
# File 'lib/dao/gateway/scope_transformer.rb', line 18

def many(relation)
  transform(relation)
end

#one(relation) ⇒ Object



22
23
24
# File 'lib/dao/gateway/scope_transformer.rb', line 22

def one(relation)
  transform(Array(relation)).first
end

#other(relation) ⇒ Object



26
27
28
# File 'lib/dao/gateway/scope_transformer.rb', line 26

def other(relation)
  relation
end