Trinkets
It's the bootleg facets.
Installation
RubyGems
gem install trinkets
Bundler
gem 'trinkets', require: falseUsage
The trinkets are loaded with the following structure:
require 'trinkets/{how-to-patch}/{class}/{method}'There are 3 ways to load trinkets, which are represented by the {how-to-patch} portion in the requires:
-
refine: As refinements; -
extend/include: As explicitextendorinclude; -
patch: As implicitincludeorextend, a.k.a. monkey-patching.
Refinement
require 'trinkets/class/init'
using ::Trinkets::Class::InitThe refine subdirectory is the default, and it can be omitted from require. The above is the same as:
require 'trinkets/refine/class/init'Extend / Include
require 'trinkets/extend/class/init'
class Test
extend ::Trinkets::Class::Init
endrequire 'trinkets/include/enumerable/each_with_hash'
class Test
include Enumerable
include ::Trinkets::Enumerable::WithHash
endMokey Patching
require 'trinkets/patch/class/init'Available modules
| Trinket |
|---|
| class/init |
| enumerable/each_with_hash |
Versioning
Versions follow semantic versioning: major.minor.patch
-
major: breaking changes. -
minor: improvements and new features that are backwards compatible. -
patch: backwards compatible fixes to existing features, or documentation improvements.
Contributing
Steps to include when developing the feature/fix:
- Add or change the appropriate RSpec tests.
- Document the feature.
- Might not apply to fixes if the feature didn't change.
- Bump the version.
- Update the Changelog.
License
The gem is available as open source under the terms of the MIT License.