Method: Parser#initialize
- Defined in:
- lib/parser.rb
#initialize(hash) ⇒ Parser
Returns a new instance of Parser.
3 4 5 6 7 8 9 |
# File 'lib/parser.rb', line 3 def initialize(hash) @string = hash[:string] @keyword = hash[:keyword] raise "No Keyword given" unless keyword raise "Nothing to parse given" unless string raise "No #{keyword} given." unless /#{keyword}(.*)/.match(string) end |