Class: NHKore::ScrapeWordsResult
- Inherits:
-
Object
- Object
- NHKore::ScrapeWordsResult
- Defined in:
- lib/nhkore/article_scraper.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Instance Method Summary collapse
- #add_text(text) ⇒ Object
- #add_word(word) ⇒ Object
-
#initialize ⇒ ScrapeWordsResult
constructor
A new instance of ScrapeWordsResult.
- #polish! ⇒ Object
- #words? ⇒ Boolean
Constructor Details
#initialize ⇒ ScrapeWordsResult
Returns a new instance of ScrapeWordsResult.
644 645 646 647 648 649 |
# File 'lib/nhkore/article_scraper.rb', line 644 def initialize super @text = ''.dup @words = [] end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
641 642 643 |
# File 'lib/nhkore/article_scraper.rb', line 641 def text @text end |
#words ⇒ Object (readonly)
Returns the value of attribute words.
642 643 644 |
# File 'lib/nhkore/article_scraper.rb', line 642 def words @words end |
Instance Method Details
#add_text(text) ⇒ Object
651 652 653 654 655 |
# File 'lib/nhkore/article_scraper.rb', line 651 def add_text(text) @text << Util.reduce_jpn_space(text) return self end |
#add_word(word) ⇒ Object
657 658 659 660 661 |
# File 'lib/nhkore/article_scraper.rb', line 657 def add_word(word) @words << word return self end |
#polish! ⇒ Object
663 664 665 666 667 |
# File 'lib/nhkore/article_scraper.rb', line 663 def polish! @text = Util.strip_web_str(@text) return self end |
#words? ⇒ Boolean
669 670 671 |
# File 'lib/nhkore/article_scraper.rb', line 669 def words? return !@words.empty? end |