| 1 | require 'mustache' |
| 2 | |
| 3 | class ComplexView < Mustache |
| 4 | self.path = File.dirname(__FILE__) |
| 5 | |
| 6 | def header |
| 7 | "Colors" |
| 8 | end |
| 9 | |
| 10 | def item |
| 11 | items = [] |
| 12 | items << { :name => 'red', :current => true, :url => '#Red' } |
| 13 | items << { :name => 'green', :current => false, :url => '#Green' } |
| 14 | items << { :name => 'blue', :current => false, :url => '#Blue' } |
| 15 | items |
| 16 | end |
| 17 | |
| 18 | def link |
| 19 | not self[:current] |
| 20 | end |
| 21 | |
| 22 | def list |
| 23 | not item.empty? |
| 24 | end |
| 25 | |
| 26 | def empty |
| 27 | item.empty? |
| 28 | end |
| 29 | end |
| 30 | |
| 31 | if $0 == __FILE__ |
| 32 | puts ComplexView.to_html |
| 33 | end |