Sha256: c5fa860d8f29f5e57c849fc07967e2c78cbb8ecce4dcdac72723beff34f042b2

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Feature
    module Plugins
      module CanHaveEntries
        module Commands
          class DefineEntries < Support::Command
            ##
            # @!attribute [r] feature_class
            #   @return [Class]
            #
            attr_reader :feature_class

            ##
            # @!attribute [r] names
            #   @return [Array<String, Symbol>]
            #
            attr_reader :names

            ##
            # @!attribute [r] body
            #   @return [Proc, nil]
            #
            attr_reader :body

            ##
            # @param feature_class [Class]
            # @param names [Array<String, Symbol>]
            # @param body [Proc, nil]
            #
            def initialize(feature_class:, names:, body:)
              @feature_class = feature_class
              @names = names
              @body = body
            end

            ##
            # @return [Array<String, Symbol>]
            #
            def call
              names.map { |name| Commands::DefineEntry.call(feature_class: feature_class, name: name, body: body) }
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb
convenient_service-0.19.0 lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb
convenient_service-0.18.0 lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb
convenient_service-0.17.0 lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb