Class: KindleHighlights::Highlight
- Inherits:
-
Object
- Object
- KindleHighlights::Highlight
- Defined in:
- lib/kindle_highlights/highlight.rb
Instance Attribute Summary collapse
-
#asin ⇒ Object
Returns the value of attribute asin.
-
#location ⇒ Object
Returns the value of attribute location.
-
#text ⇒ Object
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(asin:, text:, location:) ⇒ Highlight
constructor
A new instance of Highlight.
- #to_s ⇒ Object
Constructor Details
#initialize(asin:, text:, location:) ⇒ Highlight
Returns a new instance of Highlight.
13 14 15 16 17 |
# File 'lib/kindle_highlights/highlight.rb', line 13 def initialize(asin:, text:, location:) @asin = asin @text = text @location = location end |
Instance Attribute Details
#asin ⇒ Object
Returns the value of attribute asin.
3 4 5 |
# File 'lib/kindle_highlights/highlight.rb', line 3 def asin @asin end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/kindle_highlights/highlight.rb', line 3 def location @location end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/kindle_highlights/highlight.rb', line 3 def text @text end |
Class Method Details
.from_html_elements(book:, html_elements:) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/kindle_highlights/highlight.rb', line 5 def self.from_html_elements(book:, html_elements:) new( asin: book.asin, text: html_elements.children.search("div.kp-notebook-highlight").first.text.squish, location: html_elements.children.search("input#kp-annotation-location").first.attributes["value"].value, ) end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/kindle_highlights/highlight.rb', line 19 def to_s text end |