Class: Dao::Gateway::ScopeTransformer
- Inherits:
-
Object
- Object
- Dao::Gateway::ScopeTransformer
- Defined in:
- lib/dao/gateway/scope_transformer.rb
Instance Attribute Summary collapse
-
#associations ⇒ Object
Returns the value of attribute associations.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#pipe ⇒ Object
readonly
Returns the value of attribute pipe.
Instance Method Summary collapse
- #export_attributes_black_list ⇒ Object
-
#initialize(entity) ⇒ ScopeTransformer
constructor
A new instance of ScopeTransformer.
- #many(relation) ⇒ Object
- #one(relation) ⇒ Object
- #other(relation) ⇒ Object
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
#associations ⇒ Object
Returns the value of attribute associations.
6 7 8 |
# File 'lib/dao/gateway/scope_transformer.rb', line 6 def associations @associations end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
4 5 6 |
# File 'lib/dao/gateway/scope_transformer.rb', line 4 def entity @entity end |
#pipe ⇒ Object (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_list ⇒ Object
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 |