Debian Codegraph @

test/fixtures/lambda.rb

raw symbols SCIP
1 require 'mustache'
2
3 class Lambda < Mustache
4 self.path = File.dirname(__FILE__)
5
6 attr_reader :calls
7
8 def initialize(*args)
9 super
10 @calls = 0
11 @cached = nil
12 end
13
14 def rendered
15 lambda do |text|
16 return @cached if @cached
17
18 @calls += 1
19 @cached = render(text)
20 end
21 end
22
23 def not_rendered
24 lambda { |text| "{{= | =}}#{text}" }
25 end
26 end
27
28 if $0 == __FILE__
29 puts Lambda.to_html(Lambda.template, :name => "Jonny")
30 end