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/
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.
20 21 22 |
# File 'lib/hanami/model/entity_name.rb', line 20 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.
32 33 34 |
# File 'lib/hanami/model/entity_name.rb', line 32 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.
26 27 28 |
# File 'lib/hanami/model/entity_name.rb', line 26 def underscore Utils::String.underscore(@name).to_sym end |