schemable 0.1.3 → 0.1.4

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: 61661d657d9eb811ae32e778d400c824664209bf63f0602e9425c0749af794d7
4
- data.tar.gz: b19b40efeb1550826ec20d6dad94d3abdd8eca92ed211837198f91a8eb3be37f
3
+ metadata.gz: f34e140b93c601b0fa6d0baa7bb43d8e77e4276c7419077abad2fce6cbeae820
4
+ data.tar.gz: b9755ec8abe9cfd3c432945831009410bc256acc82d4ea1efb0a87b72c98e538
5
5
  SHA512:
6
- metadata.gz: f8dff9116105d5e6bf59a22d08f76c631eabc0fd04964d59ac9d54d3f9e8d2fd538e50720e38f48172817b895798c037a148d8bcfa1536e1fa052035537b9c4f
7
- data.tar.gz: bbe13dd62692efe72f6311f30fd4a00e4314b4aa557227d7b1bcb40e5f9643c35285d810292069bbf4a2317cff25f88158584e10141e604f3be8822fe6dcb75a
6
+ metadata.gz: f05de6d4ead3c1ab197b9160e1b97ef0330af0055af54663e02e7e64fe6d91d8b61da67addf75a394e1e1794577618411e5ecd36e0b34ddd9415e3d260d2a731
7
+ data.tar.gz: 806b59dd5e21d936ca3000445325416caabda85b6788fc8f2cb2a60dfa333037ab75dba40880755bcf6c5632aa95bcb109d26550cea95ca00706820486917a0f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schemable (0.1.3)
4
+ schemable (0.1.4)
5
5
  factory_bot_rails (~> 6.2.0)
6
6
  jsonapi-rails (~> 0.4.1)
7
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schemable
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
data/lib/schemable.rb CHANGED
@@ -19,8 +19,8 @@ module Schemable
19
19
  text: { type: :string },
20
20
  string: { type: :string },
21
21
  integer: { type: :integer },
22
- float: { type: :number, format: :float },
23
- decimal: { type: :number, format: :double },
22
+ float: { type: (configs[:float_as_string] ? :string : :number).to_s.to_sym, format: :float },
23
+ decimal: { type: (configs[:decimal_as_string] ? :string : :number).to_s.to_sym, format: :double },
24
24
  datetime: { type: :string, format: :'date-time' },
25
25
  date: { type: :string, format: :date },
26
26
  time: { type: :string, format: :time },
@@ -932,5 +932,15 @@ module Schemable
932
932
  def camelize_keys(hash)
933
933
  hash.deep_transform_keys { |key| key.to_s.camelize(:lower).to_sym }
934
934
  end
935
+
936
+ # Returns a json of config options for the definition class.
937
+ #
938
+ # @return [Hash] The config options for the definition class.
939
+ #
940
+ # @example
941
+ # { decimal_as_string: true }
942
+ def configs
943
+ {}
944
+ end
935
945
  end
936
946
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muhammad Nawzad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-29 00:00:00.000000000 Z
11
+ date: 2023-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot_rails