Class: ItunesController::SpecialKind

Inherits:
Object
  • Object
show all
Defined in:
lib/itunesController/kinds.rb

Overview

A enum of special kinds

Constant Summary collapse

Audiobooks =

The Audio Book kind

SpecialKind.new(1800630337,"Audiobooks")
Folder =

The folder kind

SpecialKind.new(1800630342,"Folder")
Movies =

The movie kind

SpecialKind.new(1800630345,"Movies")
Music =

The music kind

SpecialKind.new(1800630362,"Music")
None =

The none kind

SpecialKind.new(1800302446,"None")
PartyShuffle =

The party shuffle kind

SpecialKind.new(1800630355,"Party Shuffle")
Podcasts =

The pod cast kind

SpecialKind.new(1800630352,"Podcasts")
PurchasedMusic =

The purchased music kind

SpecialKind.new(1800630349,"Purchased Music")
TVShows =

The TV show kind

SpecialKind.new(1800630356,"TV Shows")
Videos =

The video kind

SpecialKind.new(1800630358,"Videos")
Genius =

The genius kind

SpecialKind.new(1800630343,"Genius")
ITunesU =

The iTunesU kind

SpecialKind.new(1800630357,"iTunes U")
Library =

The library kind

SpecialKind.new(1800630348,"Library")
Unknown =

The unknown kind

SpecialKind.new(-1,"Unknown")
@@values =
[Audiobooks,Folder,Movies,Music,
None,PartyShuffle,Podcasts,PurchasedMusic,
TVShows, Videos,Genius,ITunesU,Library,Unknown]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, displayName) ⇒ SpecialKind

Returns a new instance of SpecialKind.



29
30
31
32
# File 'lib/itunesController/kinds.rb', line 29

def initialize(kind,displayName)
    @kind = kind
    @displayName = displayName
end

Instance Attribute Details

#displayNameObject

Returns the value of attribute displayName.



28
29
30
# File 'lib/itunesController/kinds.rb', line 28

def displayName
  @displayName
end

#kindNumber

The Source kind ID

Returns:

  • (Number)

    the current value of kind



27
28
29
# File 'lib/itunesController/kinds.rb', line 27

def kind
  @kind
end

#StringString

the source display name

Returns:

  • (String)

    the current value of String



27
28
29
# File 'lib/itunesController/kinds.rb', line 27

def String
  @String
end

Class Method Details

.fromKind(kind) ⇒ ItunesController::SourceKind

A class scoped method used to get the kind associated with the kind ID

Parameters:

  • kind

    The kind ID

Returns:



70
71
72
73
74
75
76
77
# File 'lib/itunesController/kinds.rb', line 70

def self.fromKind(kind)
    @@values.each { | v1 |
        if (v1.kind==kind)
        return v1
        end
    }
    return SpecialKind.new(v1,"Unknown")
end

Instance Method Details

#to_sObject

Used pretty print the kind to a string

Returns:

  • A string containing the kind display name and ID



81
82
83
# File 'lib/itunesController/kinds.rb', line 81

def to_s
    return "#{displayName} (#{kind})"
end