Class: MPlayer::Callback
- Inherits:
-
Object
- Object
- MPlayer::Callback
- Defined in:
- lib/easy_mplayer/callback.rb
Overview
:nodoc:all
Instance Method Summary collapse
-
#initialize(callback_options) ⇒ Callback
constructor
A new instance of Callback.
- #run!(args) ⇒ Object
Constructor Details
#initialize(callback_options) ⇒ Callback
Returns a new instance of Callback.
3 4 5 6 7 |
# File 'lib/easy_mplayer/callback.rb', line 3 def initialize() @block = [:block] @type = [:type] @scope = [:scope] end |
Instance Method Details
#run!(args) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/easy_mplayer/callback.rb', line 9 def run!(args) unless @block.nil? case @type when :instance then @block.call(*args) when :class then @scope.instance_exec(*args, &@block) end end end |