Sha256: 13286480d3c3a3e2c11cda3d816e9828e4b9ed0a404b77189792c1352416e8af

Contents?: true

Size: 553 Bytes

Versions: 4

Compression:

Stored size: 553 Bytes

Contents

require "tramway/collection"

module Tramway
  module Event
    module ApplicationHelper
      include ::FontAwesome::Rails::IconHelper

      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.2.2 app/helpers/tramway/event/application_helper.rb
tramway-event-1.2.1 app/helpers/tramway/event/application_helper.rb
tramway-event-1.2 app/helpers/tramway/event/application_helper.rb
tramway-event-1.1 app/helpers/tramway/event/application_helper.rb