Method: ExcelValidator::ValidateFile#names_of_sheets_are?

Defined in:
lib/excel_validator.rb

#names_of_sheets_are?(sheets_hash, case_sensitive = false) ⇒ Boolean

checks the names of the sheets in the file sheets_hash: should be a hash with key, value as position, name respectively. Example: ‘Bank’, 2: ‘Metric’, 7: ‘Country’

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
# File 'lib/excel_validator.rb', line 24

def names_of_sheets_are?(sheets_hash, case_sensitive = false)     
 sheets_hash.each do |key, value|
    if ( case_sensitive ? (@file.sheets[(key.to_i - 1)] != value) : (@file.sheets[(key.to_i - 1)].to_s.downcase != value.to_s.downcase ))        
      return false
    end
 end
 true   
end