Sha256: 4dfda37f82fe9d5d6efe0604ef73bddc455b2123b132ba7c0c15cef89d20588c

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Gamefic
  module Standard
    # Methods for adding definite and indefinite articles to entity names.
    #
    module Articles
      # Get a name for the entity with an indefinite article (unless the entity
      # has a proper name).
      #
      # @param entity [Gamefic::Entity]
      # @return [String]
      def a(entity)
        entity.indefinitely
      end
      alias an a

      # Get a name for the entity with a definite article (unless the entity has
      # a proper name).
      #
      # @param entity [Gamefic::Entity]
      # @return [String]
      def the(entity)
        entity.definitely
      end

      # Get a capitalized name for the entity with an indefinite article (unless
      # the entity has a proper name).
      #
      # @param entity [Gamefic::Entity]
      # @return [String]
      def a_(entity)
        entity.indefinitely.cap_first
      end
      alias an_ a_
      alias A a_
      alias An a_

      # Get a capitalized name for the entity with a definite article (unless
      # the entity has a proper name).
      #
      # @param entity [Gamefic::Entity]
      # @return [String]
      def the_(entity)
        entity.definitely.cap_first
      end
      alias The the_
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-3.3.0 lib/gamefic-standard/articles.rb