Class: Validator::ExcelAttribValidator
- Inherits:
-
Connector::ExcelReadConnector
- Object
- Connector::ExcelReadConnector
- Validator::ExcelAttribValidator
- Defined in:
- lib/mylookup/validator.rb
Overview
Excel file attributes and properties validator
Instance Method Summary collapse
-
#initialize(path, sht) ⇒ ExcelAttribValidator
constructor
A new instance of ExcelAttribValidator.
- #validate_column(col_name) ⇒ Object
- #validate_sheet ⇒ Object
Methods inherited from Connector::ExcelReadConnector
#column_exists?, #sheet_exists?
Constructor Details
#initialize(path, sht) ⇒ ExcelAttribValidator
Returns a new instance of ExcelAttribValidator.
10 11 12 13 |
# File 'lib/mylookup/validator.rb', line 10 def initialize(path, sht) super(path) @sht = sht end |
Instance Method Details
#validate_column(col_name) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/mylookup/validator.rb', line 23 def validate_column col_name if column_exists? @sht, col_name [true, "#{col_name} column in #{@sht} sheet of #{@path} exists"] else [false, "#{col_name} column in #{@sht} sheet of #{@path} DOES NOT exist!"] end end |
#validate_sheet ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/mylookup/validator.rb', line 15 def validate_sheet if sheet_exists? @sht [true, "#{@sht} sheet in #{@path} exists"] else [false, "#{@sht} sheet in #{@path} DOES NOT exist!"] end end |