Class: RecordFormatter::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/record_formatter/column.rb

Constant Summary collapse

VALID_OPTIONS =
i(alias)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Column

Returns a new instance of Column.



10
11
12
13
# File 'lib/record_formatter/column.rb', line 10

def initialize name, options={}
  @name = name
  @options = options.slice!(VALID_OPTIONS)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/record_formatter/column.rb', line 8

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/record_formatter/column.rb', line 8

def options
  @options
end

Instance Method Details

#for_selectObject



15
16
17
# File 'lib/record_formatter/column.rb', line 15

def for_select
  "#{name} AS #{name_alias}"
end