Sha256: e90943da27015e62383d1d3cad408bbd393e225468328e17a35351e9d3c0e7e8

Contents?: true

Size: 500 Bytes

Versions: 18

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

module Tramway
  module Collections
    module Helper
      def collection_list_by(name:)
        require name # needed to load class name with collection
        unless ::Tramway::Collection.descendants.map(&:to_s).include?(name.camelize)
          raise "There no such collection named #{name.camelize}. Please create class with self method `list` and extended of `Tramway::Collection`"
        end

        name.camelize.constantize.list
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tramway-core-1.14.5.3 lib/tramway/collections/helper.rb
tramway-core-1.14.5.2 lib/tramway/collections/helper.rb
tramway-core-1.14.5.1 lib/tramway/collections/helper.rb
tramway-core-1.14.5 lib/tramway/collections/helper.rb
tramway-core-1.14.4 lib/tramway/collections/helper.rb
tramway-core-1.14.3.2 lib/tramway/collections/helper.rb
tramway-core-1.14.3.1 lib/tramway/collections/helper.rb
tramway-core-1.14.3 lib/tramway/collections/helper.rb
tramway-core-1.14.2.4 lib/tramway/collections/helper.rb
tramway-core-1.14.2.3 lib/tramway/collections/helper.rb
tramway-core-1.14.2.2 lib/tramway/collections/helper.rb
tramway-core-1.14.2.1 lib/tramway/collections/helper.rb
tramway-core-1.14.2 lib/tramway/collections/helper.rb
tramway-core-1.14.1.2 lib/tramway/collections/helper.rb
tramway-core-1.14.1.1 lib/tramway/collections/helper.rb
tramway-core-1.14.1 lib/tramway/collections/helper.rb
tramway-core-1.14.0.1 lib/tramway/collections/helper.rb
tramway-core-1.14 lib/tramway/collections/helper.rb