Sha256: 47487b80b1db4f29a87b9aa81f4144616bcb4749c20f6ee99f1ad46b8af90c43

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module Nyanko
  module UnitProxyProvider
    NoUnitError = Class.new(StandardError)

    extend ActiveSupport::Concern

    included do
      extend UnitProxyProvider
      include Helper
    end

    def unit(name = nil)
      name ||= Function.current_unit.try(:to_key)
      if name && unit = Loader.load(name)
        UnitProxy.new(unit, self)
      else
        raise NoUnitError
      end
    end
    alias_method :ext, :unit
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nyanko-0.0.3 lib/nyanko/unit_proxy_provider.rb