class SmartCore::Container::Host

@api private @since 0.8.1

Attributes

container[R]

@return [SmartCore::Container]

@api private @since 0.8.1

exists[R]

@return [Boolean]

@api private @since 0.8.1

exists?[R]

@return [Boolean]

@api private @since 0.8.1

path[R]

@return [String]

@api private @since 0.8.1

present?[R]

@return [Boolean]

@api private @since 0.8.1

Public Class Methods

build(container, path) click to toggle source

@param container [SmartCore::Container] @param path [String] @return [SmartCore::Container::Host]

@api private @since 0.8.1 rubocop:disable Metrics/AbcSize, Style/NilComparison

# File lib/smart_core/container/host.rb, line 16
    def build(container, path)
      if (container.nil? && !path.nil?) || (!container.nil? && path.nil?)
        raise(SmartCore::Container::ArgumentError, <<~ERROR_MESSAGE)
          Host container requires both host container instance and host container path
          (container: #{container.inspect} / path: #{path.inspect})
        ERROR_MESSAGE
      end

      if (!container.nil? && !path.nil?) &&
         (!container.is_a?(SmartCore::Container) || !path.is_a?(String))
        raise(SmartCore::Container::ArgumentError, <<~ERROR_MESSAGE)
          Host container should be a type of SmartCore::Container
          and host path should be a type of String.
        ERROR_MESSAGE
      end

      new(container, path)
    end
new(container, path) click to toggle source

@param container [SmartCore::Container] @param path [String] @return [void]

@api private @since 0.8.1

# File lib/smart_core/container/host.rb, line 63
def initialize(container, path)
  @container = container
  @path = path
  @exists = !!container
end

Public Instance Methods

notify_about_nested_changement(nested_entity_path) click to toggle source

@param nested_entity_path [String] @return [void]

@api private @since 0.8.1

# File lib/smart_core/container/host.rb, line 74
def notify_about_nested_changement(nested_entity_path)
  return unless exists?
  host_path = "#{path}" \
              "#{SmartCore::Container::DependencyResolver::PATH_PART_SEPARATOR}" \
              "#{nested_entity_path}"
  container.watcher.notify(host_path)
end