| 1 | require 'mustache' |
| 2 | |
| 3 | module SimpleView |
| 4 | def name |
| 5 | "Bob" |
| 6 | end |
| 7 | |
| 8 | def value |
| 9 | 100_000 |
| 10 | end |
| 11 | |
| 12 | def taxed_value |
| 13 | value - (value * 0.4) |
| 14 | end |
| 15 | |
| 16 | def in_ca |
| 17 | false |
| 18 | end |
| 19 | end |
| 20 | |
| 21 | class PartialWithModule < Mustache |
| 22 | include SimpleView |
| 23 | self.path = File.dirname(__FILE__) |
| 24 | |
| 25 | def greeting |
| 26 | "Welcome" |
| 27 | end |
| 28 | |
| 29 | def farewell |
| 30 | "Fair enough, right?" |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | if $0 == __FILE__ |
| 35 | puts PartialWithModule.to_html |
| 36 | end |