Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Create a new class which inherits from a class it will replace.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 subclass_and_replace.gemspec
README.md

Subclass and Replace

Create a new class which inherits from a class it will replace.

Description

Use this class when you need to replace a class method and still call the superclass method.

Documentation

Install

gem install subclass_and_replace

Example

Set defaults to Rails cookies without writing custom methods or changing core code.

subclass_and_replace ActionDispatch::Cookies::CookieJar do

  def handle_options(options)
    options[:httponly] = true if options[:httponly].nil?
  end

end
Something went wrong with that request. Please try again.