Class: DayOneKindle::Highlight
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
-
#book ⇒ Object
readonly
Returns the value of attribute book.
-
#highlight ⇒ Object
readonly
Returns the value of attribute highlight.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(options) ⇒ Highlight
constructor
A new instance of Highlight.
- #to_markdown ⇒ Object
Constructor Details
#initialize(options) ⇒ Highlight
Returns a new instance of Highlight.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dayone-kindle/highlight.rb', line 5 def initialize() # Faking required named arguments for ruby 2.0 compatibility %i(book highlight time).each do |param| raise ArgumentError, "missing keyword :#{param}" unless [param] instance_variable_set(:"@#{param}", [param]) end @page = [:page] @location = [:location] @authors = [:authors] || [] end |
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def @authors end |
#book ⇒ Object (readonly)
Returns the value of attribute book.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def book @book end |
#highlight ⇒ Object (readonly)
Returns the value of attribute highlight.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def highlight @highlight end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def location @location end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def page @page end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/dayone-kindle/highlight.rb', line 3 def time @time end |
Instance Method Details
#to_markdown ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dayone-kindle/highlight.rb', line 17 def to_markdown [ markdown_header, '', , '', markdown_highlight, '', ].compact.join("\n") end |