Class: AsciiDoc::AsciiChars
- Inherits:
-
Object
- Object
- AsciiDoc::AsciiChars
- Defined in:
- lib/asciidoc/asciichars.rb
Instance Attribute Summary collapse
-
#chars ⇒ Object
Returns the value of attribute chars.
-
#current_index ⇒ Object
Returns the value of attribute current_index.
Instance Method Summary collapse
- #current_char ⇒ Object
-
#initialize(content) ⇒ AsciiChars
constructor
A new instance of AsciiChars.
- #next_char(num = 1) ⇒ Object
- #prev_char(num = 1) ⇒ Object
- #shift_char ⇒ Object
Constructor Details
#initialize(content) ⇒ AsciiChars
Returns a new instance of AsciiChars.
7 8 9 10 |
# File 'lib/asciidoc/asciichars.rb', line 7 def initialize(content) @current_index = 0 @chars = content end |
Instance Attribute Details
#chars ⇒ Object
Returns the value of attribute chars.
5 6 7 |
# File 'lib/asciidoc/asciichars.rb', line 5 def chars @chars end |
#current_index ⇒ Object
Returns the value of attribute current_index.
5 6 7 |
# File 'lib/asciidoc/asciichars.rb', line 5 def current_index @current_index end |
Instance Method Details
#current_char ⇒ Object
25 26 27 |
# File 'lib/asciidoc/asciichars.rb', line 25 def current_char @chars[@current_index, 1] end |
#next_char(num = 1) ⇒ Object
21 22 23 |
# File 'lib/asciidoc/asciichars.rb', line 21 def next_char(num = 1) @chars[@current_index + 1, num] end |
#prev_char(num = 1) ⇒ Object
17 18 19 |
# File 'lib/asciidoc/asciichars.rb', line 17 def prev_char(num = 1) @chars[@current_index - 1, num] end |
#shift_char ⇒ Object
12 13 14 15 |
# File 'lib/asciidoc/asciichars.rb', line 12 def shift_char @current_index += 1 current_char end |