Sha256: 679625a4201c07c4b588e37bee8779a041f5192e3985121c947c4b73c2c7a6b7

Contents?: true

Size: 648 Bytes

Versions: 25

Compression:

Stored size: 648 Bytes

Contents

$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
require 'mustache'
require 'ostruct'

class NestedObjects < Mustache
  self.path = File.dirname(__FILE__)

  def header
    "Colors"
  end

  def item
    items = []
    items << OpenStruct.new(:name => 'red', :current => true, :url => '#Red')
    items << OpenStruct.new(:name => 'green', :current => false, :url => '#Green')
    items << OpenStruct.new(:name => 'blue', :current => false, :url => '#Blue')
    items
  end

  def link
    not self[:current]
  end

  def list
    not item.empty?
  end

  def empty
    item.empty?
  end
end

if $0 == __FILE__
  puts NestedObjects.to_html
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
mustache-0.99.8 test/fixtures/nested_objects.rb
mustache-0.99.7 test/fixtures/nested_objects.rb
mustache-0.99.6 test/fixtures/nested_objects.rb
mustache-0.99.5 test/fixtures/nested_objects.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/mustache-0.99.4/test/fixtures/nested_objects.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/mustache-0.99.4/test/fixtures/nested_objects.rb
mustache-bibanon-0.99.5 test/fixtures/nested_objects.rb
mustache-0.99.4 test/fixtures/nested_objects.rb
mustache-0.99.3 test/fixtures/nested_objects.rb
mustache-0.99.2 test/fixtures/nested_objects.rb
mustache-0.99.1 test/fixtures/nested_objects.rb
mustache-0.99.0 test/fixtures/nested_objects.rb
mustache-0.98.0 test/fixtures/nested_objects.rb
mustache-0.13.0 test/fixtures/nested_objects.rb
mustache-0.12.1 test/fixtures/nested_objects.rb
mustache-0.12.0 test/fixtures/nested_objects.rb
angry_mob_common_targets-0.1.0 vendor/mustache/test/fixtures/nested_objects.rb
mustache-0.11.2 test/fixtures/nested_objects.rb
mustache-0.11.1 test/fixtures/nested_objects.rb
mustache-0.11.0 test/fixtures/nested_objects.rb