otoroshi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/otoroshi/initializer.rb +7 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8928c55b726e2db1fb3bd19948c23be9c8fb0175650ae1f65cd0489bf7751c38
4
- data.tar.gz: db9cc8034319672be477f1352508e6258d9ce105d6eedca6501630776e196407
3
+ metadata.gz: dc27b22c72bffa23a8dc1d4438ec57c246ac7277c4f505c5e4f812b938cda424
4
+ data.tar.gz: fc408beba9ffae09f881407b2ec36abe200d41cd02505a2ca731773b1ed7c56c
5
5
  SHA512:
6
- metadata.gz: 44856f1f0d75272e70a49d07db5d7ce5218849ca9a0a04164c875d9277f18ce2afddc2cb254e8d9079232a23f384ec58c9ea0602ea6e170504ad1bd59e280895
7
- data.tar.gz: 7978129f51d5ef3b224efa547e0ede889ffd4010ca8f571dde79830190f21b7a69defd70f8f44059ef1daf8647310fd9583944e7bbbcca05753417b1fec9d72a
6
+ metadata.gz: 2d1183f56272d15fdf58ba062a6f153b8e2679adffc4da06c3a75bafaab0ae5be1f155cd85df8dfc015b83df6476538013015eeea4a55f791616c486f7a86142
7
+ data.tar.gz: 94eb25ded2a7fced1518ce173a6633c5863188b456b883458b2ec9dafe97b0e456dad15c3c5cebbb72d341af3eadc887863867410dfbe847fdfc52587c4bcff8
@@ -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.nil?
84
- allow_nil ? ' nil' : ''
85
- else
86
- " #{prefix(default)}#{default}#{suffix(default)}"
87
- end
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: otoroshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Piron