Sha256: a39b9d373cb5e5ee71d2b6bd8d1bb7ac0396bfe7254b33b3d491d17fdb892ba8

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

module ItunesParser
  module Track

    # Shows all tracks in the doc.
    # Returns Hash { track_id => { <track_information> } }
    # Optional param `pretty` returns Array of Hashes with only IDs and Names.
    def tracks pretty: false
      _tracks = self.doc["Tracks"]

      unless pretty
        _tracks
      else
        _tracks.collect{|track| { id: track[1]["Track ID"], name: track[1]["Name"] }}
      end
    end

    # Shows one track.
    # Returns Hash with track info.
    def track(id)
      tracks["#{id}"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itunes_parser-1.1.3 lib/itunes_parser/track.rb
itunes_parser-1.1.2 lib/itunes_parser/track.rb