class Handlebars::Helpers::Comparison::Ne

Ne: (not equal) Block helper that renders a block if `a` is **not equal to** `b`. If an inverse block is specified it will be rendered when falsy.

Public Instance Methods

handlebars_helper() click to toggle source
# File lib/handlebars/helpers/comparison/ne.rb, line 32
def handlebars_helper
  proc { |_context, lhs, rhs| wrapper(parse(lhs, rhs)) }
end
parse(lhs, rhs) click to toggle source

Parse will Ne: (not equal) Block helper that renders a block if `a` is **not equal to** `b`. If an inverse block is specified it will be rendered when falsy.

@example

puts Ne.new.parse('aaa', 'bbb')

Truthy

@param [String] lhs - left hand side value @param [String] rhs - right hand side value @return [String] truthy value if left hand side is NOT equal to right hand side

# File lib/handlebars/helpers/comparison/ne.rb, line 25
def parse(lhs, rhs)
  lhs = lhs.to_s if lhs.is_a?(Symbol)
  rhs = rhs.to_s if rhs.is_a?(Symbol)

  lhs != rhs
end