otoroshi 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/otoroshi/initializer.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc27b22c72bffa23a8dc1d4438ec57c246ac7277c4f505c5e4f812b938cda424
|
4
|
+
data.tar.gz: fc408beba9ffae09f881407b2ec36abe200d41cd02505a2ca731773b1ed7c56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1183f56272d15fdf58ba062a6f153b8e2679adffc4da06c3a75bafaab0ae5be1f155cd85df8dfc015b83df6476538013015eeea4a55f791616c486f7a86142
|
7
|
+
data.tar.gz: 94eb25ded2a7fced1518ce173a6633c5863188b456b883458b2ec9dafe97b0e456dad15c3c5cebbb72d341af3eadc887863867410dfbe847fdfc52587c4bcff8
|
data/lib/otoroshi/initializer.rb
CHANGED
@@ -80,11 +80,11 @@ module Otoroshi
|
|
80
80
|
# ""
|
81
81
|
def default_parameter_for(options)
|
82
82
|
default, allow_nil = options.values_at(:default, :allow_nil)
|
83
|
-
if default.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
return " #{default.call}" if default.is_a? Proc
|
84
|
+
return ' nil' if default.nil? && allow_nil
|
85
|
+
return '' if default.nil? && !allow_nil
|
86
|
+
|
87
|
+
" #{prefix(default)}#{default}#{suffix(default)}"
|
88
88
|
end
|
89
89
|
|
90
90
|
# Generates the characters to put before the value
|
@@ -94,6 +94,7 @@ module Otoroshi
|
|
94
94
|
case default
|
95
95
|
when Symbol then ':'
|
96
96
|
when String then '"'
|
97
|
+
when Time, Date, DateTime then '"'
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
@@ -102,6 +103,7 @@ module Otoroshi
|
|
102
103
|
def suffix(default)
|
103
104
|
case default
|
104
105
|
when String then '"'
|
106
|
+
when Time, Date, DateTime then '"'
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|