lib/flipper/key.rb in flipper-0.3.0 vs lib/flipper/key.rb in flipper-0.4.0

- old
+ new

@@ -1,19 +1,38 @@ module Flipper + # Private: Used internally in flipper to create key to be used for feature in + # the adapter. You should never need to use this. class Key + # Private Separator = '/' - attr_reader :prefix, :suffix + # Private + attr_reader :feature_name - def initialize(prefix, suffix) - @prefix, @suffix = prefix, suffix + # Private + attr_reader :gate_key + + # Internal + def initialize(feature_name, gate_key) + @feature_name, @gate_key = feature_name, gate_key end + # Private def separator Separator.dup end + # Private def to_s - "#{prefix}#{separator}#{suffix}" + "#{feature_name}#{separator}#{gate_key}" + end + + # Internal: Pretty string version for debugging. + def inspect + attributes = [ + "feature_name=#{feature_name.inspect}", + "gate_key=#{gate_key.inspect}", + ] + "#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>" end end end