Sha256: 260a45fb8c456431f0fa3e6dd134ef663f91d66671f6922ffe449e254c3f8fe6
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 Bytes
Contents
# frozen_string_literal: true module Hanami module Model # Conventional name for entities. # # Given a repository named <tt>SourceFileRepository</tt>, the associated # entity will be <tt>SourceFile</tt>. # # @since 0.7.0 # @api private class EntityName # @since 0.7.0 # @api private SUFFIX = /Repository\z/.freeze # @param name [Class,String] the class or its name # @return [String] the entity name # # @since 0.7.0 # @api private def initialize(name) @name = name.sub(SUFFIX, "") end # @since 0.7.0 # @api private def underscore Utils::String.underscore(@name).to_sym end # @since 0.7.0 # @api private def to_s @name end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-model-1.3.3 | lib/hanami/model/entity_name.rb |