Module: CommonName::ClassMethods

Defined in:
lib/common_name.rb

Instance Method Summary collapse

Instance Method Details

#common_camelObject

“BusCompany”



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

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

#common_humanObject

“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_instanceObject

“@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_modelObject

BusCompany

Already constantized.



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

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

#common_nameObject

“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_pluralObject

“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_camelObject

“BusCompanies”



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

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

#common_plural_humanObject

“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_instanceObject

“@bus_companies”



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

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

#common_plural_symbolObject

:bus_companies



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

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

#common_plural_titleObject

“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_symbolObject

:bus_company



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

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

#common_titleObject

“Bus company”

Microsoft titlecase.



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

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