Sha256: cadde0dea5fdd1a3a070e12639f0e8582d63c1228fcaf34a4b2393b0715d9d95
Contents?: true
Size: 872 Bytes
Versions: 1
Compression:
Stored size: 872 Bytes
Contents
module Effective module Resources module Naming SPLIT = /\/|::/ # / or :: def name # 'post' @name ||= @input_name.split(SPLIT).last.singularize end def plural_name # 'posts' name.pluralize end def class_name # 'Effective::Post' @class_name end def class_path # 'effective' class_name.split('::')[0...-1].map { |name| name.underscore } * '/' end def namespaced_class_name # 'Admin::Effective::Post' (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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
effective_resources-0.3.2 | app/models/effective/resources/naming.rb |