afaur/ruby-nicefn

View on GitHub
pkg/example_project/test.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'nicefn'

# Example class with one-liner fn definitions
class Inst
  extend Nicefn::Inst
  cm(:cm_test) { puts 'hello via class method' }
  fn(:test) { puts 'hello from class instance' }
end

Inst.cm_test

i = Inst.new
i.test

# Example singleton class with one-liner fn definitions
module Sing
  include Nicefn::Sing
  fn(:test) { puts 'hello from singleton class' }
end

Sing.test