Sha256: ec827ded7c7ea64c824c2ad8be5fd3d2c18d5ebf2a75cf686c712cc99257c7c1

Contents?: true

Size: 505 Bytes

Versions: 4

Compression:

Stored size: 505 Bytes

Contents

require "tramway/collection"

module Tramway
  module Event
    module ApplicationHelper
      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

4 entries across 4 versions & 1 rubygems

Version Path
tramway-event-1.0.1 app/helpers/tramway/event/application_helper.rb
tramway-event-1.0 app/helpers/tramway/event/application_helper.rb
tramway-event-0.7 app/helpers/tramway/event/application_helper.rb
tramway-event-0.6 app/helpers/tramway/event/application_helper.rb