lib/service_skeleton.rb in service_skeleton-0.0.0.15.g53952e3 vs lib/service_skeleton.rb in service_skeleton-0.0.0.16.g99ff4d7

- old
+ new

@@ -21,16 +21,11 @@ def self.config_class(klass) @config_class = klass end def self.service_name - self.to_s - .gsub("::", "_") - .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') - .gsub(/([a-z\d])([A-Z])/, '\1_\2') - .downcase - .gsub(/[^a-zA-Z0-9_]/, "_") + service_name_from_class(self) end attr_reader :config, :metrics, :logger def initialize(env) @@ -97,9 +92,18 @@ def hook_signal(spec, &blk) @signal_handler.hook_signal(spec, &blk) end private + + def self.service_name_from_class(klass) + klass.to_s + .gsub("::", "_") + .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') + .gsub(/([a-z\d])([A-Z])/, '\1_\2') + .downcase + .gsub(/[^a-zA-Z0-9_]/, "_") + end def run raise ServiceSkeleton::Error::InheritanceContractError, "ServiceSkeleton#run method not overridden" end