rubysl-e2mmap 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 346bf1dcdde5b69543447281363a996392422990
4
- data.tar.gz: ddbbb3a0c8e4b5ff355522bc78c17ac828ec770b
3
+ metadata.gz: f11f517f32e3d09ee6075f8713b7a2d326b8b198
4
+ data.tar.gz: 1b427c240add26f684738e68e8ad0700748cc53d
5
5
  SHA512:
6
- metadata.gz: 020b324df8806e79016476f329ba2683a777e062555dbf9a3fcf080de9b5debb997a11f5090bd9eb36051e71f47b17ebc91cfdf92cb9aa8dd5d8ee6ff2a28d9c
7
- data.tar.gz: cba3d12fcb4368c30dd660465637f6e5a73bceb4ae235ede17352f25bb9fa917727c96eee13a4d650ea48e659efaa73a84dc4e7edb984499b5326026fbf9a541
6
+ metadata.gz: 23a06501ed6e6669f8cc48712b6c906274f7697d11e0d5bad4e2d9bde5033519539c813cc6fc9f2d82b4d34878ec1d252ceaf925fc1f44f120abc75d393f9206
7
+ data.tar.gz: 94599fda67e4dd5352df93513116b4bdf8b6a00e569fa6a2d8bc1ca6547dcf181ed4474f058e0fc0ceeb2615a29f84cdb2d22aae76d271f23303c42ab4c3b024
@@ -1,9 +1,8 @@
1
1
  #
2
2
  # e2mmap.rb - for ruby 1.1
3
- # $Release Version: 2.0$
4
- # $Revision: 1.10 $
5
- # $Date: 1999/02/17 12:33:17 $
6
- # by Keiju ISHITSUKA
3
+ # $Release Version: 2.0$
4
+ # $Revision: 1.10 $
5
+ # by Keiju ISHITSUKA
7
6
  #
8
7
  # --
9
8
  # Usage:
@@ -48,8 +47,6 @@
48
47
  # Foo.Fail ExistingExceptionClass, arg...
49
48
  #
50
49
  #
51
- fail "Use Ruby 1.1" if VERSION < "1.1"
52
-
53
50
  module Exception2MessageMapper
54
51
  @RCS_ID='-$Id: e2mmap.rb,v 1.10 1999/02/17 12:33:17 keiju Exp keiju $-'
55
52
 
@@ -57,13 +54,7 @@ module Exception2MessageMapper
57
54
 
58
55
  def E2MM.extend_object(cl)
59
56
  super
60
- cl.bind(self) unless cl == E2MM
61
- end
62
-
63
- # backward compatibility
64
- def E2MM.extend_to(b)
65
- c = eval("self", b)
66
- c.extend(self)
57
+ cl.bind(self) unless cl < E2MM
67
58
  end
68
59
 
69
60
  def bind(cl)
@@ -80,44 +71,31 @@ module Exception2MessageMapper
80
71
  end
81
72
 
82
73
  # Fail(err, *rest)
83
- # err: exception
84
- # rest: message arguments
74
+ # err: exception
75
+ # rest: message arguments
85
76
  #
86
- def Raise(err=nil, *rest)
77
+ def Raise(err = nil, *rest)
87
78
  E2MM.Raise(self, err, *rest)
88
79
  end
89
80
  alias Fail Raise
90
-
91
- # backward compatibility
92
- alias fail! fail
93
- def fail(err=nil, *rest)
94
- begin
95
- E2MM.Fail(self, err, *rest)
96
- rescue E2MM::ErrNotRegisteredException
97
- super
98
- end
99
- end
100
- class << self
101
- public :fail
102
- end
103
-
81
+ alias fail Raise
104
82
 
105
83
  # def_e2message(c, m)
106
- # c: exception
107
- # m: message_form
108
- # define exception c with message m.
84
+ # c: exception
85
+ # m: message_form
86
+ # define exception c with message m.
109
87
  #
110
88
  def def_e2message(c, m)
111
89
  E2MM.def_e2message(self, c, m)
112
90
  end
113
91
 
114
92
  # def_exception(n, m, s)
115
- # n: exception_name
116
- # m: message_form
117
- # s: superclass(default: StandardError)
118
- # define exception named ``c'' with message m.
93
+ # n: exception_name
94
+ # m: message_form
95
+ # s: superclass(default: StandardError)
96
+ # define exception named ``c'' with message m.
119
97
  #
120
- def def_exception(n, m, s=StandardError)
98
+ def def_exception(n, m, s = StandardError)
121
99
  E2MM.def_exception(self, n, m, s)
