Class: Strling::Core::IRClassRange

Inherits:
IRClassItem show all
Defined in:
lib/strling/core/ir.rb

Overview

Represents a character range in a character class in the IR.

Matches characters from from_ch to to_ch (inclusive).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_ch, to_ch) ⇒ IRClassRange

Returns a new instance of IRClassRange.

Parameters:

  • from_ch (String)

    The starting character

  • to_ch (String)

    The ending character



136
137
138
139
# File 'lib/strling/core/ir.rb', line 136

def initialize(from_ch, to_ch)
  @from_ch = from_ch
  @to_ch = to_ch
end

Instance Attribute Details

#from_chString

Returns The starting character.

Returns:

  • (String)

    The starting character



129
130
131
# File 'lib/strling/core/ir.rb', line 129

def from_ch
  @from_ch
end

#to_chString

Returns The ending character.

Returns:

  • (String)

    The ending character



132
133
134
# File 'lib/strling/core/ir.rb', line 132

def to_ch
  @to_ch
end

Instance Method Details

#to_dictObject



141
142
143
# File 'lib/strling/core/ir.rb', line 141

def to_dict
  { 'ir' => 'Range', 'from' => from_ch, 'to' => to_ch }
end