forked from alexch/learn_ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
a basic ruby class generated from test-first-teaching
hauntedhost/learn_ruby
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
___ ___ __ ___ ___ __ __ ___ | |__ /__` | |__ | |__) /__` | | |___ .__/ | | | | \ .__/ | http://testfirst.org/learn_ruby i wrote three variations of rpn_calculator.rb. the first uses predefined methods for plus, minus, times, divide. the second uses method_missing? for these methods. the last dynamically defines these methods when the class is initialized. here is the code: https://github.com/somlor/learn_ruby/blob/master/12_rpn_calculator/rpn_calculator.rb here are the benchmarks: user system total real predefined methods (+) : 0.100000 0.000000 0.100000 (0.101083) method_missing (+) : 0.900000 0.000000 0.900000 (0.921993) dynamic methods (+) : 1.860000 0.010000 1.870000 (1.874929) predefined methods (/ *) : 0.140000 0.000000 0.140000 (0.145944) method_missing (/ *) : 2.110000 0.000000 2.110000 (2.108177) dynamic methods (/ *) : 3.010000 0.000000 3.010000 (3.024047) predefined methods (string) : 1.170000 0.000000 1.170000 (1.174143) method_missing (string) : 4.100000 0.000000 4.100000 (4.120637) dynamic methods (string) : 6.250000 0.000000 6.250000 (6.264934)
About
a basic ruby class generated from test-first-teaching
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Ruby 94.3%
- CSS 5.7%