-
-
Save digitalplaywright/9bfd99af5ad76f81c0d5 to your computer and use it in GitHub Desktop.
using class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AMOUNT_CALC_ATTRIBUTES = [:_, :quantity, :price_per, :subtotal, :service_fee, :total, :currency, :trans_fee] | |
class AmountCalculated | |
attr_accessor *AMOUNT_CALC_ATTRIBUTES | |
def initialize(opts) | |
opts.each{|k,v| self.send("#{k}=", v)} | |
end | |
end | |
Example call: | |
am = AmountCalculated.new({ :quantity => 0, :price_per => 0, :subtotal => 0, :service_fee => 0, :trans_fee => 0, :total => 0, :currency => 'USD' }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment