MonumentalStylishOlingo

module BlackMagic
  def self.included(klass)
    klass.extend(MethodAccessorMacros)
  end
  
  module MethodAccessorMacros
    def method_accessor(method_name)
      self.class.instance_eval do
        Array(method_name).each do
          define_method("#{method_name}_fn".intern) do
            method(method_name.intern)
          end
        end
      end
    end
  end
end

module Foo
  include BlackMagic

  method_accessor :bar

  def self.bar(x)
    if x == "lorem"
      "bar"
    else
      "baz"
    end
  end
end

xs = ["lorem", "ipsum", "dolor"]

xs.map(&Foo::bar_fn)