ruby-features 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/ruby-features.rb
CHANGED
@@ -40,7 +40,7 @@ module RubyFeatures
|
|
40
40
|
|
41
41
|
def define(feature_name, &feature_body)
|
42
42
|
feature_name = feature_name.to_s
|
43
|
-
raise NameError.new("Wrong feature name: #{
|
43
|
+
raise NameError.new("Wrong feature name: #{feature_name}") unless feature_name.match(/^[\/_a-z\d]+$/)
|
44
44
|
raise NameError.new("Such feature is already registered: #{feature_name}") if @features.has_key?(feature_name)
|
45
45
|
|
46
46
|
@features[feature_name] = Mixins.new(feature_name, feature_body)
|
@@ -20,12 +20,12 @@ module RubyFeatures
|
|
20
20
|
@_applied
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
@
|
23
|
+
def _set_feature_name(name)
|
24
|
+
@_feature_name = name
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@
|
27
|
+
def feature_name
|
28
|
+
@_feature_name
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
@@ -57,7 +57,7 @@ module RubyFeatures
|
|
57
57
|
apply_to_module.extend RubyFeatures::Concern::ApplyTo
|
58
58
|
apply_to_module._apply(target, @_apply_to_definitions.delete(target), @_conditions)
|
59
59
|
rescue NameError => e
|
60
|
-
raise ApplyError.new("[#{
|
60
|
+
raise ApplyError.new("[#{feature_name}] #{e.message}")
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
data/lib/ruby-features/mixins.rb
CHANGED
@@ -8,7 +8,7 @@ module RubyFeatures
|
|
8
8
|
RubyFeatures::Utils.camelize(feature_name)
|
9
9
|
).tap do |feature_module|
|
10
10
|
feature_module.extend RubyFeatures::Concern::Feature
|
11
|
-
feature_module.
|
11
|
+
feature_module._set_feature_name(feature_name)
|
12
12
|
feature_module.class_eval(&feature_body) if feature_body
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-features
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|