Sha256: e7bdc9452b6c272049ed11a945fa25f052e6f505e1dee416aad95a135b535a6a
Contents?: true
Size: 604 Bytes
Versions: 2
Compression:
Stored size: 604 Bytes
Contents
# frozen_string_literal: true module PageMeta class Naming def initialize(controller) @_controller = controller end def action (@action ||= Action.new(@_controller.action_name)).to_s end # Normalize the controller name. # Converts `PagesController` into `pages` and # `Admin::PagesController` into `admin.pages`. def controller @controller ||= @_controller .class .name .underscore .gsub(/_controller/, "") .tr("/", ".") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
page_meta-1.1.0 | lib/page_meta/naming.rb |
page_meta-1.0.0 | lib/page_meta/naming.rb |