No release in over 3 years
Low commit activity in last 3 years
Redefines class methods
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

inheritance-helper

A Ruby library that provides utility methods for handling class-level inheritance in Ruby. This gem makes it easy to manage and extend class methods and their values across your inheritance chain.

Installation

Add this line to your application's Gemfile:

gem 'inheritance-helper'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install inheritance-helper

Usage

The inheritance-helper gem provides utilities for managing class-level attributes and methods across inheritance chains. It's particularly useful when you need to accumulate or modify class-level data through inheritance.

Basic Example

class Model
  extend InheritanceHelper::Methods

  def self.attributes
    {}.freeze
  end

  def self.attribute(name, type)
    add_value_to_class_method(:attributes, name => type)
    attr_accessor name
  end
end

class Person < Model
  attribute :name, :string
  attribute :phone, :string
end

Person.attributes
# => {:name=>:string, :phone=>:string}

Features

  • Safely extend and modify class methods through inheritance
  • Preserve class-level data integrity across the inheritance chain
  • Simple and intuitive API for managing class attributes
  • Thread-safe implementation

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Author

Doug Youch (dougyouch+github@gmail.com)