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.
18 19 20 21 |
# File 'lib/anyplayer/selector.rb', line 18 def initialize @verbose = false @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
16 17 18 |
# File 'lib/anyplayer/selector.rb', line 16 def errors @errors end |
#verbose ⇒ Object
Returns the value of attribute verbose.
15 16 17 |
# File 'lib/anyplayer/selector.rb', line 15 def verbose @verbose end |
Instance Method Details
#player ⇒ Object
Returns an instance of the first music player that’s launched
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/anyplayer/selector.rb', line 24 def player PLAYERS.each do |player| player_load(player) || next instance = player_class(player).new player_on_platform?(instance) || next return instance if player_launched?(instance) end nil end |