Class: Deas::Template::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/deas/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sinatra_call) ⇒ Scope

Returns a new instance of Scope.



36
37
38
# File 'lib/deas/template.rb', line 36

def initialize(sinatra_call)
  @sinatra_call = sinatra_call
end

Instance Attribute Details

#sinatra_callObject (readonly)

Returns the value of attribute sinatra_call.



35
36
37
# File 'lib/deas/template.rb', line 35

def sinatra_call
  @sinatra_call
end

Instance Method Details

#==(other_scope) ⇒ Object



58
59
60
61
# File 'lib/deas/template.rb', line 58

def ==(other_scope)
  self.sinatra_call == other_scope.sinatra_call
  self.class.included_modules == other_scope.class.included_modules
end

#escape_html(html) ⇒ Object Also known as: h



48
49
50
# File 'lib/deas/template.rb', line 48

def escape_html(html)
  Rack::Utils.escape_html(html)
end

#escape_url(path) ⇒ Object Also known as: u



53
54
55
# File 'lib/deas/template.rb', line 53

def escape_url(path)
  Rack::Utils.escape_path(path)
end

#partial(name, locals = nil) ⇒ Object



44
45
46
# File 'lib/deas/template.rb', line 44

def partial(name, locals = nil)
  Partial.new(@sinatra_call, name, locals || {}).render
end

#render(name, options = nil, &block) ⇒ Object



40
41
42
# File 'lib/deas/template.rb', line 40

def render(name, options = nil, &block)
  Template.new(@sinatra_call, name, options || {}).render(&block)
end