Created
November 7, 2017 05:14
-
-
Save ro31337/3bf98bc7bdb8aa57f17e653ed66dbf93 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Plan | |
| def price | |
| 100 | |
| end | |
| end | |
| class Promo | |
| def initialize(origin, code) | |
| @origin = origin | |
| @code = code | |
| end | |
| def price | |
| @origin.price * 0.9 | |
| end | |
| end | |
| class PayPerYear | |
| def initialize(origin) | |
| @origin = origin | |
| end | |
| def price | |
| @origin.price * 0.9 | |
| end | |
| end | |
| final_plan = PayPerYear.new( | |
| Promo.new( | |
| Plan.new, | |
| 'SBERBANK' | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment