class Templet::Component::Partial

Used for composing views, either within a Layout or another Parial

Attributes

renderer[RW]

Public Class Methods

call(renderer, *contexts, **locals, &block) click to toggle source

Shortcut

# File lib/templet/component/partial.rb, line 24
def self.call(renderer, *contexts, **locals, &block)
  new(renderer, *contexts, **locals).(&block)
end
new(renderer, *contexts, **locals) click to toggle source
contexts

A list containing objects whose methods will be looked up

locals

Objects you can reference by the name given as the key

# File lib/templet/component/partial.rb, line 10
def initialize(renderer, *contexts, **locals)
  self.renderer = if renderer
                    renderer.new_instance(self, *contexts, **locals)
                  else
                    Renderer.new(self, *contexts, **locals)
                  end
end

Public Instance Methods

call(&block) click to toggle source

Entry point - the block returns markup

# File lib/templet/component/partial.rb, line 19
def call(&block)
  renderer.(&block)
end
Also aliased as: compose

Private Instance Methods

compose(&block)

If call gets overriden then use compose instead

Alias for: call