Skip to content

codercr/subclass_and_replace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages