Class: Vernacular::ConfigurationHash

Inherits:
Object
  • Object
show all
Defined in:
lib/vernacular/configuration_hash.rb

Overview

Builds a hash out of the given modifiers that represents that current state of configuration. This ensures that if the configuration of ‘Vernacular` changes between runs it doesn’t pick up the old compiled files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(modifiers = []) ⇒ ConfigurationHash

Returns a new instance of ConfigurationHash.



10
11
12
# File 'lib/vernacular/configuration_hash.rb', line 10

def initialize(modifiers = [])
  @modifiers = modifiers
end

Instance Attribute Details

#modifiersObject (readonly)

Returns the value of attribute modifiers.



8
9
10
# File 'lib/vernacular/configuration_hash.rb', line 8

def modifiers
  @modifiers
end

Instance Method Details

#hashObject



14
15
16
17
18
19
20
# File 'lib/vernacular/configuration_hash.rb', line 14

def hash
  digest = Digest::MD5.new
  modifiers.each do |modifier|
    digest << modifier.components.inspect
  end
  digest.to_s
end