simple-xls 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +15 -0
  2. data/lib/simple-xls.rb +6 -4
  3. metadata +19 -39
data/README CHANGED
@@ -0,0 +1,15 @@
1
+ h1. Simple XLS
2
+
3
+ This gem basically builds HTML tables thus allowing you to easily import data into Excel and the like.
4
+
5
+ Example:
6
+
7
+ xls = SimpleXLS.new ['header1','header2','header3']
8
+
9
+ xls.push [1,2,3]
10
+ xls.push [4,5]
11
+ xls.push [6,7,8]
12
+
13
+ File.open('output.xls', 'w+') { |f|
14
+ f.puts xls
15
+ }
@@ -1,14 +1,16 @@
1
1
  class SimpleXLS
2
2
  attr_accessor :headers, :rows
3
3
 
4
- def initialize(headers = [])
4
+ def initialize(headers)
5
+ raise ArugmentError('Row must be an Array') unless headers.is_a?(Array)
6
+
7
+ @headers = headers.nil? ? [] : headers.dup
5
8
  @rows = []
6
- @headers = headers
7
9
  end
8
10
 
9
11
  def push(row)
10
- raise ArgumentError unless row.is_a?(Array)
11
- @rows.push(row)
12
+ raise ArugmentError('Row must be an Array') unless row.is_a?(Array)
13
+ @rows.push(row.dup)
12
14
  end
13
15
 
14
16
  def to_s
metadata CHANGED
@@ -1,68 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: simple-xls
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - mikeycgto
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-12-04 00:00:00 -05:00
12
+ date: 2010-12-04 00:00:00.000000000 -05:00
19
13
  default_executable:
20
14
  dependencies: []
21
-
22
15
  description:
23
16
  email: mikeycgto@gmail.com
24
17
  executables: []
25
-
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
20
+ files:
31
21
  - README
32
22
  - lib/simple-xls.rb
33
23
  has_rdoc: true
34
24
  homepage: http://github.com/mikeycgto/simple-xls
35
25
  licenses: []
36
-
37
26
  post_install_message:
38
27
  rdoc_options: []
39
-
40
- require_paths:
28
+ require_paths:
41
29
  - lib
42
- required_ruby_version: !ruby/object:Gem::Requirement
30
+ required_ruby_version: !ruby/object:Gem::Requirement
43
31
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- hash: 3
48
- segments:
49
- - 0
50
- version: "0"
51
- required_rubygems_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
37
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
60
42
  requirements: []
61
-
62
43
  rubyforge_project:
63
- rubygems_version: 1.3.7
44
+ rubygems_version: 1.5.2
64
45
  signing_key:
65
46
  specification_version: 3
66
47
  summary: Simple XLS
67
48
  test_files: []
68
-