Class: Towsta::Kinds::MoneyKind
Instance Attribute Summary
Attributes inherited from MainKind
#content
Instance Method Summary
collapse
Methods inherited from MainKind
#compare_parameterized, #get, #initialize, #kind
Instance Method Details
#compare(object) ⇒ Object
11
12
13
|
# File 'lib/towsta/kinds/money.rb', line 11
def compare object
@content == object.to_f
end
|
#export ⇒ Object
15
16
17
18
19
|
# File 'lib/towsta/kinds/money.rb', line 15
def export
return '0' if @content == 0
content = ("%.2f" % @content).split('.')
"#{content.first.reverse.scan(/.{1,3}/).join('.').reverse},#{content.last}"
end
|
#set(content) ⇒ Object
6
7
8
9
|
# File 'lib/towsta/kinds/money.rb', line 6
def set content
content = content.gsub('.','').gsub(',','.') if content.class == String
@content = content.to_f
end
|