Class: Marti::MarticleParser
- Inherits:
-
Object
- Object
- Marti::MarticleParser
- Defined in:
- lib/marti/services/marticle_parser.rb
Defined Under Namespace
Classes: LineResponse
Constant Summary collapse
- CUT =
"--CUT--"
Instance Attribute Summary collapse
-
#article ⇒ Object
readonly
Returns the value of attribute article.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(file) ⇒ MarticleParser
constructor
A new instance of MarticleParser.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ MarticleParser
Returns a new instance of MarticleParser.
5 6 7 |
# File 'lib/marti/services/marticle_parser.rb', line 5 def initialize(file) @file = file end |
Instance Attribute Details
#article ⇒ Object (readonly)
Returns the value of attribute article.
3 4 5 |
# File 'lib/marti/services/marticle_parser.rb', line 3 def article @article end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/marti/services/marticle_parser.rb', line 3 def file @file end |
Instance Method Details
#parse ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/marti/services/marticle_parser.rb', line 9 def parse # clear article @article = Marticle.new set_article_time_from_file! content, extract = retrieve_content content = markdown.render(content.join("\n")) extract = markdown.render(extract.join("\n")) set('content', content) # Strip last \n from extract set('extract', extract.strip) article end |