Class: QueryInterface::Server::Transformations::TransformationScope
- Inherits:
-
Object
- Object
- QueryInterface::Server::Transformations::TransformationScope
- Defined in:
- lib/query-interface-server/transformations.rb
Instance Attribute Summary collapse
-
#excludes ⇒ Object
Returns the value of attribute excludes.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#orders ⇒ Object
Returns the value of attribute orders.
-
#withs ⇒ Object
Returns the value of attribute withs.
Instance Method Summary collapse
- #auto_exclude(*names) ⇒ Object
- #auto_filter(*names) ⇒ Object
- #exclude(name, &block) ⇒ Object
- #filter(name, &block) ⇒ Object
-
#initialize ⇒ TransformationScope
constructor
A new instance of TransformationScope.
- #order(name, &block) ⇒ Object
- #with(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ TransformationScope
Returns a new instance of TransformationScope.
47 48 49 50 51 52 |
# File 'lib/query-interface-server/transformations.rb', line 47 def initialize self.excludes = {} self.filters = {} self.withs = {} self.orders = {} end |
Instance Attribute Details
#excludes ⇒ Object
Returns the value of attribute excludes.
45 46 47 |
# File 'lib/query-interface-server/transformations.rb', line 45 def excludes @excludes end |
#filters ⇒ Object
Returns the value of attribute filters.
45 46 47 |
# File 'lib/query-interface-server/transformations.rb', line 45 def filters @filters end |
#orders ⇒ Object
Returns the value of attribute orders.
45 46 47 |
# File 'lib/query-interface-server/transformations.rb', line 45 def orders @orders end |
#withs ⇒ Object
Returns the value of attribute withs.
45 46 47 |
# File 'lib/query-interface-server/transformations.rb', line 45 def withs @withs end |
Instance Method Details
#auto_exclude(*names) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/query-interface-server/transformations.rb', line 54 def auto_exclude(*names) names.each do |name| self.excludes[name] = Proc.new do |param| exclude(Sequel.qualify(model.table_name, name) => param) end end end |
#auto_filter(*names) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/query-interface-server/transformations.rb', line 62 def auto_filter(*names) names.each do |name| self.filters[name] = Proc.new do |param| filter(Sequel.qualify(model.table_name, name) => param) end end end |
#exclude(name, &block) ⇒ Object
70 71 72 |
# File 'lib/query-interface-server/transformations.rb', line 70 def exclude(name, &block) self.excludes[name] = block end |
#filter(name, &block) ⇒ Object
74 75 76 |
# File 'lib/query-interface-server/transformations.rb', line 74 def filter(name, &block) self.filters[name] = block end |
#order(name, &block) ⇒ Object
82 83 84 |
# File 'lib/query-interface-server/transformations.rb', line 82 def order(name, &block) self.orders[name] = block end |
#with(name, &block) ⇒ Object
78 79 80 |
# File 'lib/query-interface-server/transformations.rb', line 78 def with(name, &block) self.withs[name] = block end |