Sha256: 4885412b1df761b955931ef1720de24b72d4cb3fe2b959173c54894747318b08
Contents?: true
Size: 989 Bytes
Versions: 32
Compression:
Stored size: 989 Bytes
Contents
module Effective module Resources module Naming SPLIT = /\/|::/ # / or :: def name # 'post' @name ||= (klass.try(:name).to_s.split(SPLIT).last || '').singularize.underscore end def plural_name # 'posts' name.pluralize end def initialized_name @initialized_name end def class_name # 'Effective::Post' @model_klass.try(:name).to_s end def class_path # 'effective' class_name.split('::')[0...-1].map { |name| name.underscore } * '/' end def namespaced_class_name # 'Admin::Effective::Post' (Array(namespaces).map { |name| name.classify } + [class_name]) * '::' end def namespace # 'admin/things' (namespaces.join('/') if namespaces.present?) end def namespaces # ['admin', 'things'] @namespaces end def human_name class_name.gsub('::', ' ').underscore.gsub('_', ' ') end end end end
Version data entries
32 entries across 32 versions & 1 rubygems