class Basher::Word
Initializing a word with a string, returns a Basher::Word
instance that holds a frozen reference to the original string, and has a cursor used for moving between the items in the string in a OOP fashion.
Attributes
cursor[R]
Basher::Word::Cursor instance.
string[R]
Frozen reference of the word.
Public Class Methods
new(string)
click to toggle source
Returns a Word
instance for the given string. The cursor’s public methods are delegated to this instance as well.
# File lib/basher/word.rb, line 25 def initialize(string) @string = string.dup.freeze @cursor = Cursor.new(@string) end