Class: Sablon::Processor::Document::InsertionHandler

Inherits:
FieldHandler
  • Object
show all
Defined in:
lib/sablon/processor/document/field_handlers.rb

Overview

Handles simple text insertion

Instance Method Summary collapse

Methods inherited from FieldHandler

#handles?

Constructor Details

#initializeInsertionHandler

Returns a new instance of InsertionHandler.



32
33
34
# File 'lib/sablon/processor/document/field_handlers.rb', line 32

def initialize
  super(/^=/)
end

Instance Method Details

#build_statement(_constructor, field, options = {}) ⇒ Object



36
37
38
39
40
41
# File 'lib/sablon/processor/document/field_handlers.rb', line 36

def build_statement(_constructor, field, options = {})
  return unless options[:allow_insertion]
  #
  expr = Expression.parse(field.expression.gsub(/^=/, ''))
  Statement::Insertion.new(expr, field)
end