lib/shatter/util.rb in shatter-rb-0.0.2 vs lib/shatter/util.rb in shatter-rb-0.1.0

- old
+ new

@@ -1,19 +1,35 @@ # frozen_string_literal: true -require 'logger' -require 'singleton' +require "logger" +require "singleton" + +class String + def camel_case_lower + split("_").inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join + end +end + module Shatter module Util class Logger < ::Logger include Singleton def initialize - super(STDOUT, datetime_format: '%Y-%m-%d %H:%M:%S') + super($stdout, datetime_format: "%Y-%m-%d %H:%M:%S") end end + def self.instances_key + "/shater_service_instances" + end + + def self.zookeeper_response_key_root + "/shatter::response_data_locations" + end + def self.zookeeper_response_key(uuid) - raise 'Cant produce key without uuid' if uuid.nil? - "/shatter::response_data_locations/#{uuid}" + raise "Cant produce key without uuid" if uuid.nil? + + "#{zookeeper_response_key_root}/#{uuid}" end end end