Class: Sai::ANSI::StyleParser Private
- Inherits:
-
Object
- Object
- Sai::ANSI::StyleParser
- Defined in:
- lib/sai/ansi/style_parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Handles parsing of ANSI style codes
Instance Attribute Summary collapse
-
#segment ⇒ Hash
readonly
private
The current segment being processed.
Instance Method Summary collapse
-
#initialize(segment) ⇒ StyleParser
constructor
private
Initialize a new instance of StyleParser.
-
#parse(code) ⇒ void
private
Parse a style code.
Constructor Details
#initialize(segment) ⇒ StyleParser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new instance of StyleParser
44 45 46 |
# File 'lib/sai/ansi/style_parser.rb', line 44 def initialize(segment) @segment = segment end |
Instance Attribute Details
#segment ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The current segment being processed
31 32 33 |
# File 'lib/sai/ansi/style_parser.rb', line 31 def segment @segment end |
Instance Method Details
#parse(code) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Parse a style code
59 60 61 62 63 |
# File 'lib/sai/ansi/style_parser.rb', line 59 def parse(code) return unless code.to_s.match?(STYLE_CODE_PATTERN) segment[:styles] << code.to_s end |