rubyexcel 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05baad4d95550fd8ad617defee125d098768f039
4
- data.tar.gz: 38bde97de67d3a586ef3b7eab6d00be2e0e98651
3
+ metadata.gz: 56cbaf87bad39d48f875f9312e994296ecfcd6dc
4
+ data.tar.gz: 2c46e48065fd28719dd96baaba87e0215b5b7e60
5
5
  SHA512:
6
- metadata.gz: 66b83ff4c9629ffe1a07ea06b7baac4e432a550ee46d15ab3fa884fadf5d713025cbcef52b1a298548793d5a658b7498e8553aece4e6a12fdfe49cd51c06cf36
7
- data.tar.gz: 5c40988dfe369886aebf048a1e2bf97ce807f97094e76c8dafcafcfd4ddb69075b6028ec33bd168fd898b5a22c20dac5b563a1517ee27f84a404e3f0dd4491e3
6
+ metadata.gz: d095e09ff7d71921de4341f4ed7fbb738630f475f21355be75ef79bc57fa0aeaa409f7ff7d563aa088d3010e20bc1ea57c58796b77d58f40cf96222c246d1bc9
7
+ data.tar.gz: 2cb18345c9990dc8288caaa8820231851431cdb942cd32e44fdb41e8fee095f83dd96b8b92a13294cc0c33f9edb9171434f29f4c40d99564f7b865f4630d8a8e
@@ -63,7 +63,7 @@ module RubyExcel
63
63
  #
64
64
 
65
65
  def column_id( address )
66
- address[/[A-Z]+/]
66
+ address[/[A-Z]+/i].upcase
67
67
  end
68
68
 
69
69
  #
@@ -119,7 +119,7 @@ module RubyExcel
119
119
  class Cell < Element
120
120
 
121
121
  def initialize( sheet, addr )
122
- fail ArgumentError, "Invalid Cell address: #{ addr }" unless addr =~ /\A[A-Z]{1,3}\d+\z/
122
+ fail ArgumentError, "Invalid Cell address: #{ addr }" unless addr =~ /\A[A-Z]{1,3}\d+\z/i
123
123
  super
124
124
  end
125
125
 
@@ -160,7 +160,7 @@ module RubyExcel
160
160
  class Range < Element
161
161
 
162
162
  def initialize( sheet, addr )
163
- fail ArgumentError, "Invalid Range address: #{ addr }" unless addr =~ /\A[A-Z]{1,3}\d+:[A-Z]{1,3}\d+\z|\A[A-Z]{1,3}:[A-Z]{1,3}\z|\A\d+:\d+\z/
163
+ fail ArgumentError, "Invalid Range address: #{ addr }" unless addr =~ /\A[A-Z]{1,3}\d+:[A-Z]{1,3}\d+\z|\A[A-Z]{1,3}:[A-Z]{1,3}\z|\A\d+:\d+\z/i
164
164
  super
165
165
  end
166
166
 
@@ -169,6 +169,16 @@ module RubyExcel
169
169
  end
170
170
  alias cells cell
171
171
 
172
+ #
173
+ # Delete all data and headers from Sheet
174
+ #
175
+
176
+ def clear_all
177
+ @data = Data.new( self, [[]] )
178
+ self
179
+ end
180
+ alias delete_all clear_all
181
+
172
182
  #
173
183
  # Access a Column (Section) by its reference.
174
184
  #
@@ -259,7 +269,7 @@ module RubyExcel
259
269
  end
260
270
 
261
271
  #
262
- # Check whether the Sheet contains data
272
+ # Check whether the Sheet contains data (not counting headers)
263
273
  #
264
274
  # @return [Boolean] if there is any data
265
275
  #
@@ -324,6 +334,27 @@ module RubyExcel
324
334
  "#{ self.class }:0x#{ '%x' % (object_id << 1) }: #{ name }"
325
335
  end
326
336
 
337
+ #
338
+ # The last Column in the Sheet
339
+ #
340
+ # @return [RubyExcel::Column]
341
+ #
342
+
343
+ def last_column
344
+ column( maxcol )
345
+ end
346
+ alias last_col last_column
347
+
348
+ #
349
+ # The last Row in the Sheet
350
+ #
351
+ # @return [RubyExcel::Row]
352
+ #
353
+
354
+ def last_row
355
+ row( maxrow )
356
+ end
357
+
327
358
  #
328
359
  # Populate the Sheet with data (overwrite)
329
360
  #
@@ -597,6 +628,17 @@ module RubyExcel
597
628
  end
598
629
  alias unique! uniq!
599
630
 
631
+ #
632
+ # Remove any Rows with duplicate values within a Column
633
+ #
634
+ # @return [Range] the Sheet's contents in Range
635
+ #
636
+
637
+ def usedrange
638
+ raise NoMethodError, 'Sheet is empty' if empty?
639
+ Range.new( self, 'A1:' + indices_to_address( maxrow, maxcol ) )
640
+ end
641
+
600
642
  #
601
643
  # Find a value within a Column by searching another Column
602
644
  #
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
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-08-22 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tabular data structure in Ruby, with header-based helper methods for
14
- analysis and editing, and some of Excel's API style. Can output as 2D Array, Excel,
15
- HTML, and TSV.
14
+ analysis and editing, and some of Excel's API style. Can output as 2D Array, HTML,
15
+ CSV, TSV, or to an Excel WIN32OLE Object
16
16
  email: VirtuosoJoel@gmail.com
17
17
  executables: []
18
18
  extensions: []