Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Fix deprecation warnings about Fixnum for Ruby >= 2.4 #13

Closed

Conversation

mbigras
Copy link

@mbigras mbigras commented Apr 27, 2018

This should resolve #12

Usage example

git clone https://github.com/mbigras/kashmir
cd kashmir/
git co a90f15d6c44564dde644e26ae848374b68a09273
bundle install
ruby --version
# ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
bundle exec ruby <<'EOF'
require 'kashmir'
class Person
  include Kashmir
  
  def initialize(name, age)
    @name = name
    @age = age
  end
  
  representations do
    rep :name
    rep :age
  end
end
p Person.new('Netto Farah', 26).represent([:name, :age])
EOF
# {:name=>"Netto Farah", :age=>26}

@@ -111,7 +111,13 @@ def read_value(instance, field)
end

def primitive?(field_value)
[Fixnum, String, Date, Time, TrueClass, FalseClass, Symbol].any? do |type|
primitives = [String, Date, Time, TrueClass, FalseClass, Symbol]
primitives << if RUBY_VERSION > '2.4'

Choose a reason for hiding this comment

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

did you mean >= '2.4'?

Copy link
Author

Choose a reason for hiding this comment

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

Yup, thank you @NightlyNexus

@mbigras mbigras closed this Aug 3, 2020
@mbigras mbigras deleted the mbigras-fix-fixnum-deprecation-warnings branch August 3, 2020 22:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Representation is using Fixnum which is deprecated in Ruby >= 2.4
2 participants