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.



46
47
48
# File 'lib/deas/template.rb', line 46

def initialize(sinatra_call)
  @sinatra_call = sinatra_call
end

Instance Attribute Details

#sinatra_callObject (readonly)

Returns the value of attribute sinatra_call.



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

def sinatra_call
  @sinatra_call
end

Instance Method Details

#==(other_scope) ⇒ Object



72
73
74
75
# File 'lib/deas/template.rb', line 72

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



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

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

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



63
64
65
# File 'lib/deas/template.rb', line 63

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

#loggerObject



68
69
70
# File 'lib/deas/template.rb', line 68

def logger
  @sinatra_call.logger
end

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



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

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

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



50
51
52
# File 'lib/deas/template.rb', line 50

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