Class: ViewWorkBook
- Inherits:
-
Object
- Object
- ViewWorkBook
- Includes:
- File_Checking, Logging
- Defined in:
- lib/viewworkbook.rb
Instance Attribute Summary collapse
-
#workbook ⇒ Object
readonly
Returns the value of attribute workbook.
Instance Method Summary collapse
-
#initialize(*args) ⇒ ViewWorkBook
constructor
A new instance of ViewWorkBook.
- #method_missing(method, *args) ⇒ Object
- #sheet(number) ⇒ Object
Methods included from File_Checking
Methods included from Logging
#init_logger, #log_level=, #log_target=
Constructor Details
#initialize(*args) ⇒ ViewWorkBook
Returns a new instance of ViewWorkBook.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/viewworkbook.rb', line 41 def initialize(*args) init_logger(STDOUT, Logger::INFO) @log.debug('args is ' << args.to_s) wb = args[0] path = File.path(wb) if wb @log.debug('workbook file will be ' << (path ? path : 'N I L')) if(wb) msg = file_check(path, :exist?, :file?, :readable?) if(!msg) begin @workbook = SheetData.workbook(path) view_sheet if @workbook end else @log.error(yellow("Cannot open " << path << ": " << msg)) # raise IOError.new(msg) puts red("\n\tPlease name a valid spreadsheet file! Aborting.") puts exit false end end @log.debug('initialized') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
66 67 68 |
# File 'lib/viewworkbook.rb', line 66 def method_missing(method, *args) @workbook.send(method.to_sym, *args) end |
Instance Attribute Details
#workbook ⇒ Object (readonly)
Returns the value of attribute workbook.
39 40 41 |
# File 'lib/viewworkbook.rb', line 39 def workbook @workbook end |
Instance Method Details
#sheet(number) ⇒ Object
70 71 72 |
# File 'lib/viewworkbook.rb', line 70 def sheet(number) view_sheet(number) end |