Class: Flipflop::Strategies::OptionsHasher

Inherits:
Object
  • Object
show all
Defined in:
lib/flipflop/strategies/options_hasher.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ OptionsHasher

Returns a new instance of OptionsHasher.



6
7
8
9
# File 'lib/flipflop/strategies/options_hasher.rb', line 6

def initialize(value)
  @hasher = Digest::MD5.new
  @value = value
end

Instance Method Details

#generateObject



11
12
13
14
15
16
17
18
# File 'lib/flipflop/strategies/options_hasher.rb', line 11

def generate
  @hasher << begin
    Marshal.dump(@value)
  rescue TypeError
    @value.object_id.to_s
  end
  @hasher.hexdigest
end