Class: KindleClippings::Clipping

Inherits:
Object
  • Object
show all
Defined in:
lib/kindleclippings/clipping.rb

Constant Summary collapse

DEFAULT_DATE_FORMAT =
"%A, %B %d, %Y, %I:%M %p"
KINDLE_TOUCH_DATE_FORMAT =
"%A, %B %d, %Y  %I:%M:%S %p"
ALTERNATIVE_DATE_FORMAT =
"%A, %d %B %y %H:%M:%S %Z"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, author, type, location, added_on, content, page = "0") ⇒ Clipping

Returns a new instance of Clipping.



11
12
# File 'lib/kindleclippings/clipping.rb', line 11

def initialize()
end

Instance Attribute Details

#added_onObject

Returns the value of attribute added_on.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def added_on
  @added_on
end

#authorObject

Returns the value of attribute author.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def author
  @author
end

#book_titleObject

Returns the value of attribute book_title.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def book_title
  @book_title
end

#contentObject

Returns the value of attribute content.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def content
  @content
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def location
  @location
end

#pageObject

Returns the value of attribute page.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def page
  @page
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/kindleclippings/clipping.rb', line 6

def type
  @type
end

Instance Method Details

#to_sObject



34
35
36
37
38
# File 'lib/kindleclippings/clipping.rb', line 34

def to_s
  "#{@book_title} (#{author})\n" +
  "- #{@type} #{('on Page ' + @page.to_s + ' | ') if @page > 0}Loc. #{@location} | Added on #{@added_on.strftime('%A, %B %d, %Y, %I:%M %p')}\n\n" +
  "#{@content}"
end