module Upgrow::Naming
Functions to derive constant names and other identifiers according to Upgrow's conventions.
Public Instance Methods
model_to_record(model_name)
click to toggle source
record_to_model(record_name)
click to toggle source
Convert a Record
name to a Model
name. The Model
name by convention is the Record
name without the `Record` suffix.
@param record_name [String] the Record
name.
@return [String] the Model
name.
# File lib/upgrow/naming.rb, line 25 def record_to_model(record_name) record_name.delete_suffix('Record') end
repository_to_record(repository_name)
click to toggle source
Convert a Repository
name to a Record
name. The Record
name is inferred by the Repository
name without the `Repository` suffix, and with the `Record` suffix added.
@param repository_name [String] the Repository
name.
@return [String] the Record
name.
# File lib/upgrow/naming.rb, line 36 def repository_to_record(repository_name) "#{repository_name.delete_suffix("Repository")}Record" end