hexx 5.1.0 → 5.2.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: 7a0f508972f47609f09b6b7b303ee55c0268256e
4
- data.tar.gz: a3c0760ee8824891234b4b6b0c48d29c47c4eecd
3
+ metadata.gz: d8f682ab2559e5df4745c3b31da39343558726c2
4
+ data.tar.gz: 761e5de6edc7ac19029e67cbb0f7693baf4adea4
5
5
  SHA512:
6
- metadata.gz: fc2de5bffc7cfc7fd0cdfc75b6a3fad2b2f657cfa80e28e1b90980af0d746d244a546a86ef125164001518fd89f30adb1f3023b3dc7cff09a2d0761ab484bf00
7
- data.tar.gz: 81442ee8209ef2b7e4c3ac9e5b37f5ff8f94e3a63dbe6dd193dea1d0b9623b2e6f7c90e812a696630cea08f634989a9d154f2c7f822c705cb57be6d572422c08
6
+ metadata.gz: 1f6765140b1e83e75943def81b095b1f48fea48887d7ef6297e34f156051f2d3bf88d783fcef7f578eddd2092fa8f80d426e29b1060d727ab0cae5e6900f0293
7
+ data.tar.gz: 7e7039f4ba789a130a838ed32904420115e567d6d6d29cda539a971906c25c8c1efcba2343904b5513ae0fda73a7a4d6ef80382ae6fae3a43d72b9f9274e156c
@@ -74,9 +74,21 @@ module Hexx
74
74
  # # => "String"
75
75
  # MyGem.some_class # => String
76
76
  #
77
- # @param [String, Symbol] name The name for dependency.
77
+ # @example Dependencies can be set as a plain list of names
78
+ # module MyGem
79
+ # extend Hexx::Dependencies
80
+ # self.depends_on :some_class, "another_class"
81
+ # end
82
+ #
83
+ # @example Dependencies can be set as an array of names
84
+ # module MyGem
85
+ # extend Hexx::Dependencies
86
+ # self.depends_on %w(some_class another_class)
87
+ # end
88
+ #
89
+ # @param [Array<String, Symbol>] names The list of names for dependencies.
78
90
  def depends_on(*names)
79
- names.each do |name|
91
+ names.flatten.each do |name|
80
92
  DependencyName.new(name).validate
81
93
  add_dependency_setter name
82
94
  add_dependency_getter name
@@ -91,6 +103,8 @@ module Hexx
91
103
 
92
104
  # @api hide
93
105
  # Runs validations and fails in case of any error.
106
+ # @raise [TypeError] if the name has a wrong type.
107
+ # @raise [ArgumentError] if the name is blank.
94
108
  def validate
95
109
  check_type
96
110
  check_value
@@ -115,6 +129,8 @@ module Hexx
115
129
 
116
130
  # @api hide
117
131
  # Runs validations and fails in case of any error.
132
+ # @raise [TypeError] if the value has a wrong type.
133
+ # @raise [ArgumentError] if the value name is blank.
118
134
  def validate
119
135
  check_type
120
136
  check_value
data/lib/hexx/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  module Hexx
3
3
 
4
4
  # Current release.
5
- VERSION = "5.1.0"
5
+ VERSION = "5.2.0"
6
6
  end
@@ -27,14 +27,19 @@ module Hexx
27
27
  expect(described_module).to respond_to :depends_on
28
28
  end
29
29
 
30
- it "allows symbolic attributes" do
30
+ it "accepts symbolic attributes" do
31
31
  expect { described_module.depends_on :item }.not_to raise_error
32
32
  end
33
33
 
34
- it "allows string attributes" do
34
+ it "accepts string attributes" do
35
35
  expect { described_module.depends_on "item" }.not_to raise_error
36
36
  end
37
37
 
38
+ it "accepts arrays" do
39
+ expect { described_module.depends_on "item", [:item] }
40
+ .not_to raise_error
41
+ end
42
+
38
43
  it "fails when wrong object given" do
39
44
  expect { described_module.depends_on 1 }.to raise_error TypeError
40
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexx
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin