formalism 0.2.1 → 0.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88548d0ecdb223bf0758367421978917b3e79e4416d9444fe6fd9543c9ee0cfb
|
4
|
+
data.tar.gz: 1683f2947e7c6c7c0a02c4c8cb88056b00fa727dfe7ed19f47ded701559b13ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fb481b7388afe09e10ee71f3df12564a9600855f90c8a202ead6ba83f007fe475ffde3edf8e14a8f6202ba6b98175b34842bdc0b98b2130cd0b2712081e413a
|
7
|
+
data.tar.gz: ef87193279b77951488443e089b4375f85f0004e39cfe2ae5efd8692bf84772acf3035ae2ea1fab510f9bb6acfbf183b5bbd5ad55e1ba6c979d5bbbcf9b76070
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'float'
|
4
|
+
|
5
|
+
module Formalism
|
6
|
+
class Form < Action
|
7
|
+
class Coercion
|
8
|
+
## Class for coercion to BigDecimal
|
9
|
+
class BigDecimal < Float
|
10
|
+
private
|
11
|
+
|
12
|
+
def send_conversion_method
|
13
|
+
BigDecimal(@value)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -6,7 +6,8 @@ module Formalism
|
|
6
6
|
## Class for coercion to Float
|
7
7
|
class Float < Numeric
|
8
8
|
## https://stackoverflow.com/a/36946626/2630849
|
9
|
-
|
9
|
+
## and improvements for `BigDecimal` (e-notation)
|
10
|
+
VALUE_REGEXP = wrap_value_regexp '[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?'
|
10
11
|
|
11
12
|
CONVERSION_METHOD = :to_f
|
12
13
|
end
|
data/lib/formalism/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formalism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gorilla_patch
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- lib/formalism/form/coercion/_base.rb
|
197
197
|
- lib/formalism/form/coercion/_numeric.rb
|
198
198
|
- lib/formalism/form/coercion/array.rb
|
199
|
+
- lib/formalism/form/coercion/bigdecimal.rb
|
199
200
|
- lib/formalism/form/coercion/boolean.rb
|
200
201
|
- lib/formalism/form/coercion/date.rb
|
201
202
|
- lib/formalism/form/coercion/float.rb
|