rails_metadata 0.0.4 → 0.0.5

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: 1d70c4718bb870c6bd0de9799148db4d1792afc0
4
- data.tar.gz: dfb7b2903774eb0c64e12c6331a51dc0099f2f81
3
+ metadata.gz: 0e901aa7424ebd6f4eb6d6f5854d0e9f9009422e
4
+ data.tar.gz: 6004562b7a90e7e2ee1de650a27168cd0ec6c8d5
5
5
  SHA512:
6
- metadata.gz: ca7741953af6e127e6925831a5136b205cd6ccf093cc4a77d534bcd6112f62bdc30f1d2c27ed11c61c0d2644b583fa364ac558d5631dbf54e75a7a1647f1defd
7
- data.tar.gz: fcd9ba1a7ee8e0a0656757b6d60485bc147d3b9eaac52ae6e70f5e0d5794a3083060343e0f8fe9f3a5d3143b1485efe76f888dbad03fadb7bf6f51648a57d7b1
6
+ metadata.gz: e8aa0825cba531037b228ad0fd77e8402c17245247daa44e8b859a178d976288b63adce02b590280aa491979d6e46c40fec321826091b4778c3b1138d4d142ad
7
+ data.tar.gz: 93560759cf5d786b65528adf6fef4e39382797c5d18cd615a106112adec344345a18295b250c2df8f198ba8ef9587abf63bbdaa164021676ffdea627b554f7fe
@@ -13,7 +13,20 @@ module RailsMetadata
13
13
  end
14
14
  typecast = case type
15
15
  when nil then val
16
- when :boolean then lambda { |v| v.is_a?(String) ? !v.empty? : !!v }
16
+ when :boolean
17
+ lambda do |v|
18
+ if v.is_a(String)
19
+ if ["true", "1"].include?(v)
20
+ return true
21
+ elsif ["false", "0"].include?(v)
22
+ return false
23
+ else
24
+ return !v.empty?
25
+ end
26
+ else
27
+ return !!v
28
+ end
29
+ end
17
30
  when :string then lambda { |v| v.to_s }
18
31
  when :integer then lambda { |v| v.to_i }
19
32
  when :float then lambda { |v| v.to_f }
@@ -1,3 +1,3 @@
1
1
  module RailsMetadata
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Neyer