Documentation ¶
Overview ¶
Inflections is a set of functions that duplicate the functions in the ActiveSupport::Inflector system from Rails. Some functions are wrappers around go stdlib functions, unless I realize the go stdlib has differing behavior than the ActiveSupport func, in which case the function here will try to mirror the AS version.
Note: Some functions are not mappable to Go functions, the current known functions are: constantize. Also the strange optional arguments available in the Rails functions are not available, if you actually need the optional arguments, please tell me your use case.
Index ¶
- Variables
- func CamelCase(str string) string
- func Camelize(str string) string
- func Classify(str string) string
- func Dasherize(str string) string
- func Demodularize(str string) string
- func ForeignKey(thing interface{}) string
- func Humanize(str string) string
- func Paramterize(instance interface{}) string
- func Pluralize(str string) string
- func Singularize(str string) string
- func Titlecase(str string) string
- func Titleize(str string) string
- func Underscore(str string) string
Constants ¶
This section is empty.
Variables ¶
var UserDefinedInflections map[string]string
Functions ¶
func Demodularize ¶
func ForeignKey ¶
func ForeignKey(thing interface{}) string
func Paramterize ¶
func Paramterize(instance interface{}) string
func Pluralize ¶
NounPluralize is based on the algorithm described at www.csse.monash.edu.au/~damian/papers/HTML/Plurals.html It doesn't deal with classical pluralizations at the moment. It could have been based on Rails pluralize implementation, but that code is not clear due to the way it was implemented. It is only implemented for English.
func Singularize ¶
func Underscore ¶
This function will change a string from a camelcased form to a string with underscores. Will change "::" to "/" to maintain compatibility with Rails's underscore
Types ¶
This section is empty.