datory 1.0.0.rc18 → 1.0.0.rc19

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
  SHA256:
3
- metadata.gz: eb979251a3c5abfb4391233277520df3ae8d03d605cdae59166a80f1c8713b05
4
- data.tar.gz: c5fa307e7db176c5f794f1e00da679cbb03463fb4a2ae588a7ae2bdd3b1df418
3
+ metadata.gz: 3de83481e2e67d0aa3e0bc5eafaa1172f272cdbb27402d2201388839845b6a6c
4
+ data.tar.gz: db131a7480b6f328d021303c13f6fb6b5f42a5b975739d8b86424a9deab67ed6
5
5
  SHA512:
6
- metadata.gz: a5e6e7aedec61ea373c9e4df22fe2ded364bc02e9c37b0de0782fdde2e4a52d729b468dd7adfb6252c6b7ea886ffa0d8c3d1ecf37a80620fcff0289676ddc66c
7
- data.tar.gz: 7ba8a8b89b44463649617203976bf99000a12d9e9748acc2c1d45f27bf592e6860d1839b5311b5dcae5825c12d008564b9b9eaf5f9ce12f487ff530745c7ccb0
6
+ metadata.gz: 53d520aaf3d7e4069a9e4c6f670b6863f7f2b68cc9562a987f5e6d5c376a25056b4e6b4d961da030da429165b7e76afb5eda60eea7ed8a5ab9f1e73bd02ba856
7
+ data.tar.gz: 2f8427553e16cea1a634851c8717fe9f9f41089aa55d04af9bd62efe7f7a040e25b52fee26bbf29e662d3f8043cde4060a1fea0e46cddfbbdca56bf5b9fda412
@@ -47,34 +47,38 @@ module Datory
47
47
  ########################################################################
48
48
 
49
49
  def uuid(name, **options)
50
+ options = options.slice(:to)
50
51
  options = options.merge(format: :uuid)
51
52
  string(name, **options)
52
53
  end
53
54
 
54
55
  def money(name, **options)
55
- options_for_cents = options.merge(from: Integer)
56
- options_for_currency = options.merge(from: [Symbol, String])
56
+ options = options.slice(:to)
57
57
 
58
- attribute(:"#{name}_cents", **options_for_cents)
59
- attribute(:"#{name}_currency", **options_for_currency)
58
+ integer :"#{name}_cents", **options
59
+ string :"#{name}_currency", **options
60
60
  end
61
61
 
62
62
  def duration(name, **options)
63
+ options = options.slice(:to)
63
64
  options = options.merge(from: String, as: ActiveSupport::Duration, format: { from: :duration })
64
65
  string(name, **options)
65
66
  end
66
67
 
67
68
  def date(name, **options)
69
+ options = options.slice(:to)
68
70
  options = options.merge(from: String, as: Date, format: { from: :date })
69
71
  string(name, **options)
70
72
  end
71
73
 
72
74
  def time(name, **options)
75
+ options = options.slice(:to)
73
76
  options = options.merge(from: String, as: Time, format: { from: :time })
74
77
  string(name, **options)
75
78
  end
76
79
 
77
80
  def datetime(name, **options)
81
+ options = options.slice(:to)
78
82
  options = options.merge(from: String, as: DateTime, format: { from: :datetime })
79
83
  string(name, **options)
80
84
  end
@@ -96,6 +100,11 @@ module Datory
96
100
  attribute(name, **options)
97
101
  end
98
102
 
103
+ def boolean(name, **options)
104
+ options = options.merge(from: [TrueClass, FalseClass])
105
+ attribute(name, **options)
106
+ end
107
+
99
108
  ########################################################################
100
109
 
101
110
  def collection_of_attributes
@@ -5,7 +5,7 @@ module Datory
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc18"
8
+ PRE = "rc19"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc18
4
+ version: 1.0.0.rc19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-01 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport