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.



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

def initialize(sinatra_call)
  @sinatra_call = sinatra_call
end

Instance Attribute Details

#sinatra_callObject (readonly)

Returns the value of attribute sinatra_call.



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

def sinatra_call
  @sinatra_call
end

Instance Method Details

#==(other_scope) ⇒ Object



70
71
72
73
# File 'lib/deas/template.rb', line 70

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



56
57
58
# File 'lib/deas/template.rb', line 56

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

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



61
62
63
# File 'lib/deas/template.rb', line 61

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

#loggerObject



66
67
68
# File 'lib/deas/template.rb', line 66

def logger
  @sinatra_call.logger
end

#partial(name, locals = nil, &block) ⇒ Object



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

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

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



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

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