Sha256: a11d0fbda07e9dd7cc8f757f9be0176f61cbf2c0d0eca9e30ecf6df282fe35d1

Contents?: true

Size: 557 Bytes

Versions: 19

Compression:

Stored size: 557 Bytes

Contents

class SmartIoC::ExtraPackageContexts
  include SmartIoC::Args

  def initialize
    @data = {}
  end

  # @param package_name [Symbol]
  # @param context [Symbol]
  def set_context(package_name, context)
    check_arg(package_name, :package_name, Symbol)
    check_arg(context, :context, Symbol)

    @data[package_name] = context
  end

  def get_context(package_name)
    @data[package_name] || SmartIoC::Container::DEFAULT_CONTEXT
  end

  # @param package_name [Symbol]
  def clear_context(package_name)
    @data.delete(package_name)
    nil
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
smart_ioc-0.3.1 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.0 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.5 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.4 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.3 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.2 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.1 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.2.0 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.30 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.29 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.28 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.27 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.26 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.25 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.24 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.23 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.22 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.21 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.1.20 lib/smart_ioc/extra_package_contexts.rb