class YDIM::Item
Constants
- DATA_KEYS
Attributes
index[RW]
Public Class Methods
new(data={})
click to toggle source
# File lib/ydim/item.rb, line 9 def initialize(data={}) update(data) end
Public Instance Methods
total_brutto()
click to toggle source
# File lib/ydim/item.rb, line 12 def total_brutto total_netto + vat end
total_netto()
click to toggle source
# File lib/ydim/item.rb, line 15 def total_netto @quantity.to_f * @price.to_f end
update(data)
click to toggle source
# File lib/ydim/item.rb, line 18 def update(data) data.each { |key, val| if(DATA_KEYS.include?(key.to_sym)) instance_variable_set("@#{key}", val) end } end
vat()
click to toggle source
# File lib/ydim/item.rb, line 25 def vat total_netto * (@vat_rate.to_f / 100.0) end