Class: Devlin::Scope::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/devlin/scope.rb

Overview

The configuration object simplifies the configuration of the scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, params, &block) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
# File 'lib/devlin/scope.rb', line 7

def initialize(scope, params, &block)
  @scope = scope
  @params = params
  instance_eval(&block)
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/devlin/scope.rb', line 5

def params
  @params
end

Instance Method Details

#column(name, definition, *args, &block) ⇒ Object



17
18
19
# File 'lib/devlin/scope.rb', line 17

def column(name, definition, *args, &block)
  @scope.add_column(name, definition, *args, &block)
end

#relation(rel) ⇒ Object



13
14
15
# File 'lib/devlin/scope.rb', line 13

def relation(rel)
  @scope.relation = rel  
end