Sha256: 8d0c38b9c75d19a8c73e4f406b97fd87d4ad8435e07031ce7455899b8637a0cd
Contents?: true
Size: 608 Bytes
Versions: 3
Compression:
Stored size: 608 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/, "") .gsub(%r[/], ".") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
page_meta-0.2.0 | lib/page_meta/naming.rb |
page_meta-0.1.3 | lib/page_meta/naming.rb |
page_meta-0.1.2 | lib/page_meta/naming.rb |