7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/bbmb/util/numbers.rb', line 7
def Numbers.append_features(mod)
super
mod.module_eval {
class << self
def money_accessor(*keys)
keys.each { |key|
attr_reader key
define_method("#{key}=") { |value|
money = Util::Money.new(value) if(value.to_f > 0)
instance_variable_set("@#{key}", money)
}
}
end
def int_accessor(*keys)
keys.each { |key|
attr_reader key
define_method("#{key}=") { |value|
int = value.to_i if(value)
instance_variable_set("@#{key}", int)
}
}
end
end
}
end
|