Class: VR::Col::CurrencyCol

Inherits:
Object
  • Object
show all
Defined in:
lib/treeview/columns/CurrencyCol.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, format = "$%.2f") ⇒ CurrencyCol

Returns a new instance of CurrencyCol



8
9
10
# File 'lib/treeview/columns/CurrencyCol.rb', line 8

def initialize(value, format = "$%.2f")
  set_value(value, format)
end

Instance Attribute Details

#formatObject

Returns the value of attribute format



6
7
8
# File 'lib/treeview/columns/CurrencyCol.rb', line 6

def format
  @format
end

#valueObject

Returns the value of attribute value



6
7
8
# File 'lib/treeview/columns/CurrencyCol.rb', line 6

def value
  @value
end

Instance Method Details

#set_value(value, format = "$%.2f") ⇒ Object



12
13
14
15
# File 'lib/treeview/columns/CurrencyCol.rb', line 12

def set_value(value, format = "$%.2f")
  @value = value
  @format = format
end

#to_sObject



17
18
19
# File 'lib/treeview/columns/CurrencyCol.rb', line 17

def to_s
  format % @value.to_f
end