From fdd891facb29b14233bcb938cf8c7fd7bc282867 Mon Sep 17 00:00:00 2001 From: Adam Hardiman Date: Fri, 14 Jul 2017 14:07:07 +1000 Subject: [PATCH] Use Integer instead of Fixnum --- lib/active_enum/acts_as_enum.rb | 2 +- lib/active_enum/base.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/active_enum/acts_as_enum.rb b/lib/active_enum/acts_as_enum.rb index f88fdc5..d6bec9b 100644 --- a/lib/active_enum/acts_as_enum.rb +++ b/lib/active_enum/acts_as_enum.rb @@ -29,7 +29,7 @@ def to_select end def [](index) - if index.is_a?(Fixnum) + if index.is_a?(Integer) v = lookup_by_id(index) v.send(active_enum_options[:name_column]) unless v.blank? else diff --git a/lib/active_enum/base.rb b/lib/active_enum/base.rb index 7af39d4..97092be 100644 --- a/lib/active_enum/base.rb +++ b/lib/active_enum/base.rb @@ -55,7 +55,7 @@ def to_select # Access id or name value. Pass an id number to retrieve the name or # a symbol or string to retrieve the matching id. def get(index) - if index.is_a?(Fixnum) || index.is_a?(Symbol) + if index.is_a?(Integer) || index.is_a?(Symbol) row = store.get_by_id(index) value = row[1] if row end @@ -75,7 +75,7 @@ def include?(value) # Access any meta data defined for a given id or name. Returns a hash. def meta(index) - if index.is_a?(Fixnum) || index.is_a?(Symbol) + if index.is_a?(Integer) || index.is_a?(Symbol) row = store.get_by_id(index) value = row[2] if row end @@ -96,7 +96,7 @@ def id_and_name_and_meta(hash) name = hash.delete(:name) meta = hash return id, name, (meta.empty? ? nil : meta) - elsif hash.keys.first.is_a?(Fixnum) + elsif hash.keys.first.is_a?(Integer) return *Array(hash).first else raise ActiveEnum::InvalidValue, "The value supplied, #{hash}, is not a valid format."