Class: ViewWorkBook
- Inherits:
-
Object
- Object
- ViewWorkBook
- Includes:
- BasicLogging, File_Checking
- Defined in:
- lib/viewworkbook.rb
Constant Summary
Constants included from BasicLogging
BasicLogging::DEBUG, BasicLogging::ERROR, BasicLogging::FATAL, BasicLogging::INFO, BasicLogging::Levels, BasicLogging::UNKNOWN, BasicLogging::WARN
Instance Attribute Summary collapse
-
#workbook ⇒ Object
readonly
Returns the value of attribute workbook.
Attributes included from BasicLogging
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
#file_check, file_check, magic_check, mime_check
Methods included from BasicLogging
is_muted?, #log, mute, #set_level, set_level, set_target, #set_target
Constructor Details
#initialize(*args) ⇒ ViewWorkBook
Returns a new instance of ViewWorkBook.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/viewworkbook.rb', line 31 def initialize(*args) debug('args is ' << args.to_s) wb = args[0] path = File.path(wb) if wb 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 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 debug('initialized') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
55 56 57 |
# File 'lib/viewworkbook.rb', line 55 def method_missing(method, *args) @workbook.send(method.to_sym, *args) end |
Instance Attribute Details
#workbook ⇒ Object (readonly)
Returns the value of attribute workbook.
29 30 31 |
# File 'lib/viewworkbook.rb', line 29 def workbook @workbook end |
Instance Method Details
#sheet(number) ⇒ Object
59 60 61 |
# File 'lib/viewworkbook.rb', line 59 def sheet(number) view_sheet(number) end |