Class: Hearken::Track
- Inherits:
-
Object
- Object
- Hearken::Track
- Defined in:
- lib/hearken/track.rb
Constant Summary
Constants included from Tagged
Hearken::Tagged::FIELDS, Hearken::Tagged::FILE_FIELDS, Hearken::Tagged::TAG_FIELDS
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#started ⇒ Object
Returns the value of attribute started.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(id = nil) ⇒ Track
constructor
A new instance of Track.
- #my(field, colour) ⇒ Object
- #search_id ⇒ Object
- #search_string ⇒ Object
- #to_s ⇒ Object
- #to_short_s ⇒ Object
- #valid? ⇒ Boolean
Methods included from Colour
Methods included from Tagged
Constructor Details
#initialize(id = nil) ⇒ Track
Returns a new instance of Track.
13 14 15 |
# File 'lib/hearken/track.rb', line 13 def initialize(id = nil) @id = id end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/hearken/track.rb', line 11 def id @id end |
#started ⇒ Object
Returns the value of attribute started.
11 12 13 |
# File 'lib/hearken/track.rb', line 11 def started @started end |
Instance Method Details
#[](key) ⇒ Object
17 18 19 |
# File 'lib/hearken/track.rb', line 17 def [](key) send key end |
#my(field, colour) ⇒ Object
49 50 51 |
# File 'lib/hearken/track.rb', line 49 def my(field, colour) c send(field).to_s, colour end |
#search_id ⇒ Object
25 26 27 |
# File 'lib/hearken/track.rb', line 25 def search_id id.to_s 36 end |
#search_string ⇒ Object
29 30 31 |
# File 'lib/hearken/track.rb', line 29 def search_string "#{artist.to_s.downcase}#{album.to_s.downcase}#{title.to_s.downcase}#{date}" end |
#to_s ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/hearken/track.rb', line 33 def to_s [ "[#{my(:search_id, :white)}]", my(:artist, :yellow), my(:album, :cyan), my(:track, :magenta), my(:title, :green), my(:date, :white), my(:time, :white) ].join(" ") end |
#to_short_s ⇒ Object
45 46 47 |
# File 'lib/hearken/track.rb', line 45 def to_short_s "#{track} #{title}\n#{artist}\n#{album}" end |
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/hearken/track.rb', line 21 def valid? @track end |