Skip to content

Commit

Permalink
fixes #18719 - replace usage of deprecated Fixnum constant
Browse files Browse the repository at this point in the history
Most type checks for Fixnum can safely be replaced by Integer, as prior
to Ruby 2.4, Fixnum was a subclass of Integer and so the conditional
holds.
  • Loading branch information
domcleal committed Mar 23, 2017
1 parent 637da2f commit 5353cf3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v2/external_usergroups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
def_param_group :external_usergroup do
param :external_usergroup, Hash, :required => true, :action_aware => true, :desc => N_('External user group information') do
param :name, String, :required => true, :desc => N_('External user group name')
param :auth_source_id, Fixnum, :required => true, :desc => N_('ID of linked authentication source')
param :auth_source_id, :number, :required => true, :desc => N_('ID of linked authentication source')
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v2/interfaces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def show
param :ip6, String, :desc => N_("IPv6 address of interface")
param :type, InterfaceTypeMapper::ALLOWED_TYPE_NAMES, :desc => N_("Interface type, e.g. bmc. Default is %{default_nic_type}")
param :name, String, :desc => N_("Interface's DNS name")
param :subnet_id, Fixnum, :desc => N_("Foreman subnet ID of IPv4 interface")
param :subnet6_id, Fixnum, :desc => N_("Foreman subnet ID of IPv6 interface")
param :domain_id, Fixnum, :desc => N_("Foreman domain ID of interface. Required for primary interfaces on managed hosts.")
param :subnet_id, :number, :desc => N_("Foreman subnet ID of IPv4 interface")
param :subnet6_id, :number, :desc => N_("Foreman subnet ID of IPv6 interface")
param :domain_id, :number, :desc => N_("Foreman domain ID of interface. Required for primary interfaces on managed hosts.")
param :identifier, String, :desc => N_("Device identifier, e.g. eth0 or eth1.1")
param :managed, :bool, :desc => N_("Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?")
param :primary, :bool, :desc => N_("Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface.")
Expand Down
2 changes: 1 addition & 1 deletion app/models/config_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.report_status_column
# it is not supported to edit status values after it has been written once.
def status=(st)
s = case st
when Integer, Fixnum
when Integer
st
when Hash
ConfigReportStatusCalculator.new(:counters => st).calculate
Expand Down
2 changes: 1 addition & 1 deletion app/services/authorizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ def resource_name(klass)
def base_ids
raise ArgumentError, 'you must set base_collection to get base_ids' if @base_collection.nil?

@base_ids ||= @base_collection.all? { |i| i.is_a?(Fixnum) } ? @base_collection : @base_collection.map(&:id)
@base_ids ||= @base_collection.all? { |i| i.is_a?(Integer) } ? @base_collection : @base_collection.map(&:id)
end
end
2 changes: 1 addition & 1 deletion lib/foreman/cast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.to_bool(value)
return false if value.blank? || value =~ (/\A(false|f|no|n|off|0)\z/i)
return nil

when Fixnum
when Integer
return true if value == 1
return false if value == 0

Expand Down

0 comments on commit 5353cf3

Please sign in to comment.