Class: BB::Converter::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/b_b/converter/table.rb

Constant Summary collapse

TEMPLATE =
{
  subquery: "(%s)",
  table_date_range: "TABLE_DATE_RANGE(%s, %s, %s)"
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, options = {}) ⇒ Table

Returns a new instance of Table.



11
12
13
14
# File 'lib/b_b/converter/table.rb', line 11

def initialize(value, options = {})
  @value   = value
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/b_b/converter/table.rb', line 9

def options
  @options
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/b_b/converter/table.rb', line 9

def value
  @value
end

Class Method Details

.convert(value, options = {}) ⇒ Object



43
44
45
# File 'lib/b_b/converter/table.rb', line 43

def convert(value, options = {})
  new(value, options).convert
end

Instance Method Details

#convertObject



16
17
18
19
# File 'lib/b_b/converter/table.rb', line 16

def convert
  evaluated_type = Evaluator::Table.eval_type(value, options)
  evaluated_type && send("to_#{evaluated_type}")
end