messagefactory 0.0.4 → 0.0.5

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 +1 -1
  2. data/lib/messagefactory/Factory.rb +13 -8
  3. metadata +2 -2
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.4'
16
+ s.version = '0.0.5'
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'
@@ -39,17 +39,13 @@ module MessageFactory
39
39
  if(do_require)
40
40
  begin
41
41
  require "messagefactory/handlers/#{mtype}"
42
+ load_handlers
43
+ s = process(string, false)
42
44
  rescue LoadError
43
- raise NoMethodError.new("No handler found to process string: #{string}")
45
+ s = mk_unknown(string)
44
46
  end
45
- load_handlers
46
- s = process(string, false)
47
47
  else
48
- s = Message.new
49
- s.direction = :incoming
50
- s.received = Time.now
51
- s.raw = string.dup
52
- s.type = :UNKNOWN
48
+ s = mk_unknown(string)
53
49
  end
54
50
  end
55
51
  s
@@ -57,6 +53,15 @@ module MessageFactory
57
53
 
58
54
  private
59
55
 
56
+ def mk_unknown(string)
57
+ s = Message.new
58
+ s.direction = :incoming
59
+ s.received = Time.now
60
+ s.raw = string.dup
61
+ s.type = :UNKNOWN
62
+ s
63
+ end
64
+
60
65
  def load_handlers
61
66
  loaded = @handlers.values.map{|x|x.class}
62
67
  MessageFactory::Handlers.constants.each do |cons|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messagefactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - spox
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-19 00:00:00 -07:00
12
+ date: 2010-04-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15