Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dinero en Ruby
Search
fedesoria
July 17, 2015
Programming
0
46
Dinero en Ruby
3 tips de como manejar dinero en tus proyectos de Ruby
fedesoria
July 17, 2015
Tweet
Share
More Decks by fedesoria
See All by fedesoria
Mo Money Mo Problems (with ruby)
fedesoria
0
350
Bigotes en mis Vistas
fedesoria
0
74
AB Testing
fedesoria
0
62
Other Decks in Programming
See All in Programming
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
270
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
200
Fragment Composition of GraphQL
quramy
5
870
Ruby GitHub Packages
bkuhlmann
0
630
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
910
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
23
15k
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
370
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
230
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
Site Reliability Engineering for GMO
pyama86
8
1k
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
530
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
Featured
See All Featured
Designing on Purpose - Digital PM Summit 2013
jponch
110
6.5k
Side Projects
sachag
451
41k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
659
120k
Code Reviewing Like a Champion
maltzj
514
39k
GitHub's CSS Performance
jonrohan
1025
450k
Infographics Made Easy
chrislema
238
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
6
1.5k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
For a Future-Friendly Web
brad_frost
172
9k
Teambox: Starting and Learning
jrom
128
8.4k
The Brand Is Dead. Long Live the Brand.
mthomps
49
28k
Creatively Recalculating Your Daily Design Routine
revolveconf
210
11k
Transcript
> puts ‘$’ @fedesoria
1. ¿Cómo guardar dinero en la base de datos?
139.25 + 74.79
=> 214.04
=> 214.04000000000002
1/3 != 1010101
Integer > production.precio => 2000 # 20.00
BigDecimal
2. ¿Cómo hago redondeo?
$20.005
Redondeo al número entero IEEE Standard 1985
$20.005 => $20.00
$20.015 => $20.02
BigDecimal ROUND_HALF_EVEN
3. ¿Cómo manejo múltiples monedas?
gem install money
Money.new(1000, "USD")
Money.new(1000, “USD”).to_s => “$10.00”
Money.new(1000, “USD”). exchange_to( “MXN”) => “$200.00”
> puts ‘Gracias’ @fedesoria