Handle gem versions compatibility

Hi,

I am building a gem and I am not sure how to handle dependencies
versions.
The gem I need is ActiveSupport and I want my gem to be compatible with
version 2.3.x and 3.x.x

In my code I need the classify method from the inflector module. But
they don’t work the same way in version 2.3.x ans in version 3.x

This code works when I am using the version 2.3.x but fails with version
3.x.x

board = :ruby_forum
klass = board.respond_to?(:classify) ? board.classify :
ActiveSupport::Inflector::classify(board)

NoMethodError: undefined method `classify’ for ActiveSupport::Inflector:Module

This line doesn’t work in version 3 because it evaluates the last
condition, and the classify method doesn’t exist in version 3.

What trick could I use?
Greg

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs