Class: FeatureFlagMonitor::ConsulKey

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_flag_monitor/consul_key.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key_type, identifier) ⇒ ConsulKey

Returns a new instance of ConsulKey.



15
16
17
# File 'lib/feature_flag_monitor/consul_key.rb', line 15

def initialize(key_type, identifier)
  @key_parts = ['ffm', key_type, identifier]
end

Class Method Details

.by_cname(cname) ⇒ Object



7
8
9
# File 'lib/feature_flag_monitor/consul_key.rb', line 7

def self.by_cname(cname)
  self.new(:n, cname)
end

.by_id(id) ⇒ Object



3
4
5
# File 'lib/feature_flag_monitor/consul_key.rb', line 3

def self.by_id(id)
  self.new(:i, id)
end

.for_typesObject



11
12
13
# File 'lib/feature_flag_monitor/consul_key.rb', line 11

def self.for_types
  self.new(:m, 'types').to_key
end

Instance Method Details

#for_domainObject



19
20
21
# File 'lib/feature_flag_monitor/consul_key.rb', line 19

def for_domain
  to_key
end

#to_keyObject



23
24
25
# File 'lib/feature_flag_monitor/consul_key.rb', line 23

def to_key
  @key_parts.join('/') << '?stale'
end