subroutine 0.3.1 → 0.3.2

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: aa94532ef601e196c3dd4f4592a1bdcc18a4fd90
4
- data.tar.gz: b8da58c3642568051893934fd92e227508907eaf
3
+ metadata.gz: eaf64bc5b7da2f85485bd5e3f22c3e69106da013
4
+ data.tar.gz: 65575447d14913aba3e9d6565d168ff5bb0fb202
5
5
  SHA512:
6
- metadata.gz: 5ce7d236825bd9b5e861913b717cbfbe9d4cdb5da7964cc3fc9ed6691645548dde4a7a2d0f5727839e2f30b0d03ba5bbd3fc05500455c6e9025df2a4077adc93
7
- data.tar.gz: d31335231526c84b9e2bd118a21b88f51c005c1dab7d7a2afc586fb5211d8e8f0089aa2d733e2d55cda995a1ec0d404b43194549ce2597b22f4ed2f37d056a17
6
+ metadata.gz: 0d249ab00c1017ac02427e26b6a2bab807b015ed8ab4f5c0ddcb5125a005aa9335cae759b4ddfb5ba766704ee2b5859723ab779bbabfad6675002cc41956dfce
7
+ data.tar.gz: 67c4967e9136863e67bfc7d29c0a9358352f54594eff7ec1887d932bf533cc1b1cdeada1d488089fb10b244fa930d4ede7bab75ee95f28a4f162c42f934d95f4
data/lib/subroutine/op.rb CHANGED
@@ -251,7 +251,7 @@ module Subroutine
251
251
  defaults = {}.with_indifferent_access
252
252
 
253
253
  self._fields.each_pair do |field, config|
254
- if config[:default]
254
+ unless config[:default].nil?
255
255
  deflt = config[:default]
256
256
  deflt = deflt.call if deflt.respond_to?(:call)
257
257
  defaults[field] = type_caster.cast(deflt, config[:type])
@@ -2,7 +2,7 @@ module Subroutine
2
2
 
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 1
5
+ PATCH = 2
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -37,6 +37,7 @@ module Subroutine
37
37
  op = ::DefaultsOp.new
38
38
  assert_equal 'foo', op.foo
39
39
  assert_equal 'bar', op.bar
40
+ assert_equal false, op.baz
40
41
  end
41
42
 
42
43
  def test_inherited_defaults_override_correctly
data/test/support/ops.rb CHANGED
@@ -89,6 +89,7 @@ class DefaultsOp < ::Subroutine::Op
89
89
 
90
90
  field :foo, :default => 'foo'
91
91
  field :bar, :default => 'bar'
92
+ field :baz, :default => false
92
93
 
93
94
  end
94
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-27 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel