File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,11 @@ class SettingsFormCoercible
42
42
attr_reader :settings , :default_settings
43
43
attr_accessor :coerced_settings
44
44
45
+ integer_klass = defined? ( Fixnum ) ? Fixnum : Integer
45
46
COERCIONS_MAP = {
46
47
String => Types ::Coercible ::String ,
47
48
Symbol => Types ::CustomCoercions ::Symbol ,
48
- ( 1 . class == Integer ? Integer : Fixnum ) => Types ::Params ::Integer ,
49
+ integer_klass => Types ::Params ::Integer ,
49
50
ActiveSupport ::HashWithIndifferentAccess => Types ::CustomCoercions ::Hash ,
50
51
ActiveSupport ::Duration => Types ::Params ::Integer ,
51
52
Float => Types ::Params ::Float ,
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ class SettingsSchema < Dry::Validation::Schema::Params
19
19
end
20
20
21
21
class SettingsFormValidator
22
+ integer_klass = defined? ( Fixnum ) ? Fixnum : Integer
22
23
VALIDATABLE_TYPES = {
23
- ( 1 . class == Integer ? Integer : Fixnum ) => :int? ,
24
+ integer_klass => :int? ,
24
25
Float => :float? ,
25
26
ActiveSupport ::Duration => :int? ,
26
27
ActiveSupport ::HashWithIndifferentAccess => :form_hash?
Original file line number Diff line number Diff line change @@ -11,10 +11,11 @@ module RailsSettingsUi
11
11
class UnknownDefaultValueType < StandardError ; end
12
12
13
13
class TypeConverter
14
+ integer_klass = defined? ( Fixnum ) ? Fixnum : Integer
14
15
VALUE_TYPES_MAP = {
15
16
String => RailsSettingsUi ::ValueTypes ::String ,
16
17
Symbol => RailsSettingsUi ::ValueTypes ::Symbol ,
17
- Fixnum => RailsSettingsUi ::ValueTypes ::Fixnum ,
18
+ integer_klass => RailsSettingsUi ::ValueTypes ::Fixnum ,
18
19
# ActiveSupport::HashWithIndifferentAccess => RailsSettingsUi::ValueTypes::Hash,
19
20
ActiveSupport ::Duration => RailsSettingsUi ::ValueTypes ::Float ,
20
21
Float => RailsSettingsUi ::ValueTypes ::Float ,
You can’t perform that action at this time.
0 commit comments