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.
-
#updates ⇒ Object
Returns the value of attribute updates.
-
#withs ⇒ Object
Returns the value of attribute withs.
Instance Method Summary collapse
- #auto_exclude(*names) ⇒ Object
- #auto_filter(*names) ⇒ Object
- #auto_update(*names) ⇒ Object
- #exclude(name, &block) ⇒ Object
- #filter(name, &block) ⇒ Object
-
#initialize ⇒ TransformationScope
constructor
A new instance of TransformationScope.
- #order(name, &block) ⇒ Object
- #update(name, &block) ⇒ Object
- #with(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ TransformationScope
Returns a new instance of TransformationScope.
49 50 51 52 53 54 55 |
# File 'lib/query-interface-server/transformations.rb', line 49 def initialize self.excludes = {} self.filters = {} self.withs = {} self.orders = {} self.updates = {} end |
Instance Attribute Details
#excludes ⇒ Object
Returns the value of attribute excludes.
47 48 49 |
# File 'lib/query-interface-server/transformations.rb', line 47 def excludes @excludes end |
#filters ⇒ Object
Returns the value of attribute filters.
47 48 49 |
# File 'lib/query-interface-server/transformations.rb', line 47 def filters @filters end |
#orders ⇒ Object
Returns the value of attribute orders.
47 48 49 |
# File 'lib/query-interface-server/transformations.rb', line 47 def orders @orders end |
#updates ⇒ Object
Returns the value of attribute updates.
47 48 49 |
# File 'lib/query-interface-server/transformations.rb', line 47 def updates @updates end |
#withs ⇒ Object
Returns the value of attribute withs.
47 48 49 |
# File 'lib/query-interface-server/transformations.rb', line 47 def withs @withs end |
Instance Method Details
#auto_exclude(*names) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/query-interface-server/transformations.rb', line 57 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
65 66 67 68 69 70 71 |
# File 'lib/query-interface-server/transformations.rb', line 65 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 |
#auto_update(*names) ⇒ Object
73 74 75 76 77 |
# File 'lib/query-interface-server/transformations.rb', line 73 def auto_update(*names) names.each do |name| self.updates[name] = Proc.new {|param| param} end end |
#exclude(name, &block) ⇒ Object
79 80 81 |
# File 'lib/query-interface-server/transformations.rb', line 79 def exclude(name, &block) self.excludes[name] = block end |
#filter(name, &block) ⇒ Object
83 84 85 |
# File 'lib/query-interface-server/transformations.rb', line 83 def filter(name, &block) self.filters[name] = block end |
#order(name, &block) ⇒ Object
95 96 97 |
# File 'lib/query-interface-server/transformations.rb', line 95 def order(name, &block) self.orders[name] = block end |
#update(name, &block) ⇒ Object
87 88 89 |
# File 'lib/query-interface-server/transformations.rb', line 87 def update(name, &block) self.updates[name] = block end |
#with(name, &block) ⇒ Object
91 92 93 |
# File 'lib/query-interface-server/transformations.rb', line 91 def with(name, &block) self.withs[name] = block end |