Class: Ticard::Parser
- Inherits:
-
Object
- Object
- Ticard::Parser
- Defined in:
- lib/ticard/parser.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(text) ⇒ Parser
constructor
A new instance of Parser.
- #metadata(field) ⇒ Object
- #parse ⇒ Object
Constructor Details
#initialize(text) ⇒ Parser
Returns a new instance of Parser.
4 5 6 |
# File 'lib/ticard/parser.rb', line 4 def initialize(text) @text = text end |
Instance Method Details
#content ⇒ Object
12 13 14 15 |
# File 'lib/ticard/parser.rb', line 12 def content regex = /.*<!---.*?-->[\b\n]*(.*)/m regex.match(@text)[1] end |
#metadata(field) ⇒ Object
17 18 19 20 |
# File 'lib/ticard/parser.rb', line 17 def (field) regex = /.*<!---.*?^\b*#{field} (.+?)$.*-->.+/m regex.match(@text)[1] end |