Module: Liquidscript::Generator::Base::Replacements
- Included in:
- Liquidscript::Generator::Base
- Defined in:
- lib/liquidscript/generator/base/replacements.rb
Instance Method Summary collapse
-
#replace(code, context = {}) ⇒ Object
Replace a code with a string.
-
#replacements ⇒ Hash
Access to the replacements method on the class.
Instance Method Details
#replace(code, context = {}) ⇒ Object
Replace a code with a string. This uses the replacement definitions that are a part of the class.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/liquidscript/generator/base/replacements.rb', line 11 def replace(code, context = {}) send(:"generate_#{code.type}", code) rescue NoMethodError => e if e.name == :"_generate_code_#{code.type}" raise InvalidCodeError.new(code.type) else raise end end |
#replacements ⇒ Hash
Access to the replacements method on the class.
27 28 29 |
# File 'lib/liquidscript/generator/base/replacements.rb', line 27 def replacements self.class.replacements end |