Sha256: e787dfc901430f7354d75eaf85539868f72ffc07e112d6ecc035f9f0288e3f86

Contents?: true

Size: 502 Bytes

Versions: 1

Compression:

Stored size: 502 Bytes

Contents

# Place the Inst module inside of a namespace
module Nicefn
  # Adds one-liner instance method/fn declaration capabilities for classes
  module Inst
    define_method(:cm) { |func, &blk| define_singleton_method(func, &blk) }

    define_method(:fn) { |func, &blk| define_method(func, &blk) }

    define_method(:fp) do |func, &blk|
      define_method(func, &blk)
      private func
    end

    define_method(:fs) do |func, &blk|
      define_method(func, &blk)
      protected func
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nicefn-0.1.1 lib/inst.rb