Class: Handlebars::Helpers::UnlessHelper

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

Class Method Summary collapse

Methods inherited from DefaultHelper

register

Class Method Details

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



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

def self.apply(context, condition, block, else_block)
  condition = !condition.empty? if condition.respond_to?(:empty?)

  unless condition
    block.fn(context)
  else
    else_block ? else_block.fn(context) : ""
  end
end

.registry_nameObject



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

def self.registry_name
  'unless'
end