messagefactory 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +2 -1
  2. data/lib/messagefactory/Factory.rb +16 -10
  3. 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.5'
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
- loaded = @handlers.values.map{|x|x.class}
67
- MessageFactory::Handlers.constants.each do |cons|
68
- klas = MessageFactory::Handlers.const_get(cons)
69
- if(klas.is_a?(Class) && klas < MessageFactory::Handlers::Handler && !loaded.include?(klas))
70
- handler = klas.new
71
- if(handler.types_process.is_a?(Array))
72
- handler.types_process.each do |t|
73
- @handlers[t] = handler
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
- version: 0.0.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 6
9
+ version: 0.0.6
5
10
  platform: ruby
6
11
  authors:
7
- - spox
12
+ - spox
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-20 00:00:00 -07:00
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
- - README.rdoc
24
- - LICENSE
41
+ - README.rdoc
42
+ - LICENSE
25
43
  files:
26
- - LICENSE
27
- - README.rdoc
28
- - Rakefile
29
- - lib/messagefactory.rb
30
- - lib/messagefactory/Factory.rb
31
- - lib/messagefactory/Handler.rb
32
- - lib/messagefactory/handlers/001.rb
33
- - lib/messagefactory/handlers/002.rb
34
- - lib/messagefactory/handlers/003.rb
35
- - lib/messagefactory/handlers/005.rb
36
- - lib/messagefactory/handlers/254.rb
37
- - lib/messagefactory/handlers/311.rb
38
- - lib/messagefactory/handlers/341.rb
39
- - lib/messagefactory/handlers/352.rb
40
- - lib/messagefactory/handlers/353.rb
41
- - lib/messagefactory/handlers/432.rb
42
- - lib/messagefactory/handlers/INVITE.rb
43
- - lib/messagefactory/handlers/JOIN.rb
44
- - lib/messagefactory/handlers/KICK.rb
45
- - lib/messagefactory/handlers/MODE.rb
46
- - lib/messagefactory/handlers/NICK.rb
47
- - lib/messagefactory/handlers/NOTICE.rb
48
- - lib/messagefactory/handlers/PART.rb
49
- - lib/messagefactory/handlers/PING.rb
50
- - lib/messagefactory/handlers/PONG.rb
51
- - lib/messagefactory/handlers/PRIVMSG.rb
52
- - lib/messagefactory/handlers/QUIT.rb
53
- - lib/messagefactory/handlers/Raw.rb
54
- - spec/dummy.rb
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
- - lib
81
+ - lib
64
82
  required_ruby_version: !ruby/object:Gem::Requirement
65
83
  requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 1.8.7
69
- version:
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
- - !ruby/object:Gem::Version
74
- version: "0"
75
- version:
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.5
101
+ rubygems_version: 1.3.6
80
102
  signing_key:
81
103
  specification_version: 3
82
104
  summary: Objectifies content from an IRC server