class KindleHighlights::Highlight

Attributes

asin[RW]
location[RW]
text[RW]

Public Class Methods

from_html_elements(book:, html_elements:) click to toggle source
# 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
new(asin:, text:, location:) click to toggle source
# File lib/kindle_highlights/highlight.rb, line 13
def initialize(asin:, text:, location:)
  @asin = asin
  @text = text
  @location = location
end

Public Instance Methods

to_s() click to toggle source
# File lib/kindle_highlights/highlight.rb, line 19
def to_s
  text
end