simple-xls 0.1.0
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.
- data/README +0 -0
- data/lib/simple-xls.rb +24 -0
- metadata +68 -0
data/README
ADDED
File without changes
|
data/lib/simple-xls.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class SimpleXLS
|
2
|
+
attr_accessor :headers, :rows
|
3
|
+
|
4
|
+
def initialize(headers = [])
|
5
|
+
@rows = []
|
6
|
+
@headers = headers
|
7
|
+
end
|
8
|
+
|
9
|
+
def push(row)
|
10
|
+
raise ArgumentError unless row.is_a?(Array)
|
11
|
+
@rows.push(row)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
output = "<table><thead><tr>"
|
16
|
+
output << @headers.collect { |hr| "<th>#{hr}</th>" }.join << "</tr></thead><tbody>"
|
17
|
+
output << @rows.collect { |row|
|
18
|
+
# even out the row if needed
|
19
|
+
row += Array.new(headers.size - row.size) if row.size != headers.size
|
20
|
+
"<tr>#{row.collect { |cell| "<td>#{cell}</td>"}.join}</tr>"
|
21
|
+
}.join
|
22
|
+
output << "</tbody></table>"
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
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
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- mikeycgto
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-04 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: mikeycgto@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README
|
32
|
+
- lib/simple-xls.rb
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/mikeycgto/simple-xls
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
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
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.3.7
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Simple XLS
|
67
|
+
test_files: []
|
68
|
+
|