Class: Sablon::Processor::Document::ImageHandler

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

Overview

Handles image insertion fields

Instance Method Summary collapse

Methods inherited from FieldHandler

#handles?

Constructor Details

#initializeImageHandler

Returns a new instance of ImageHandler.



93
94
95
# File 'lib/sablon/processor/document/field_handlers.rb', line 93

def initialize
  super(/^@([^ ]+):start/)
end

Instance Method Details

#build_statement(constructor, field, _options = {}) ⇒ Object



97
98
99
100
101
# File 'lib/sablon/processor/document/field_handlers.rb', line 97

def build_statement(constructor, field, _options = {})
  expr_name = field.expression.match(@pattern).to_a[1]
  block = constructor.consume_block("@#{expr_name}:end")
  Statement::Image.new(Expression.parse(expr_name), block)
end