Module: Drawers

Defined in:
lib/drawers.rb,
lib/drawers/railtie.rb,
lib/drawers/version.rb,
lib/drawers/resource_parts.rb,
lib/drawers/action_view/path_extensions.rb,
lib/drawers/action_view/resource_resolver.rb,
lib/drawers/active_support/dependency_extensions.rb

Defined Under Namespace

Modules: DependencyExtensions, PathExtensions Classes: Railtie, ResourceParts, ResourceResolver

Constant Summary collapse

DEFAULT_RESOURCE_SUFFIXES =
%w(
  Controller
  Forms
  Serializer
  Operations
  Presenters
  Policy
  Policies
  Services
).freeze
VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.directoryObject



36
37
38
# File 'lib/drawers.rb', line 36

def directory
  @directory || ''
end

.directory=(dir) ⇒ Object



32
33
34
# File 'lib/drawers.rb', line 32

def directory=(dir)
  @directory = dir
end

.qualified_name_splitObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

split on any of the resource suffixes OR the ruby namespace seperator



48
49
50
# File 'lib/drawers.rb', line 48

def qualified_name_split
  /::|#{resource_suffixes_regex}/
end

.resource_suffixesObject



24
25
26
# File 'lib/drawers.rb', line 24

def resource_suffixes
  @resource_suffixes || DEFAULT_RESOURCE_SUFFIXES
end

.resource_suffixes=(suffixes) ⇒ Object



28
29
30
# File 'lib/drawers.rb', line 28

def resource_suffixes=(suffixes)
  @resource_suffixes = suffixes.freeze
end

.resource_suffixes_regexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Join all the suffix names together with an “OR” operator



42
43
44
# File 'lib/drawers.rb', line 42

def resource_suffixes_regex
  /(#{resource_suffixes.join('|')})/
end