module CLI::Kit::Autocall

Public Instance Methods

autocall(const, &block) click to toggle source
# File lib/cli/kit/autocall.rb, line 6
def autocall(const, &block)
  @autocalls ||= {}
  @autocalls[const] = block
end
const_missing(const) click to toggle source
Calls superclass method
# File lib/cli/kit/autocall.rb, line 11
def const_missing(const)
  block = begin
    @autocalls.fetch(const)
  rescue KeyError
    return super
  end
  const_set(const, block.call)
end