rubyexcel 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/README.md CHANGED
@@ -3,7 +3,7 @@ RubyExcel
3
3
 
4
4
  Designed for Ruby on Windows with MS Excel
5
5
 
6
- Please feel free to log any bugs you find at [GitHub](https://github.com/VirtuosoJoel/RubyExcel/issues "Bug Tracker")
6
+ Please feel free to log any bugs you find [here](https://github.com/VirtuosoJoel/RubyExcel/issues "Bug Tracker").
7
7
 
8
8
  Introduction
9
9
  ------------
@@ -21,8 +21,8 @@ Key design features taken from Excel:
21
21
 
22
22
  Typical usage:
23
23
 
24
- 1. Extract a HTML Table or CSV File into 2D Array ( normally with Nokogiri / Mechanize )
25
- 2. Organise and interpret data with RubyExcel
24
+ 1. Extract a HTML Table or CSV File into 2D Array ( normally with Nokogiri / Mechanize ).
25
+ 2. Organise and interpret data with RubyExcel.
26
26
  3. Output results into a file.
27
27
 
28
28
  About
@@ -566,7 +566,7 @@ s.parent.save_excel( 'Output.xlsx' )
566
566
  Todo List
567
567
  =========
568
568
 
569
- - Write TestCases (after learning how to do it)
569
+ - Write TestCases for most methods (Hopefully that'll stop me releasing broken gem versions)
570
570
 
571
571
  - Find bugs and extirpate them.
572
572
 
@@ -65,7 +65,7 @@ require_relative 'address.rb'
65
65
  end.all?
66
66
  end
67
67
  end
68
-
68
+ calc_dimensions
69
69
  end
70
70
 
71
71
  #
@@ -219,7 +219,7 @@ require_relative 'address.rb'
219
219
  # @return [self]
220
220
  #
221
221
 
222
- def filter( header )
222
+ def filter!( header )
223
223
  hrows = sheet.header_rows
224
224
  idx = index_by_header( header )
225
225
  @data = @data.select.with_index { |row, i| hrows > i || yield( row[ idx -1 ] ) }
@@ -20,6 +20,30 @@ module RubyExcel
20
20
  [ 'Type2', 'QY2', '213', 1, 99.99 ],
21
21
  [ 'Type1', 'QT4', '123', 2, 104 ]
22
22
  ]
23
+
24
+ end
25
+
26
+ def self.sample_hash
27
+
28
+ {
29
+ Part1: {
30
+ Type1: {
31
+ SubType1: 1, SubType2: 2, SubType3: 3
32
+ },
33
+ Type2: {
34
+ SubType1: 4, SubType2: 5, SubType3: 6
35
+ }
36
+ },
37
+ Part2: {
38
+ Type1: {
39
+ SubType1: 1, SubType2: 2, SubType3: 3
40
+ },
41
+ Type2: {
42
+ SubType1: 4, SubType2: 5, SubType3: 6
43
+ }
44
+ }
45
+ }
46
+
23
47
  end
24
48
 
25
49
  #
@@ -162,7 +162,7 @@ module RubyExcel
162
162
 
163
163
  def each_cell_without_headers
164
164
  return to_enum( :each_cell_without_headers ) unless block_given?
165
- each_address { |addr| yield Element.new( sheet, addr ) }
165
+ each_address_without_headers { |addr| yield Element.new( sheet, addr ) }
166
166
  end
167
167
  alias each_cell_wh each_cell_without_headers
168
168
 
data/lib/rubyexcel.rb CHANGED
@@ -47,7 +47,7 @@ module RubyExcel
47
47
  case other
48
48
  when Workbook ; other.each { |sht| sht.workbook = self; @sheets << sht }
49
49
  when Sheet ; @sheets << other; other.workbook = self
50
- when Array ; @sheets << add.load( other )
50
+ when Array ; load( other )
51
51
  else ; fail TypeError, "Unsupported Type: #{ other.class }"
52
52
  end
53
53
  self
@@ -312,14 +312,14 @@ module RubyExcel
312
312
  # @example Filter to 'Part': 'Type1' and 'Type3', with Qty greater than 1
313
313
  # s.advanced_filter!( 'Part', :=~, /Type[13]/, 'Qty', :>, 1 )
314
314
  #
315
- # @example Filter to 'Part': 'Type1', with 'Ref2' containing 'X'
316
- # s.advanced_filter!( 'Part', :==, 'Type1', 'Ref2', :include?, 'X' )
315
+ # @example Filter to 'Part': 'Type1', with 'Ref1' containing 'X'
316
+ # s.advanced_filter!( 'Part', :==, 'Type1', 'Ref1', :include?, 'X' )
317
317
  #
318
- # @param [String] header a header to search under
319
- # @param [Symbol] comparison_operator the operator to compare with
320
- # @param [Object] search_criteria the value to filter by
321
- # @raise [ArgumentError] 'Number of arguments must be a multiple of 3'
322
- # @raise [ArgumentError] 'Operator must be a symbol'
318
+ # @param [String] header a header to search under
319
+ # @param [Symbol] comparison_operator the operator to compare with
320
+ # @param [Object] search_criteria the value to filter by
321
+ # @raise [ArgumentError] 'Number of arguments must be a multiple of 3'
322
+ # @raise [ArgumentError] 'Operator must be a symbol'
323
323
  #
324
324
 
325
325
  def advanced_filter!( *args )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: