Ruby Gem for refine Ruby Core classes.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.cirrus.yml
.editorconfig
.gitignore
.rspec
.rubocop.yml
CHANGELOG.md
Gemfile
README.md
Rakefile
gorilla_patch.gemspec

README.md

Gorilla Patch

Ruby Gem for refine Ruby Core classes (like Monkey patch)

Gem Version Build Status codecov Depfu Code Climate

Installation

$ gem install gorilla_patch

or with bundler:

# Gemfile
gem 'gorilla_patch'

Usage

require 'gorilla_patch' # or 'gorilla_patch/keys' for specific functionallity

hash = { a: 1, b: 2 }

hash.keys? :a, :b # undefined method!

module Foo
  using GorillaPatch::Keys

  hash.keys? :a, :b # true
end

hash.keys? :a, :b # undefined method!

What is using?

It's standard feature.

Methods

  • Blank

    • String, NilClass

      • #blank?
    • Array, Hash

      • #reject_blank_strings

      • #reject_blank_strings!

      • #nilify_blank_strings

      • #nilify_blank_strings!

  • Compact

    • Hash

      • #compact

      • #compact!

  • Cover

    • Range

      • #cover?(value)
  • DeepDup

    • Object, Hash, Array, Delegator

      • #deep_dup
  • DeepMerge

    • Hash

      • #deep_merge(other_hash, &block)

      • #deep_merge!(other_hash, &block)

  • DigEmpty

    • Hash

      • #dig()
  • Except

    • Hash

      • #except(*)

      • #except!(*)

  • Inflections

    • .acronyms

    • .from_sequel

    • .from_inflecto

    • String, Module

      • #underscore
    • String

      • #camelize
  • Keys

    • Hash

      • #keys?(*)
  • Namespace

    • String, Module, Class

      • #demodulize

      • #deconstantize

  • Slice

    • Hash

      • #slice(*, nils: false)

      • #slice!(*, nils: false)

      • #slice_reverse!(*, nils: false)

  • Symbolize

    • Hash

      • #symbolize_keys(deep: false)

      • #symbolize_keys!(deep: false)

  • Transform

    • Hash

      • #transform_values

      • #transform_values!

  • Truncate

    • String

      • #truncate(position, separator: '', omission: '...')

Testing

$ rake spec