Created
May 5, 2009 14:12
-
-
Save anonymous/106983 to your computer and use it in GitHub Desktop.
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
Units = { :dollar_per_ffe => { :symbol => "$/ffe", :si_factor=>1.0 }, | |
:dollar_per_ton => { :symbol => "$/T", :si_factor=>1.0e-3 } | |
} | |
Attribute_Units = { :default_transshipment_cost => :dollar_per_ffe, | |
:bunker_cost => :dollar_per_ton | |
} | |
def bunker_cost | |
read_attribute(:bunker_cost) / Units[Attribute_Units[:bunker_cost]][:si_factor]; | |
end | |
def bunker_cost=(value) | |
write_attribute(:bunker_cost, value * Units[Attribute_Units[:bunker_cost]][:si_factor]); | |
end | |
def default_transshipment_cost | |
# as bunker_cost | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment