Sha256: 9a352e90287f54306778f3313b278fa684f7823b31dc28b420a0318881db39c6

Contents?: true

Size: 594 Bytes

Versions: 9

Compression:

Stored size: 594 Bytes

Contents

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

9 entries across 9 versions & 2 rubygems

Version Path
zine_brewer-1.5.0 vendor/bundle/ruby/2.7.0/gems/mustache-1.1.1/test/fixtures/nested_objects.rb
zine_brewer-1.3.0 vendor/bundle/ruby/2.7.0/gems/mustache-1.1.1/test/fixtures/nested_objects.rb
mustache-1.1.1 test/fixtures/nested_objects.rb
mustache-1.1.0 test/fixtures/nested_objects.rb
mustache-1.0.5 test/fixtures/nested_objects.rb
mustache-1.0.3 test/fixtures/nested_objects.rb
mustache-1.0.2 test/fixtures/nested_objects.rb
mustache-1.0.1 test/fixtures/nested_objects.rb
mustache-1.0.0 test/fixtures/nested_objects.rb