Method: RubyExcel::Workbook#sheets
- Defined in:
- lib/rubyexcel.rb
#sheets(ref = nil) {|RubyExcel::Sheet| ... } ⇒ RubyExcel::Sheet, Enumerator
Select a Sheet or iterate through them
210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/rubyexcel.rb', line 210 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 |