Sha256: 1e6d1c9c66de05c12c7aa501e2a1fd8368861b193d3585a0823b351298844e2f

Contents?: true

Size: 624 Bytes

Versions: 10

Compression:

Stored size: 624 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 package_context(package_name)
    @data[package_name]
  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

10 entries across 10 versions & 1 rubygems

Version Path
smart_ioc-0.5.2 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.5.1 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.5.0 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.9 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.4.0 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.8 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.7 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.6 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.5 lib/smart_ioc/extra_package_contexts.rb
smart_ioc-0.3.2 lib/smart_ioc/extra_package_contexts.rb