Sha256: 5d977d6c830d72653d2643c2da0a0a22c784837711b811b7bf80425f809a610d

Contents?: true

Size: 607 Bytes

Versions: 14

Compression:

Stored size: 607 Bytes

Contents

require_relative 'entity_name'
require 'hanami/utils/string'

module Hanami
  module Model
    # Conventional name for relations.
    #
    # Given a repository named <tt>SourceFileRepository</tt>, the associated
    # relation will be <tt>:source_files</tt>.
    #
    # @since 0.7.0
    # @api private
    class RelationName < EntityName
      # @param name [Class,String] the class or its name
      # @return [String] the relation name
      #
      # @since 0.7.0
      # @api private
      def self.new(name)
        Utils::String.transform(super, :underscore, :pluralize)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hanami-model-1.3.2 lib/hanami/model/relation_name.rb
hanami-model-1.3.1 lib/hanami/model/relation_name.rb
hanami-model-1.3.0 lib/hanami/model/relation_name.rb
hanami-model-1.3.0.beta1 lib/hanami/model/relation_name.rb
hanami-model-1.2.0 lib/hanami/model/relation_name.rb
hanami-model-1.2.0.rc2 lib/hanami/model/relation_name.rb
hanami-model-1.2.0.rc1 lib/hanami/model/relation_name.rb
hanami-model-1.2.0.beta2 lib/hanami/model/relation_name.rb
hanami-model-1.2.0.beta1 lib/hanami/model/relation_name.rb
hanami-model-1.1.0 lib/hanami/model/relation_name.rb
hanami-model-1.1.0.rc1 lib/hanami/model/relation_name.rb
hanami-model-1.1.0.beta3 lib/hanami/model/relation_name.rb
hanami-model-1.1.0.beta2 lib/hanami/model/relation_name.rb
hanami-model-1.1.0.beta1 lib/hanami/model/relation_name.rb