Class: NHKore::ScrapeWordsResult

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

Overview

Author:

  • Jonathan Bradley Whited

Since:

  • 0.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScrapeWordsResult

Returns a new instance of ScrapeWordsResult.

Since:

  • 0.2.0



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

def initialize
  super()

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

Instance Attribute Details

#textObject (readonly)

Since:

  • 0.2.0



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

def text
  @text
end

#wordsObject (readonly)

Since:

  • 0.2.0



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

def words
  @words
end

Instance Method Details

#add_text(text) ⇒ Object

Since:

  • 0.2.0



650
651
652
653
654
# File 'lib/nhkore/article_scraper.rb', line 650

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

  return self
end

#add_word(word) ⇒ Object

Since:

  • 0.2.0



656
657
658
659
660
# File 'lib/nhkore/article_scraper.rb', line 656

def add_word(word)
  @words << word

  return self
end

#polish!Object

Since:

  • 0.2.0



662
663
664
665
666
# File 'lib/nhkore/article_scraper.rb', line 662

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

  return self
end

#words?Boolean

Returns:

  • (Boolean)

Since:

  • 0.2.0



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

def words?
  return !@words.empty?
end