Class: SI::CopyscapeMatches
- Inherits:
-
Object
- Object
- SI::CopyscapeMatches
- Includes:
- Enumerable
- Defined in:
- lib/copyscape_matches.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#match_percent ⇒ Object
readonly
Returns the value of attribute match_percent.
-
#query_word_count ⇒ Object
readonly
Returns the value of attribute query_word_count.
Instance Method Summary collapse
- #all_html_snippets ⇒ Object
- #all_text_snippets ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(response:, match_percent:) ⇒ CopyscapeMatches
constructor
A new instance of CopyscapeMatches.
Constructor Details
#initialize(response:, match_percent:) ⇒ CopyscapeMatches
Returns a new instance of CopyscapeMatches.
7 8 9 10 11 12 |
# File 'lib/copyscape_matches.rb', line 7 def initialize response:, match_percent: @query_word_count = response.query_words.to_i @match_percent = match_percent.to_i @collection = _build_collection response.results @error = response.error end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/copyscape_matches.rb', line 5 def collection @collection end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/copyscape_matches.rb', line 5 def error @error end |
#match_percent ⇒ Object (readonly)
Returns the value of attribute match_percent.
5 6 7 |
# File 'lib/copyscape_matches.rb', line 5 def match_percent @match_percent end |
#query_word_count ⇒ Object (readonly)
Returns the value of attribute query_word_count.
5 6 7 |
# File 'lib/copyscape_matches.rb', line 5 def query_word_count @query_word_count end |
Instance Method Details
#all_html_snippets ⇒ Object
18 19 20 |
# File 'lib/copyscape_matches.rb', line 18 def all_html_snippets collection.map{|m| m.html_snippet} end |
#all_text_snippets ⇒ Object
14 15 16 |
# File 'lib/copyscape_matches.rb', line 14 def all_text_snippets collection.map{|m| m.text_snippet} end |
#each(&block) ⇒ Object
22 23 24 |
# File 'lib/copyscape_matches.rb', line 22 def each(&block) collection.each(&block) end |