Class: IRC::Server::Dispatcher::Event
- Defined in:
- lib/failirc/server/dispatcher/event.rb
Defined Under Namespace
Classes: Callback
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
-
#dispatcher ⇒ Object
readonly
Returns the value of attribute dispatcher.
-
#special ⇒ Object
Returns the value of attribute special.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
-
#thing ⇒ Object
readonly
Returns the value of attribute thing.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Class Method Summary collapse
- .aliases(dispatcher, chain, types) ⇒ Object
- .callbacks(dispatcher, chain, types) ⇒ Object
- .types(dispatcher, chain, string) ⇒ Object
Instance Method Summary collapse
- #callbacks ⇒ Object
-
#initialize(dispatcher, chain, thing, string) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(dispatcher, chain, thing, string) ⇒ Event
Returns a new instance of Event.
44 45 46 47 48 49 50 51 52 |
# File 'lib/failirc/server/dispatcher/event.rb', line 44 def initialize (dispatcher, chain, thing, string) @dispatcher = dispatcher @chain = chain @thing = thing @string = string @types = Event.types(dispatcher, chain, string) @aliases = Event.aliases(dispatcher, chain, types) @callbacks = Event.callbacks(dispatcher, chain, types) end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def aliases @aliases end |
#chain ⇒ Object (readonly)
Returns the value of attribute chain.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def chain @chain end |
#dispatcher ⇒ Object (readonly)
Returns the value of attribute dispatcher.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def dispatcher @dispatcher end |
#special ⇒ Object
Returns the value of attribute special.
42 43 44 |
# File 'lib/failirc/server/dispatcher/event.rb', line 42 def special @special end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def string @string end |
#thing ⇒ Object (readonly)
Returns the value of attribute thing.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def thing @thing end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
41 42 43 |
# File 'lib/failirc/server/dispatcher/event.rb', line 41 def types @types end |
Class Method Details
.aliases(dispatcher, chain, types) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/failirc/server/dispatcher/event.rb', line 80 def self.aliases (dispatcher, chain, types) aliases = [] dispatcher.aliases[chain].each {|key, value| if types.include?(value) aliases.push key end } return aliases end |
.callbacks(dispatcher, chain, types) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/failirc/server/dispatcher/event.rb', line 92 def self.callbacks (dispatcher, chain, types) callbacks = [] if chain == :pre || chain == :post || chain == :default callbacks.insert(-1, *dispatcher.events[chain]) else types.each {|type| callbacks.insert(-1, *dispatcher.events[chain][type]) } end return callbacks end |
.types(dispatcher, chain, string) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/failirc/server/dispatcher/event.rb', line 68 def self.types (dispatcher, chain, string) types = [] dispatcher.events[chain].each_key {|key| if key.class == Regexp && key.match(string) types.push key end } return types end |