Class: Sablon::Parser::MailMerge::MergeField

Inherits:
Object
  • Object
show all
Defined in:
lib/sablon/parser/mail_merge.rb

Direct Known Subclasses

ComplexField, SimpleField

Constant Summary collapse

KEY_PATTERN =
/^\s*MERGEFIELD\s+([^ ]+)\s+\\\*\s+MERGEFORMAT\s*$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMergeField

Returns a new instance of MergeField.



8
9
10
# File 'lib/sablon/parser/mail_merge.rb', line 8

def initialize
  @block_reference_count = 0
end

Instance Attribute Details

#block_reference_countObject

Returns the value of attribute block_reference_count.



5
6
7
# File 'lib/sablon/parser/mail_merge.rb', line 5

def block_reference_count
  @block_reference_count
end

Instance Method Details

#expressionObject



16
17
18
# File 'lib/sablon/parser/mail_merge.rb', line 16

def expression
  $1 if @raw_expression =~ KEY_PATTERN
end

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/sablon/parser/mail_merge.rb', line 12

def valid?
  expression
end