Class: Anyplayer::Selector
- Inherits:
-
Object
- Object
- Anyplayer::Selector
- Defined in:
- lib/anyplayer/selector.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize ⇒ Selector
constructor
A new instance of Selector.
-
#player ⇒ Object
Returns an instance of the first music player that’s launched.
Constructor Details
#initialize ⇒ Selector
Returns a new instance of Selector.
17 18 19 20 |
# File 'lib/anyplayer/selector.rb', line 17 def initialize @verbose = false @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
15 16 17 |
# File 'lib/anyplayer/selector.rb', line 15 def errors @errors end |
#verbose ⇒ Object
Returns the value of attribute verbose.
14 15 16 |
# File 'lib/anyplayer/selector.rb', line 14 def verbose @verbose end |
Instance Method Details
#player ⇒ Object
Returns an instance of the first music player that’s launched
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/anyplayer/selector.rb', line 23 def player PLAYERS.each do |player| player_load(player) or next instance = player_class(player).new player_on_platform?(instance) or next if player_launched?(instance) return instance end end nil end |