Class: Strling::Core::ClassLiteral

Inherits:
ClassItem
  • Object
show all
Defined in:
lib/strling/core/nodes.rb

Overview

Represents a literal character in a character class.

Matches the exact character.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ch) ⇒ ClassLiteral

Returns a new instance of ClassLiteral.

Parameters:

  • ch (String)

    The character



246
247
248
# File 'lib/strling/core/nodes.rb', line 246

def initialize(ch)
  @ch = ch
end

Instance Attribute Details

#chString

Returns The character.

Returns:

  • (String)

    The character



243
244
245
# File 'lib/strling/core/nodes.rb', line 243

def ch
  @ch
end

Instance Method Details

#to_dictObject



250
251
252
# File 'lib/strling/core/nodes.rb', line 250

def to_dict
  { 'kind' => 'Char', 'char' => ch }
end