Class: CommandParser
- Inherits:
-
Object
- Object
- CommandParser
- Defined in:
- lib/command_parser.rb
Instance Method Summary collapse
-
#initialize(text) ⇒ CommandParser
constructor
A new instance of CommandParser.
-
#parse ⇒ Object
Takes text and turns it into a Ruby statement that can be passed to instance_eval on the appropriate object.
-
#quote_urls ⇒ Object
Put quotes around unquoted urls.
Constructor Details
#initialize(text) ⇒ CommandParser
Returns a new instance of CommandParser.
2 3 4 |
# File 'lib/command_parser.rb', line 2 def initialize(text) @text = text end |
Instance Method Details
#parse ⇒ Object
Takes text and turns it into a Ruby statement that can be passed to instance_eval on the appropriate object.
8 9 10 11 |
# File 'lib/command_parser.rb', line 8 def parse quote_urls @text end |
#quote_urls ⇒ Object
Put quotes around unquoted urls
14 15 16 |
# File 'lib/command_parser.rb', line 14 def quote_urls @text.gsub!(/([\s(])(http:[^\s)]*)/, '\1\'\2\'') end |