Class: Grape::Builder::Partial

Inherits:
Object
  • Object
show all
Defined in:
lib/grape/builder/partial.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_path, scope) ⇒ Partial

Returns a new instance of Partial.



9
10
11
12
# File 'lib/grape/builder/partial.rb', line 9

def initialize(view_path, scope)
  @view_path = view_path
  @scope  = scope
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



7
8
9
# File 'lib/grape/builder/partial.rb', line 7

def scope
  @scope
end

#view_pathObject (readonly)

Returns the value of attribute view_path.



7
8
9
# File 'lib/grape/builder/partial.rb', line 7

def view_path
  @view_path
end

Instance Method Details

#render(template, locals = {}) ⇒ Object



14
15
16
17
# File 'lib/grape/builder/partial.rb', line 14

def render(template, locals={})
  Grape::Builder::Renderer.new(view_path, template).
    render(scope, locals)
end