Sha256: 4d066f5d7e6afad2de6652c69b3d0574e37db4b114f9ce3c91efa56ce427749b

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

# Place the Sing module inside of a namespace
module Nicefn
  # Add one-liner singleton method/fn declaration capabilities for a module
  module Sing
    extend self
    define_method(:included) do |klass|
      klass.extend klass

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nicefn-0.1.1 lib/sing.rb