lib/inst.rb in nicefn-0.1.0 vs lib/inst.rb in nicefn-0.1.1

- old
+ new

@@ -1,5 +1,19 @@ -module Nicefn::Inst - define_method(:fn) {|func, &blk| define_method(func, &blk) } - define_method(:fp) {|func, &blk| define_method(func, &blk); private func } - define_method(:fs) {|func, &blk| define_method(func, &blk); protected func } +# 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