122
100
  end
123
101
 
@@ -127,44 +105,48 @@ module Exception2MessageMapper
127
105
  # {[class, exp] => message, ...}
128
106
  @MessageMap = {}
129
107
 
130
- # E2MM.def_exception(k, e, m)
131
- # k: class to define exception under.
132
- # e: exception
133
- # m: message_form
134
- # define exception c with message m.
108
+ # E2MM.def_e2message(k, e, m)
109
+ # k: class to define exception under.
110
+ # e: exception
111
+ # m: message_form
112
+ # define exception c with message m.
135
113
  #
136
114
  def E2MM.def_e2message(k, c, m)
137
- E2MM.instance_eval { @MessageMap[[k, c]] = m }
115
+ E2MM.instance_eval{@MessageMap[[k, c]] = m}
138
116
  c
139
117
  end
140
118
 
141
119
  # E2MM.def_exception(k, n, m, s)
142
- # k: class to define exception under.
143
- # n: exception_name
144
- # m: message_form
145
- # s: superclass(default: StandardError)
146
- # define exception named ``c'' with message m.
120
+ # k: class to define exception under.
121
+ # n: exception_name
122
+ # m: message_form
123
+ # s: superclass(default: StandardError)
124
+ # define exception named ``c'' with message m.
147
125
  #
148
- def E2MM.def_exception(k, n, m, s=StandardError)
126
+ def E2MM.def_exception(k, n, m, s = StandardError)
127
+ n = n.id2name if n.kind_of?(Fixnum)
149
128
  e = Class.new(s)
150
- E2MM.instance_eval { @MessageMap[[k, e]] = m }
129
+ E2MM.instance_eval{@MessageMap[[k, e]] = m}
151
130
  k.const_set(n, e)
152
131
  end
153
132
 
154
133
  # Fail(klass, err, *rest)
155
- # klass: class to define exception under.
156
- # err: exception
157
- # rest: message arguments
134
+ # klass: class to define exception under.
135
+ # err: exception
136
+ # rest: message arguments
158
137
  #
159
- def E2MM.Raise(klass=E2MM, err=nil, *rest)
138
+ def E2MM.Raise(klass = E2MM, err = nil, *rest)
160
139
  if form = e2mm_message(klass, err)
161
- raise err, sprintf(form, *rest)
140
+ b = $@.nil? ? caller(1) : $@
141
+ #p $@
142
+ #p __FILE__
143
+ b.shift if b[0] =~ /^#{Regexp.quote(__FILE__)}:/
144
+ raise err, sprintf(form, *rest), b
162
145
  else
163
146
  E2MM.Fail E2MM, ErrNotRegisteredException, err.inspect
164
147
  end
165
148
  end
166
-
167
- class <<E2MM
149
+ class << E2MM
168
150
  alias Fail Raise
169
151
  end
170
152
 
@@ -178,13 +160,12 @@ module Exception2MessageMapper
178
160
  end
179
161
  nil
180
162
  end
181
-
182
- class <<self
163
+ class << self
183
164
  alias message e2mm_message
184
165
  end
185
166
 
186
- E2MM.def_exception(E2MM,
187
- :ErrNotRegisteredException,
167
+ E2MM.def_exception(E2MM,
168
+ :ErrNotRegisteredException,
188
169
  "not registerd exception(%s)")
189
170
  end
190
171
 
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Exception2MessageMapper
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.add_development_dependency "bundler", "~> 1.3"
20
20
  spec.add_development_dependency "rake", "~> 10.0"
21
21
  spec.add_development_dependency "mspec", "~> 1.5"
22
- spec.add_development_dependency "rubysl-prettyprint", "~> 1.0"
22
+ spec.add_development_dependency "rubysl-prettyprint", "~> 2.0"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-e2mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-16 00:00:00.000000000 Z
11
+ date: 2013-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '2.0'
69
69
  description: Ruby standard library e2mmap.
70
70
  email:
71
71
  - brixen@gmail.com
@@ -74,7 +74,6 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
- - .travis.yml
78
77
  - Gemfile
79
78
  - LICENSE
80
79
  - README.md
@@ -104,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
103
  version: '0'
105
104
  requirements: []
106
105
  rubyforge_project:
107
- rubygems_version: 2.0.3
106
+ rubygems_version: 2.0.7
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: Ruby standard library e2mmap.
@@ -1,8 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem update --system
4
- - gem --version
5
- - gem install rubysl-bundler
6
- script: bundle exec mspec spec
7
- rvm:
8
- - rbx-nightly-18mode