rubyexcel 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40c596ee10197b5bc146e4f6be9f2b32ac7a06f7
4
- data.tar.gz: 34c2cfdaae3582ffe47b557bbef408dcbddf434b
3
+ metadata.gz: e73dc9173659b6318a48416b5a6692a0d8b5affa
4
+ data.tar.gz: 379dfddff3355e9cac9681f374fd85d8a9134136
5
5
  SHA512:
6
- metadata.gz: 9a3dd614fe5fbaa9567eaec7687efb35a3545cede5e90a12925b6f8e9f2995164847f4cee19330b4831844c2cde34c566de5a2d961d60ebfe9a62e1f2732fc85
7
- data.tar.gz: b2f60c6c5592bb357214bf387cbb94fd12f0d320d80ab7022113b3d679c2c96d611f103a6ea4f94501da61eae8f387bb17d3c844834c2e455214f4e21fa09894
6
+ metadata.gz: 90d1297aaf058a85e9ad8abaa646fa00a5c4cdeb29048826629f91d5f34116f3d274b5c06b0cd942374103bda43738581a298cb5b9b0114d88746a2347e016bb
7
+ data.tar.gz: a7ecbc87bd8fc4ae4633a99f89d8075caab55641b75a6802760bedf7dada3809f257e5357af84404dbcf9b26bb80b4d09058ee6914d44267c47ac1b2389d745a
data/README.md CHANGED
@@ -304,6 +304,7 @@ s += s
304
304
  s -= data
305
305
  s -= s
306
306
 
307
+ #Sheet#advanced_filter! is Deprecated. Sheet#filter! now accepts multiple arguments.
307
308
  #Filter on multiple criteria
308
309
  #You can add as many arguments as you like. The order is: Header, Method(Symbol), Argument
309
310
  #Note: Returns a copy of the sheet when used without "!".
@@ -354,6 +355,7 @@ s.delete_columns_if { |c| c.empty? }
354
355
  #Note: Returns a copy of the sheet when used without "!".
355
356
  #Note: This gem carries a Regexp to_proc method for Regex shorthand (shown below).
356
357
  s.filter!( 'Part' ) { |value| value =~ /Type[13]/ }
358
+ s.filter!( 'Part', 'Cost' ) { |part, cost| part =~ /Type[13]/ && cost < 2 }
357
359
  s.filter!( 'Part', &/Type[13]/ )
358
360
 
359
361
  #Filter the data to a specific set of columns by their headers.
@@ -246,7 +246,7 @@ require_relative 'address.rb'
246
246
  def filter!( *headers )
247
247
  hrows = sheet.header_rows
248
248
  idx_array = headers.flatten.map { |header| index_by_header( header ) }.compact
249
- @data = @data.select.with_index { |row, i| hrows > i || yield( idx_array.map { |idx| row[ idx -1 ] } ) }
249
+ @data = @data.select.with_index { |row, i| hrows > i || yield( idx_array.length == 1 ? row[ idx_array[0] - 1 ] : idx_array.map { |idx| row[ idx -1 ] } ) }
250
250
  calc_dimensions
251
251
  end
252
252
 
@@ -290,7 +290,7 @@ module RubyExcel
290
290
 
291
291
  def filter!( *headers, &block )
292
292
  return to_enum( :filter!, headers ) unless block_given?
293
- data.filter!( headers, &block ); self
293
+ data.filter!( *headers, &block ); self
294
294
  end
295
295
 
296
296
  #
@@ -390,6 +390,7 @@ module RubyExcel
390
390
  def maxrow
391
391
  data.rows
392
392
  end
393
+ alias length maxrow
393
394
 
394
395
  #
395
396
  # The highest currently used column number
@@ -399,6 +400,7 @@ module RubyExcel
399
400
  data.cols
400
401
  end
401
402
  alias maxcolumn maxcol
403
+ alias width maxcol
402
404
 
403
405
  #
404
406
  # Allow shorthand range references and non-bang versions of bang methods.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Pearson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tabular data structure in Ruby, with header-based helper methods for
14
14
  analysis and editing, and some of Excel's API style. Can output as 2D Array, HTML,