tagful 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tagful.rb +15 -25
  3. data/lib/tagful/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5b681c48a71c6e5cc302881cb7f8b837142d26b
4
- data.tar.gz: cae00f8965dbf63edb5a5d2490e3a01b27e302c2
3
+ metadata.gz: 5883fe7c03181fd6e9d52dfdbe953c20fd4c173b
4
+ data.tar.gz: bbcbcf4ccd3b0e91dc39b67f1e2a51aab4871532
5
5
  SHA512:
6
- metadata.gz: 20687a579bb972a1a8390b965c5b5dd2e9770d5a1448c654e8a55e30cc48d7b07f38244262601a51043a953aa73286f9005c79d67ccb14eb9901278c17f9aa84
7
- data.tar.gz: a94463b8039c9dd4950e0aef6bfb24199d0ec607bef6d6bcde5474942de1dab92eae4904e38308ebe2e377b138a62450fa9cff6f835d834d61e663282f87a1f4
6
+ metadata.gz: b84a691bb79d3e067b6b1d23c6340a7b13d85fbe4709c54571ec6a556f2fb890fe5e010aa7f9d65cd85a528b4e67a905f6d0901ec9c55bc429a46e547050ecf4
7
+ data.tar.gz: 9f4fce6ed1c38ec07d3db335eca5730436c53d2554e3a34f2c4d587babcab0efee4eb8c6b34004cdc4e42bf653b712282c5399183f6707041691ecf97d6bbde8
data/lib/tagful.rb CHANGED
@@ -42,10 +42,18 @@ module Tagful
42
42
  end
43
43
  end
44
44
 
45
- if error_class
46
- m = class_eval('module TagfulMethods; end; TagfulMethods')
45
+ if error_class.nil? && error_module == DEFAULT_ERROR_MODULE_NAME
46
+ error_module = class_eval(<<-CODE)
47
+ unless defined?(#{error_module})
48
+ module #{error_module}; end
49
+ end
50
+ #{error_module}
51
+ CODE
52
+ end
47
53
 
48
- m.module_eval do
54
+ tagful_methods_module = class_eval('module TagfulMethods; self; end')
55
+ tagful_methods_module.module_eval do
56
+ if error_class
49
57
  define_method(method_id) do |*args, &block|
50
58
  begin
51
59
  super(*args, &block)
@@ -53,24 +61,7 @@ module Tagful
53
61
  raise error_class, e.message
54
62
  end
55
63
  end
56
- send visibility, method_id
57
- end
58
-
59
- class_eval do
60
- prepend(m)
61
- end
62
- else
63
- if error_module == DEFAULT_ERROR_MODULE_NAME
64
- error_module = class_eval(<<-CODE)
65
- unless defined?(#{error_module})
66
- module #{error_module}; end
67
- end
68
- #{error_module}
69
- CODE
70
- end
71
-
72
- m = class_eval('module TagfulMethods; end; TagfulMethods')
73
- m.module_eval do
64
+ else
74
65
  define_method(method_id) do |*args, &block|
75
66
  begin
76
67
  super(*args, &block)
@@ -78,12 +69,11 @@ module Tagful
78
69
  e.extend(error_module) and raise
79
70
  end
80
71
  end
81
- send visibility, method_id
82
- end
83
- class_eval do
84
- prepend(m)
85
72
  end
73
+ send visibility, method_id
86
74
  end
75
+ class_eval { prepend(tagful_methods_module) }
76
+
87
77
  method_id
88
78
  end
89
79
  end
@@ -1,3 +1,3 @@
1
1
  module Tagful
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagful
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiei Higa