Module: CommonName::ClassMethods
- Defined in:
- lib/common_name.rb
Instance Method Summary collapse
-
#common_camel ⇒ Object
“BusCompany”.
-
#common_human ⇒ Object
“bus company”.
-
#common_instance ⇒ Object
“@bus_company”.
-
#common_model ⇒ Object
BusCompany.
-
#common_name ⇒ Object
“bus_company”.
-
#common_plural ⇒ Object
“bus_companies”.
-
#common_plural_camel ⇒ Object
“BusCompanies”.
-
#common_plural_human ⇒ Object
“bus companies”.
-
#common_plural_instance ⇒ Object
“@bus_companies”.
-
#common_plural_symbol ⇒ Object
:bus_companies.
-
#common_plural_title ⇒ Object
“Bus companies”.
-
#common_symbol ⇒ Object
:bus_company.
-
#common_title ⇒ Object
“Bus company”.
Instance Method Details
#common_camel ⇒ Object
“BusCompany”
55 |
# File 'lib/common_name.rb', line 55 def common_camel; _COMMON_CAMEL ||= common_name.camelcase; end |
#common_human ⇒ Object
“bus company”
Unlike humanize
, this is lowercase.
52 |
# File 'lib/common_name.rb', line 52 def common_human; _COMMON_HUMAN ||= common_title.downcase; end |
#common_instance ⇒ Object
“@bus_company”
For use with instance_variable_get
, etc.
42 |
# File 'lib/common_name.rb', line 42 def common_instance; _COMMON_INSTANCE ||= '@' << common_name; end |
#common_model ⇒ Object
BusCompany
Already constantized.
60 |
# File 'lib/common_name.rb', line 60 def common_model; _COMMON_MODEL ||= common_camel.constantize; end |
#common_name ⇒ Object
“bus_company”
Identical to _common_name
, which you have to provide.
34 |
# File 'lib/common_name.rb', line 34 def common_name; _COMMON_NAME ||= _common_name; end |
#common_plural ⇒ Object
“bus_companies”
Derived from _common_name, unless you provide _common_plural.
65 |
# File 'lib/common_name.rb', line 65 def common_plural; _COMMON_PLURAL ||= (respond_to?(:_common_plural) ? _common_plural : common_name.pluralize); end |
#common_plural_camel ⇒ Object
“BusCompanies”
84 |
# File 'lib/common_name.rb', line 84 def common_plural_camel; _COMMON_PLURAL_CAMEL ||= common_plural.camelcase; end |
#common_plural_human ⇒ Object
“bus companies”
See common_human
for notes on capitalization.
81 |
# File 'lib/common_name.rb', line 81 def common_plural_human; _COMMON_PLURAL_HUMAN ||= common_plural_title.downcase; end |
#common_plural_instance ⇒ Object
“@bus_companies”
71 |
# File 'lib/common_name.rb', line 71 def common_plural_instance; _COMMON_PLURAL_INSTANCE ||= '@' << common_plural; end |
#common_plural_symbol ⇒ Object
:bus_companies
68 |
# File 'lib/common_name.rb', line 68 def common_plural_symbol; _COMMON_PLURAL_SYMBOL ||= common_plural.to_sym; end |
#common_plural_title ⇒ Object
“Bus companies”
See common_title
for notes on capitalization.
76 |
# File 'lib/common_name.rb', line 76 def common_plural_title; _COMMON_PLURAL_TITLE ||= common_plural.humanize; end |
#common_symbol ⇒ Object
:bus_company
37 |
# File 'lib/common_name.rb', line 37 def common_symbol; _COMMON_SYMBOL ||= common_name.to_sym; end |
#common_title ⇒ Object
“Bus company”
Microsoft titlecase.
47 |
# File 'lib/common_name.rb', line 47 def common_title; _COMMON_TITLE ||= common_name.humanize; end |