Class: NHKore::ScrapeWordsResult

Inherits:
Object
  • Object
show all
Defined in:
lib/nhkore/article_scraper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScrapeWordsResult

Returns a new instance of ScrapeWordsResult.



645
646
647
648
649
650
# File 'lib/nhkore/article_scraper.rb', line 645

def initialize
  super

  @text = ''.dup
  @words = []
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



642
643
644
# File 'lib/nhkore/article_scraper.rb', line 642

def text
  @text
end

#wordsObject (readonly)

Returns the value of attribute words.



643
644
645
# File 'lib/nhkore/article_scraper.rb', line 643

def words
  @words
end

Instance Method Details

#add_text(text) ⇒ Object



652
653
654
655
656
# File 'lib/nhkore/article_scraper.rb', line 652

def add_text(text)
  @text << Util.reduce_jpn_space(text)

  return self
end

#add_word(word) ⇒ Object



658
659
660
661
662
# File 'lib/nhkore/article_scraper.rb', line 658

def add_word(word)
  @words << word

  return self
end

#polish!Object



664
665
666
667
668
# File 'lib/nhkore/article_scraper.rb', line 664

def polish!
  @text = Util.strip_web_str(@text)

  return self
end

#words?Boolean

Returns:

  • (Boolean)


670
671
672
# File 'lib/nhkore/article_scraper.rb', line 670

def words?
  return !@words.empty?
end