Class: C0::PatternBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/c0/diff.rb

Overview

The units of one diff record: anchor(text) and sub(old, new).

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ PatternBuilder

Returns a new instance of PatternBuilder.



177
178
179
# File 'lib/c0/diff.rb', line 177

def initialize(builder)
  @b = builder
end

Instance Method Details

#anchor(text) ⇒ Object

An anchor: text the file holds and keeps.



182
183
184
185
# File 'lib/c0/diff.rb', line 182

def anchor(text)
  @b.field(text)
  self
end

#sub(old_text, new_text) ⇒ Object

A substitution, old␚␟new: the unit old with the sub-unit new.



188
189
190
191
# File 'lib/c0/diff.rb', line 188

def sub(old_text, new_text)
  @b.field(old_text).sub_unit(new_text)
  self
end