Class: Marvin::AbstractParser
- Inherits:
-
Object
- Object
- Marvin::AbstractParser
- Defined in:
- lib/marvin/abstract_parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#event ⇒ Object
Returns the value of attribute event.
-
#line ⇒ Object
Returns the value of attribute line.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(line) ⇒ AbstractParser
constructor
Instantiates a parser instance, attempts to parse it for it’s command and it’s event.
- #to_event ⇒ Object
Constructor Details
#initialize(line) ⇒ AbstractParser
Instantiates a parser instance, attempts to parse it for it’s command and it’s event.
8 9 10 11 12 |
# File 'lib/marvin/abstract_parser.rb', line 8 def initialize(line) @line = line @command = self.class.parse!(line) @event = @command.to_event unless @command.blank? end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
4 5 6 |
# File 'lib/marvin/abstract_parser.rb', line 4 def command @command end |
#event ⇒ Object
Returns the value of attribute event.
4 5 6 |
# File 'lib/marvin/abstract_parser.rb', line 4 def event @event end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/marvin/abstract_parser.rb', line 4 def line @line end |
Class Method Details
.parse(line) ⇒ Object
18 19 20 |
# File 'lib/marvin/abstract_parser.rb', line 18 def self.parse(line) new(line.strip).to_event end |
Instance Method Details
#to_event ⇒ Object
14 15 16 |
# File 'lib/marvin/abstract_parser.rb', line 14 def to_event @event end |