Sha256: 093e545e217e87c73e68e807afb508c4b55911da3db8d7654c61d9156b4f217d

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

module Pageflow
  # A collection of {EntryType} objects.
  #
  # @since 15.1
  class EntryTypes
    # @api private
    def initialize
      @entry_types_by_name = {}
    end

    # Register an entry type.
    #
    # @param entry_type [EntryType]
    def register(entry_type)
      @entry_types_by_name[entry_type.name] = entry_type
    end

    # @api private
    def find_by_name!(name)
      @entry_types_by_name.fetch(name) do
        raise "Unknown entry type with name #{name}."
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-15.1.0.beta2 lib/pageflow/entry_types.rb
pageflow-15.1.0.beta1 lib/pageflow/entry_types.rb