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.



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

def initialize
  super

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

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

#wordsObject (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

Returns:

  • (Boolean)


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

def words?
  return !@words.empty?
end