Sha256: ff9030598444389e7f0a4f500c564a0fd840f2e0350bef64183cf734231bf879
Contents?: true
Size: 987 Bytes
Versions: 4
Compression:
Stored size: 987 Bytes
Contents
# frozen_string_literal: true # rubocop:disable Metrics/LineLength module Drillbit module Resource module Naming CONTROLLER_RESOURCE_NAME_PATTERN = /\A((.*?::)?.*?)(\w+?)(?:Index|Indicies)?Controller\z/ module ClassMethods def plural_resource_name @plural_resource_name ||= name[CONTROLLER_RESOURCE_NAME_PATTERN, 3] .underscore .pluralize .downcase end def singular_resource_name @singular_resource_name ||= name[CONTROLLER_RESOURCE_NAME_PATTERN, 3] .underscore .singularize .downcase end def resource_class_name @resource_class_name ||= singular_resource_name .camelize end end def self.included(base) base.extend ClassMethods end end end end # rubocop:enable Metrics/LineLength
Version data entries
4 entries across 4 versions & 1 rubygems