Method: RubyExcel::Workbook#sheets
- Defined in:
- lib/rubyexcel.rb
#sheets(ref = nil) {|RubyExcel::Sheet| ... } ⇒ RubyExcel::Sheet, Enumerator
Select a Sheet or iterate through them
192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/rubyexcel.rb', line 192 def sheets( ref=nil ) if ref.nil? return to_enum (:each) unless block_given? each { |s| yield s } else case ref when Fixnum ; @sheets[ ref - 1 ] when String ; @sheets.find { |s| s.name =~ /^#{ ref }$/i } when Regexp ; @sheets.find { |s| s.name =~ ref } end end end |