Class: Handlebars::Helpers::CodeRuby::Deconstantize
- Inherits:
-
BaseHelper
- Object
- BaseHelper
- Handlebars::Helpers::CodeRuby::Deconstantize
- Defined in:
- lib/handlebars/helpers/code_ruby/deconstantize.rb
Overview
Deconstantize: Removes the rightmost segment from the constant expression in the string.
Instance Method Summary collapse
- #handlebars_helper ⇒ Object
-
#parse(value) ⇒ String
Parse will deconstantize, remove the rightmost segment from the constant expression in the string.
Methods inherited from BaseHelper
#parse_json, #struct_to_hash, #tokenizer, #wrapper
Instance Method Details
#handlebars_helper ⇒ Object
42 43 44 |
# File 'lib/handlebars/helpers/code_ruby/deconstantize.rb', line 42 def proc { |_context, value| wrapper(parse(value)) } end |
#parse(value) ⇒ String
Parse will deconstantize, remove the rightmost segment from the constant expression in the string.
36 37 38 39 40 |
# File 'lib/handlebars/helpers/code_ruby/deconstantize.rb', line 36 def parse(value) return '' if value.nil? value.deconstantize end |