Sha256: 12ed0c7fa8681d2a44906cc2d31eb59f2dcb02c77dea0c8fffd2f76813789660

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

# frozen_string_literal: true

module Tramway
  module Configs
    # Tramway is entity based framework
    #
    class Entity
      attr_reader :name

      def initialize(name:)
        @name = name.to_s
      end

      def routes
        underscored_name = name.parameterize.pluralize.underscore

        OpenStruct.new index: Rails.application.routes.url_helpers.public_send("#{underscored_name}_path")
      end

      def human_name
        OpenStruct.new single: name.capitalize, plural: name.pluralize.capitalize
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tramway-0.2.2 lib/tramway/configs/entity.rb