Class: AsciiDoc::AsciiChars

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoc/asciichars.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#charsObject

Returns the value of attribute chars.



5
6
7
# File 'lib/asciidoc/asciichars.rb', line 5

def chars
  @chars
end

#current_indexObject

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_charObject



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_charObject



12
13
14
15
# File 'lib/asciidoc/asciichars.rb', line 12

def shift_char
  @current_index += 1
  current_char
end