Class: C0::Diff::Pattern

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

Overview

One record: an anchored pattern. With no substitution it is an assertion.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#units ⇒ Object

Returns the value of attribute units

Returns:

  • (Object) —

    the current value of units



36
37
38
# File 'lib/c0/diff.rb', line 36

def units
  @units
end

Instance Method Details

#assertion? ⇒ Boolean

Returns:

  • (Boolean)


43
# File 'lib/c0/diff.rb', line 43

def assertion? = units.all?(&:anchor?)

#replacement ⇒ Object

What it will hold: each sub-unit in place of the unit that holds it.



41
# File 'lib/c0/diff.rb', line 41

def replacement = units.map { |u| u.new || u.old }.join.b

#search ⇒ Object

What the file must hold, once: anchors and olds.



38
# File 'lib/c0/diff.rb', line 38

def search = units.map(&:old).join.b