Giter VIP home page Giter VIP logo

Comments (3)

schneems avatar schneems commented on May 31, 2024

To not break customer apps, I would wrap up your old hashie based interface in some kind of a deprecation pattern and release a point release with the deprecations before simply changing the interface.

Something like this:

class NewConfig
  def initialize(old_config)
    @old_config = old_config
  end

  # Put config interface here

  def method_missing(name, *args, &block)
    if @old_config.respond_to?(name)
      puts "Calling `#{name}` on #{self} is deprecated and will be removed in <version>, please see <URL> for alternatives."
      puts "`#{name}` called #{caller_locations.first}"
      @old_config.send(name, *args, &block)
    else
      super
    end
  end
end

You can initialize it like this:

old_config = Hashie::Mash.new
config     = NewConfig.new(old_config)
config["foo"]
Calling `[]` on #<NewConfig:0x007fcb9d1b2180> is deprecated and will be removed in <version>, please see <URL> for alternatives.
`[]` called (irb):72:in `irb_binding'

Now if your new config is missing an interface the gem will complain loudly. I would point the URL to an issue in your own project and have it say something like this:

We're moving away from a hashie based config. If you're at this page this is the new interface for config:

  # Put config interface docs here

If you can't find a valid method that does what you need to do, please open an issue on the tracker with the code you are trying to use and what you need to do.

from harvested.

zmoazeni avatar zmoazeni commented on May 31, 2024

Thanks @schneems. That's a good idea.

harvested is a pretty small gem, and I don't think this will be as big of an impact as compared to something like https://rubygems.org/gems/twitter. I think it'd be a good idea to release your idea with v3.2.0 just to help inform folks still on that major version line. At the same time we can release v4.0 which actually removes Hashie.

harvested isn't using Mash for configuration. We're returning all entities from the API as a Mash. But your point still stands.

from harvested.

zmoazeni avatar zmoazeni commented on May 31, 2024

No sense in keeping this issue alive for 3 more years. Closing.

from harvested.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.