Class: Sablon::Parser::MailMerge::SimpleField
- Inherits:
-
MergeField
- Object
- MergeField
- Sablon::Parser::MailMerge::SimpleField
- Defined in:
- lib/sablon/parser/mail_merge.rb
Constant Summary
Constants inherited from MergeField
Instance Attribute Summary
Attributes inherited from MergeField
Instance Method Summary collapse
- #ancestors(*args) ⇒ Object
-
#initialize(node) ⇒ SimpleField
constructor
A new instance of SimpleField.
-
#remove ⇒ Object
removes only the merge field in question.
-
#remove_parent(selector) ⇒ Object
removes the parent node containing the merge field.
- #replace(content, env) ⇒ Object
- #start_node ⇒ Object (also: #end_node)
Methods inherited from MergeField
Constructor Details
#initialize(node) ⇒ SimpleField
Returns a new instance of SimpleField.
94 95 96 97 98 |
# File 'lib/sablon/parser/mail_merge.rb', line 94 def initialize(node) super() @node = node @raw_expression = @node["w:instr"] end |
Instance Method Details
#ancestors(*args) ⇒ Object
116 117 118 |
# File 'lib/sablon/parser/mail_merge.rb', line 116 def ancestors(*args) @node.ancestors(*args) end |
#remove ⇒ Object
removes only the merge field in question
107 108 109 |
# File 'lib/sablon/parser/mail_merge.rb', line 107 def remove remove_or_decrement_ref(@node) end |
#remove_parent(selector) ⇒ Object
removes the parent node containing the merge field
112 113 114 |
# File 'lib/sablon/parser/mail_merge.rb', line 112 def remove_parent(selector) remove_or_decrement_ref(@node.ancestors(selector).first) end |
#replace(content, env) ⇒ Object
100 101 102 103 104 |
# File 'lib/sablon/parser/mail_merge.rb', line 100 def replace(content, env) remove_extra_runs! replace_field_display(@node, content, env) @node.replace(@node.children) end |
#start_node ⇒ Object Also known as: end_node
120 121 122 |
# File 'lib/sablon/parser/mail_merge.rb', line 120 def start_node @node end |