Class: Handlebars::Helpers::Comparison::Ne
- Inherits:
-
BaseHelper
- Object
- BaseHelper
- Handlebars::Helpers::Comparison::Ne
- Defined in:
- lib/handlebars/helpers/comparison/ne.rb
Overview
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.
Instance Method Summary collapse
- #handlebars_helper ⇒ Object
-
#parse(lhs, rhs) ⇒ String
Parse will Ne: (not equal) Block helper that renders a block if
ais **not equal to**b.
Methods inherited from BaseHelper
#parse_json, #struct_to_hash, #tokenizer, #wrapper
Instance Method Details
#handlebars_helper ⇒ Object
32 33 34 |
# File 'lib/handlebars/helpers/comparison/ne.rb', line 32 def proc { |_context, lhs, rhs| wrapper(parse(lhs, rhs)) } end |
#parse(lhs, rhs) ⇒ String
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.
25 26 27 28 29 30 |
# 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 |