Module: TIMEx::NamedComponent::ClassMethods

Defined in:
lib/timex/named_component.rb

Overview

Class-level API for TIMEx::NamedComponent.

Instance Method Summary collapse

Instance Method Details

#name_symbolSymbol

Returns a memoized Symbol derived from the class basename (e.g. "TIMEx::Strategies::Cooperative":cooperative).

Returns:

  • (Symbol)

    snake_case component name



23
24
25
26
27
28
# File 'lib/timex/named_component.rb', line 23

def name_symbol
  @name_symbol ||= (name || "anonymous").split("::").last
                   .gsub(/([a-z\d])([A-Z])/, '\1_\2')
                   .downcase
                   .to_sym
end