Module: CommonName::ClassMethods

Defined in:
lib/common_name.rb

Instance Method Summary collapse

Instance Method Details

#common_camelObject

“BusCompany”



60
# File 'lib/common_name.rb', line 60

def common_camel;             _COMMON_CAMEL           ||= common_name.camelcase;                                                    end

#common_humanObject

“bus company”

Unlike humanize, this is lowercase.



57
# File 'lib/common_name.rb', line 57

def common_human;             _COMMON_HUMAN           ||= common_title.downcase;                                                    end

#common_instanceObject

“@bus_company”

For use with instance_variable_get, etc.



47
# File 'lib/common_name.rb', line 47

def common_instance;          _COMMON_INSTANCE        ||= '@' << common_name;                                                       end

#common_modelObject

BusCompany

Already constantized.



65
# File 'lib/common_name.rb', line 65

def common_model;             _COMMON_MODEL           ||= common_camel.constantize;                                                 end

#common_nameObject

“bus_company”

Identical to _common_name, which you have to provide.



39
# File 'lib/common_name.rb', line 39

def common_name;              _COMMON_NAME            ||= _common_name;                                                             end

#common_pluralObject

“bus_companies”

Derived from _common_name, unless you provide _common_plural.



70
# File 'lib/common_name.rb', line 70

def common_plural;            _COMMON_PLURAL          ||= (respond_to?(:_common_plural) ? _common_plural : common_name.pluralize);  end

#common_plural_camelObject

“BusCompanies”



89
# File 'lib/common_name.rb', line 89

def common_plural_camel;      _COMMON_PLURAL_CAMEL    ||= common_plural.camelcase;                                                  end

#common_plural_humanObject

“bus companies”

See common_human for notes on capitalization.



86
# File 'lib/common_name.rb', line 86

def common_plural_human;      _COMMON_PLURAL_HUMAN    ||= common_plural_title.downcase;                                             end

#common_plural_instanceObject

“@bus_companies”



76
# File 'lib/common_name.rb', line 76

def common_plural_instance;   _COMMON_PLURAL_INSTANCE ||= '@' << common_plural;                                                     end

#common_plural_symbolObject

:bus_companies



73
# File 'lib/common_name.rb', line 73

def common_plural_symbol;     _COMMON_PLURAL_SYMBOL   ||= common_plural.to_sym;                                                     end

#common_plural_titleObject

“Bus companies”

See common_title for notes on capitalization.



81
# File 'lib/common_name.rb', line 81

def common_plural_title;      _COMMON_PLURAL_TITLE    ||= common_plural.humanize;                                                   end

#common_symbolObject

:bus_company



42
# File 'lib/common_name.rb', line 42

def common_symbol;            _COMMON_SYMBOL          ||= common_name.to_sym;                                                       end

#common_titleObject

“Bus company”

Microsoft titlecase.



52
# File 'lib/common_name.rb', line 52

def common_title;             _COMMON_TITLE           ||= common_name.humanize;                                                     end