Class: QueryInterface::Server::Transformations::TransformationScope

Inherits:
Object
  • Object
show all
Defined in:
lib/query-interface-server/transformations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransformationScope

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

#excludesObject

Returns the value of attribute excludes.



45
46
47
# File 'lib/query-interface-server/transformations.rb', line 45

def excludes
  @excludes
end

#filtersObject

Returns the value of attribute filters.



45
46
47
# File 'lib/query-interface-server/transformations.rb', line 45

def filters
  @filters
end

#ordersObject

Returns the value of attribute orders.



45
46
47
# File 'lib/query-interface-server/transformations.rb', line 45

def orders
  @orders
end

#withsObject

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