Class: Handlebars::Helpers::WithHelper

Inherits:
DefaultHelper show all
Defined in:
lib/ruby-handlebars/helpers/with_helper.rb

Class Method Summary collapse

Methods inherited from DefaultHelper

register

Class Method Details

.apply(context, data, block, else_block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/ruby-handlebars/helpers/with_helper.rb', line 10

def self.apply(context, data, block, else_block)
  if data
    context.with_temporary_context(data) do
      block.fn(context)
    end
  else
    else_block.fn(context)
  end
end

.apply_as(context, data, name, block, else_block) ⇒ Object



20
21
22
# File 'lib/ruby-handlebars/helpers/with_helper.rb', line 20

def self.apply_as(context, data, name, block, else_block)
  self.apply(context, { name.to_sym => data }, block, else_block)
end

.registry_nameObject



6
7
8
# File 'lib/ruby-handlebars/helpers/with_helper.rb', line 6

def self.registry_name
  'with'
end