Class: TokensChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/tokenr/tokens_checker.rb

Instance Method Summary collapse

Instance Method Details

#check(environments) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tokenr/tokens_checker.rb', line 4

def check(environments)
  first_hash = environments[environments.keys.first]
  
  first_hash.each_pair do |key, value|
    environments.keys.each do |environment|
      # Skip if what we're comparing is actually the first environment       
      next if environment == environments.keys.first

      break if environments[environment][key] != value
      
      if(environment == environments.keys.last) 
          puts "Unrequired token - all environments have the same value '#{value}' for key '#{key}'"
      end  
    end
  end    
end