Sha256: 45c61060b97fc2989baad28725fe99fe2feb3adf629adf853871336652474715
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
require 'hanami' require 'hanami/environment' require 'hanami/components' require 'concurrent' module Hanami module Commands # Abstract command # # @since 0.9.0 class Command def self.inherited(component) super component.class_eval do @_requirements = Concurrent::Array.new extend ClassMethods end end # Class level interface # # @since 0.9.0 module ClassMethods def register_as(name) Hanami::Components.register(name, self) end def requires(*names) requirements.concat(names) end def requirements @_requirements end end # @param options [Hash] Environment's options # # @since 0.9.0 def initialize(options) @environment = Hanami::Environment.new(options) @environment.require_project_environment @configuration = Hanami.configuration requirements.resolved('environment', environment) requirements.resolve(self.class.requirements) end private # @since 0.9.0 attr_reader :environment # @since 0.9.0 attr_reader :configuration # @since 0.9.0 def requirements Hanami::Components end end end end
Version data entries
5 entries across 5 versions & 1 rubygems