Class: Farseer::Word
Instance Method Summary collapse
-
#initialize(word) ⇒ Word
constructor
A new instance of Word.
- #parse(input) ⇒ Object
Methods included from MapFactory
Constructor Details
#initialize(word) ⇒ Word
Returns a new instance of Word.
7 8 9 10 |
# File 'lib/farseer/word.rb', line 7 def initialize(word) @word = word freeze end |
Instance Method Details
#parse(input) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/farseer/word.rb', line 12 def parse(input) case when input.start_with?(@word) then Maybe.return(Result.new(@word, input[@word.length..])) else Maybe.none end end |