messagefactory 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/lib/messagefactory/Factory.rb +16 -10
- metadata +68 -46
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ require 'spec/rake/spectask'
|
|
13
13
|
|
14
14
|
spec = Gem::Specification.new do |s|
|
15
15
|
s.name = 'messagefactory'
|
16
|
-
s.version = '0.0.
|
16
|
+
s.version = '0.0.6'
|
17
17
|
s.has_rdoc = true
|
18
18
|
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
19
19
|
s.summary = 'Objectifies content from an IRC server'
|
@@ -25,6 +25,7 @@ spec = Gem::Specification.new do |s|
|
|
25
25
|
s.require_path = "lib"
|
26
26
|
s.bindir = "bin"
|
27
27
|
s.required_ruby_version = '>= 1.8.7'
|
28
|
+
s.add_dependency 'splib', '~> 1.4.3'
|
28
29
|
end
|
29
30
|
|
30
31
|
Rake::GemPackageTask.new(spec) do |p|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'splib'
|
2
|
+
Splib.load :Monitor
|
3
|
+
|
1
4
|
require 'messagefactory/Handler'
|
2
5
|
|
3
6
|
module MessageFactory
|
@@ -5,6 +8,7 @@ module MessageFactory
|
|
5
8
|
# Create a new Factory
|
6
9
|
def initialize
|
7
10
|
@handlers = {}
|
11
|
+
@lock = Splib::Monitor.new
|
8
12
|
end
|
9
13
|
|
10
14
|
# s:: string from server
|
@@ -63,17 +67,19 @@ module MessageFactory
|
|
63
67
|
end
|
64
68
|
|
65
69
|
def load_handlers
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
handler.types_process.
|
73
|
-
|
70
|
+
@lock.synchronize do
|
71
|
+
loaded = @handlers.values.map{|x|x.class}
|
72
|
+
MessageFactory::Handlers.constants.each do |cons|
|
73
|
+
klas = MessageFactory::Handlers.const_get(cons)
|
74
|
+
if(klas.is_a?(Class) && klas < MessageFactory::Handlers::Handler && !loaded.include?(klas))
|
75
|
+
handler = klas.new
|
76
|
+
if(handler.types_process.is_a?(Array))
|
77
|
+
handler.types_process.each do |t|
|
78
|
+
@handlers[t] = handler
|
79
|
+
end
|
80
|
+
else
|
81
|
+
@handlers[handler.types_process] = handler
|
74
82
|
end
|
75
|
-
else
|
76
|
-
@handlers[handler.types_process] = handler
|
77
83
|
end
|
78
84
|
end
|
79
85
|
end
|
metadata
CHANGED
@@ -1,18 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagefactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
|
-
|
12
|
+
- spox
|
8
13
|
autorequire:
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-21 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: splib
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 4
|
30
|
+
- 3
|
31
|
+
version: 1.4.3
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
16
34
|
description: Objectifies content from an IRC server
|
17
35
|
email: spox@modspox.com
|
18
36
|
executables: []
|
@@ -20,38 +38,38 @@ executables: []
|
|
20
38
|
extensions: []
|
21
39
|
|
22
40
|
extra_rdoc_files:
|
23
|
-
|
24
|
-
|
41
|
+
- README.rdoc
|
42
|
+
- LICENSE
|
25
43
|
files:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
- LICENSE
|
45
|
+
- README.rdoc
|
46
|
+
- Rakefile
|
47
|
+
- lib/messagefactory/Factory.rb
|
48
|
+
- lib/messagefactory/Handler.rb
|
49
|
+
- lib/messagefactory/handlers/001.rb
|
50
|
+
- lib/messagefactory/handlers/002.rb
|
51
|
+
- lib/messagefactory/handlers/003.rb
|
52
|
+
- lib/messagefactory/handlers/005.rb
|
53
|
+
- lib/messagefactory/handlers/254.rb
|
54
|
+
- lib/messagefactory/handlers/311.rb
|
55
|
+
- lib/messagefactory/handlers/341.rb
|
56
|
+
- lib/messagefactory/handlers/352.rb
|
57
|
+
- lib/messagefactory/handlers/353.rb
|
58
|
+
- lib/messagefactory/handlers/432.rb
|
59
|
+
- lib/messagefactory/handlers/INVITE.rb
|
60
|
+
- lib/messagefactory/handlers/JOIN.rb
|
61
|
+
- lib/messagefactory/handlers/KICK.rb
|
62
|
+
- lib/messagefactory/handlers/MODE.rb
|
63
|
+
- lib/messagefactory/handlers/NICK.rb
|
64
|
+
- lib/messagefactory/handlers/NOTICE.rb
|
65
|
+
- lib/messagefactory/handlers/PART.rb
|
66
|
+
- lib/messagefactory/handlers/PING.rb
|
67
|
+
- lib/messagefactory/handlers/PONG.rb
|
68
|
+
- lib/messagefactory/handlers/PRIVMSG.rb
|
69
|
+
- lib/messagefactory/handlers/QUIT.rb
|
70
|
+
- lib/messagefactory/handlers/Raw.rb
|
71
|
+
- lib/messagefactory.rb
|
72
|
+
- spec/dummy.rb
|
55
73
|
has_rdoc: true
|
56
74
|
homepage:
|
57
75
|
licenses: []
|
@@ -60,23 +78,27 @@ post_install_message:
|
|
60
78
|
rdoc_options: []
|
61
79
|
|
62
80
|
require_paths:
|
63
|
-
|
81
|
+
- lib
|
64
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
83
|
requirements:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 8
|
89
|
+
- 7
|
90
|
+
version: 1.8.7
|
70
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
92
|
requirements:
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
76
98
|
requirements: []
|
77
99
|
|
78
100
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.3.
|
101
|
+
rubygems_version: 1.3.6
|
80
102
|
signing_key:
|
81
103
|
specification_version: 3
|
82
104
|
summary: Objectifies content from an IRC server
|