Class: MPlayer::CallbackList

Inherits:
Array
  • Object
show all
Defined in:
lib/easy_mplayer/callback.rb

Overview

:nodoc:all

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list_name) ⇒ CallbackList

Returns a new instance of CallbackList.



22
23
24
# File 'lib/easy_mplayer/callback.rb', line 22

def initialize(list_name)
  @name = list_name.to_sym
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/easy_mplayer/callback.rb', line 20

def name
  @name
end

Class Method Details

.allObject



37
38
39
# File 'lib/easy_mplayer/callback.rb', line 37

def all
  @all ||= Hash.new
end

.find(name) ⇒ Object



41
42
43
# File 'lib/easy_mplayer/callback.rb', line 41

def find(name)
  all[name.to_sym] ||= new(name)
end

.register(opts) ⇒ Object



45
46
47
# File 'lib/easy_mplayer/callback.rb', line 45

def register(opts)
  find(opts[:name]).register(opts)
end

.run!(name, args) ⇒ Object



49
50
51
# File 'lib/easy_mplayer/callback.rb', line 49

def run!(name, args)
  find(name).run!(args)
end

Instance Method Details

#register(opts) ⇒ Object



26
27
28
# File 'lib/easy_mplayer/callback.rb', line 26

def register(opts)
  push Callback.new(opts)
end

#run!(args) ⇒ Object



30
31
32
33
34
# File 'lib/easy_mplayer/callback.rb', line 30

def run!(args)
  each do |x|
    x.run!(args)
  end
end