Class: Creek::Book
- Inherits:
-
Object
- Object
- Creek::Book
- Defined in:
- lib/creek/book.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#shared_strings ⇒ Object
readonly
Returns the value of attribute shared_strings.
-
#sheets ⇒ Object
readonly
Returns the value of attribute sheets.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(path, options = {}) ⇒ Book
constructor
A new instance of Book.
- #style_types ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Book
Returns a new instance of Book.
12 13 14 15 16 17 18 19 20 |
# File 'lib/creek/book.rb', line 12 def initialize path, = {} check_file_extension = .fetch(:check_file_extension, true) if check_file_extension extension = File.extname([:original_filename] || path).downcase raise 'Not a valid file format.' unless (['.xlsx', '.xlsm'].include? extension) end @files = Zip::File.open path @shared_strings = SharedStrings.new(self) end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
8 9 10 |
# File 'lib/creek/book.rb', line 8 def files @files end |
#shared_strings ⇒ Object (readonly)
Returns the value of attribute shared_strings.
8 9 10 |
# File 'lib/creek/book.rb', line 8 def shared_strings @shared_strings end |
#sheets ⇒ Object (readonly)
Returns the value of attribute sheets.
8 9 10 |
# File 'lib/creek/book.rb', line 8 def sheets @sheets end |
Instance Method Details
#close ⇒ Object
34 35 36 |
# File 'lib/creek/book.rb', line 34 def close @files.close end |
#style_types ⇒ Object
30 31 32 |
# File 'lib/creek/book.rb', line 30 def style_types @style_types ||= Creek::Styles.new(self).style_types end |