Class: ExampleGem::Price

Inherits:
Object
  • Object
show all
Defined in:
lib/example_gem/price.rb

Class Method Summary collapse

Class Method Details

.fen_to_yuan(fen) ⇒ Object

有误差



6
7
8
# File 'lib/example_gem/price.rb', line 6

def self.fen_to_yuan(fen)
  (fen / 100.000).round(2)
end

.yuan_to_fen(yuan) ⇒ Object



10
11
12
# File 'lib/example_gem/price.rb', line 10

def self.yuan_to_fen(yuan)
  (yuan * 100).round
end