Class: ClippingsPluck::Clipping

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

Instance Method Summary collapse

Instance Method Details

#eligible_for_note_attachment?(note_location) ⇒ Boolean

Returns:

  • (Boolean)


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

def eligible_for_note_attachment?(note_location)
  has_location? && normalized_location <= note_location
end

#has_location?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/clippings_pluck/clipping.rb', line 23

def has_location?
  !missing_location?
end

#location=(location) ⇒ Object



3
4
5
# File 'lib/clippings_pluck/clipping.rb', line 3

def location=(location)
  self[:location] = Location.new(location)
end

#missing_location?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/clippings_pluck/clipping.rb', line 19

def missing_location?
  self[:location].nil?
end

#normalized_locationObject



7
8
9
# File 'lib/clippings_pluck/clipping.rb', line 7

def normalized_location
  missing_location? ? nil : self[:location].normalize
end

#notated?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/clippings_pluck/clipping.rb', line 15

def notated?
  !self[:note].nil?
end