Skip to content

Commit

Permalink
Use Integer instead of Fixnum
Browse files Browse the repository at this point in the history
  • Loading branch information
Krushr committed Jul 14, 2017
1 parent d1d2f47 commit fdd891f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/active_enum/acts_as_enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/active_enum/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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."
Expand Down

1 comment on commit fdd891f

@adzap
Copy link
Owner

@adzap adzap commented on fdd891f Jul 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but this is already in master. I meant the Integer work. Sorry I didn't realise which PR I was commenting on. Ignore me.

Please sign in to comment.