haveapi 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/haveapi/params/param.rb +8 -5
- data/lib/haveapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c5949089f07c15226d74339f06a2dc0c1f09fb8
|
4
|
+
data.tar.gz: 8b6f6e19b9c3b21ec1ea7ce9aaa47fb0bbeb6589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7e6f414ffd0950b1c5a0acad38dc8821054dcb9bd82a28cba1b2cd30712d21476a36467b36be0223ea17d3a0336469d8685332fecc4a36ceb87057b917b79e6
|
7
|
+
data.tar.gz: c088d335f5588f90a1c9cb3ea5ce7f7799f14981d4a4d8eb1a46adf707c6c51fbc07689ce36b7c88c567f5a5cd8fb441789bd01a01990c2e28e6a1f8538cf428
|
data/CHANGELOG
CHANGED
data/lib/haveapi/params/param.rb
CHANGED
@@ -5,18 +5,21 @@ module HaveAPI::Parameters
|
|
5
5
|
attr_reader :name, :label, :desc, :type, :default
|
6
6
|
|
7
7
|
def initialize(name, args = {})
|
8
|
+
# The hash values are deleted and it shouldn't affect the received hash
|
9
|
+
myargs = args.clone
|
10
|
+
|
8
11
|
@name = name
|
9
|
-
@label =
|
12
|
+
@label = myargs.delete(:label) || name.to_s.capitalize
|
10
13
|
@layout = :custom
|
11
14
|
|
12
|
-
ATTRIBUTES.each do |attr|
|
13
|
-
instance_variable_set("@#{attr}",
|
15
|
+
(ATTRIBUTES - %i(label)).each do |attr|
|
16
|
+
instance_variable_set("@#{attr}", myargs.delete(attr))
|
14
17
|
end
|
15
18
|
|
16
19
|
@type ||= String
|
17
20
|
|
18
|
-
@validators = HaveAPI::ValidatorChain.new(
|
19
|
-
fail "unused arguments #{
|
21
|
+
@validators = HaveAPI::ValidatorChain.new(myargs) unless myargs.empty?
|
22
|
+
fail "unused arguments #{myargs}" unless myargs.empty?
|
20
23
|
end
|
21
24
|
|
22
25
|
def db_name
|
data/lib/haveapi/version.rb
CHANGED