Class: ROX::MappableColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/rox/rox.rb

Instance Attribute Summary

Attributes inherited from Column

#name, #number, #options, #type

Instance Method Summary collapse

Constructor Details

#initialize(number, name, type, options) ⇒ MappableColumn

Returns a new instance of MappableColumn.



25
26
27
28
29
# File 'lib/rox/rox.rb', line 25

def initialize(number, name, type, options)
  super(number, name, type, options)
  @from_ox = options
  @inverse = @from_ox.inject({}) {|memo, pair| memo[pair[1]] = pair[0]; memo} if options
end

Instance Method Details

#from_ox(client, value) ⇒ Object



35
36
37
# File 'lib/rox/rox.rb', line 35

def from_ox(client, value)
  @from_ox[value]
end

#to_ox(client, value) ⇒ Object



31
32
33
# File 'lib/rox/rox.rb', line 31

def to_ox(client, value)
  @inverse[value]
end