Class: Hanami::Model::EntityName Private
- Inherits:
-
Object
- Object
- Hanami::Model::EntityName
- Defined in:
- lib/hanami/model/entity_name.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Conventional name for entities.
Given a repository named SourceFileRepository
, the associated entity will be SourceFile
.
Direct Known Subclasses
Constant Summary collapse
- SUFFIX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/Repository\z/.freeze
Instance Method Summary collapse
-
#initialize(name) ⇒ String
constructor
private
The entity name.
- #to_s ⇒ Object private
- #underscore ⇒ Object private
Constructor Details
#initialize(name) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the entity name.
22 23 24 |
# File 'lib/hanami/model/entity_name.rb', line 22 def initialize(name) @name = name.sub(SUFFIX, "") end |
Instance Method Details
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/hanami/model/entity_name.rb', line 34 def to_s @name end |
#underscore ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/hanami/model/entity_name.rb', line 28 def underscore Utils::String.underscore(@name).to_sym end |