mindreframer-oxcelix 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2
+ <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="10" uniqueCount="3">
3
+ <si>
4
+ <t xml:space="preserve"> </t>
5
+ </si>
6
+ <si>
7
+ <t>Unit</t>
8
+ </si>
9
+ <si>
10
+ <t>%</t>
11
+ </si>
12
+ </sst>
Binary file
@@ -0,0 +1,11 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe "Matrix object" do
4
+ describe '#[]=' do
5
+ it "should set a cell to a new value" do
6
+ m_obj = Matrix.build(4, 4){nil}
7
+ m_obj[3,3] = 'foo'
8
+ m_obj[3,3].should == 'foo'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ require './spec/spec_helper.rb'
2
+
3
+ describe "Oxcelix module" do
4
+ describe 'Workbook' do
5
+ context 'normal' do
6
+ it "should open the excel file and return a Workbook object" do
7
+ file = 'spec/fixtures/test.xlsx'
8
+ w=Oxcelix::Workbook.new(file)
9
+ w.sheets.size.should == 2
10
+ w.sheets[0].name.should == "Testsheet1"
11
+ w.sheets[1].name.should == "Testsheet2"
12
+ end
13
+ end
14
+ context 'with excluded sheets' do
15
+ it "should open the sheets not excluded of the excel file" do
16
+ file = 'spec/fixtures/test.xlsx'
17
+ w=Oxcelix::Workbook.new(file, {:exclude=>['Testsheet2']})
18
+ w.sheets.size.should == 1
19
+ w.sheets[0].name.should == "Testsheet1"
20
+ end
21
+ end
22
+ context 'with included sheets' do
23
+ it "should open only the included sheets of the excel file" do
24
+ file = 'spec/fixtures/test.xlsx'
25
+ w = Oxcelix::Workbook.new(file, {:include=>['Testsheet2']})
26
+ w.sheets.size.should == 1
27
+ w.sheets[0].name.should == "Testsheet2"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ require './spec/spec_helper'
2
+ describe Oxcelix::Sharedstrings do
3
+ describe 'number of elements in shared_strings' do
4
+
5
+ def values_from_oga
6
+ require 'oga'
7
+ doc = Oga.parse_xml(File.read('spec/fixtures/shared_strings.xml'))
8
+ correct_values = doc.xpath('*[local-name() = "sst"]/*[local-name() = "si"]/*[local-name() = "t"]').map{|x| x.text}
9
+ end
10
+
11
+ it "counts also quasi-empty elements" do
12
+ strings = Oxcelix::Sharedstrings.new
13
+ File.open('spec/fixtures/shared_strings.xml', 'r') do |f|
14
+ Ox.sax_parse(strings, f, {})
15
+ end
16
+
17
+ strings.stringarray.size.should == values_from_oga.size
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ require_relative '../lib/oxcelix'
2
+
3
+ require 'yaml'
4
+ require 'pry'
@@ -0,0 +1,21 @@
1
+
2
+ require './spec/spec_helper'
3
+
4
+ describe "String object" do
5
+ describe 'numeric?' do
6
+ context "with numbers" do
7
+ it "should return true" do
8
+ (1..100).each do |x|
9
+ x.to_s.numeric?.should == true
10
+ end
11
+ end
12
+ end
13
+ context "with strings" do
14
+ it "should return false" do
15
+ ('a'..'zz').each do |x|
16
+ x.numeric?.should == false
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mindreframer-oxcelix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Giovanni Biczo
8
+ - Roman Heinrich
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-02-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ox
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 2.1.7
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 2.1.7
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubyzip
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.1.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.1.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: oga
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: A fast Excel 2007/2010 (.xlsx) file parser that returns a collection
99
+ of Matrix objects
100
+ email:
101
+ - roman.heinrich@gmail.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".gitignore"
107
+ - ".travis.yml"
108
+ - ".yardopts"
109
+ - CHANGES
110
+ - Gemfile
111
+ - History.md
112
+ - LICENSE
113
+ - README.md
114
+ - README.rdoc
115
+ - Rakefile
116
+ - lib/oxcelix.rb
117
+ - lib/oxcelix/cell.rb
118
+ - lib/oxcelix/cellhelper.rb
119
+ - lib/oxcelix/core_ext/ext.rb
120
+ - lib/oxcelix/nf.rb
121
+ - lib/oxcelix/numformats.rb
122
+ - lib/oxcelix/sax/comments.rb
123
+ - lib/oxcelix/sax/sharedstrings.rb
124
+ - lib/oxcelix/sax/styles.rb
125
+ - lib/oxcelix/sax/xlsheet.rb
126
+ - lib/oxcelix/sheet.rb
127
+ - lib/oxcelix/version.rb
128
+ - lib/oxcelix/workbook.rb
129
+ - oxcelix.gemspec
130
+ - spec/cell_spec.rb
131
+ - spec/fixnum_spec.rb
132
+ - spec/fixtures/shared_strings.xml
133
+ - spec/fixtures/test.xlsx
134
+ - spec/matrix_spec.rb
135
+ - spec/oxcelix_spec.rb
136
+ - spec/sax/shared_strings_spec.rb
137
+ - spec/spec_helper.rb
138
+ - spec/string_spec.rb
139
+ homepage: http://github.com/mindreframer/oxcelix
140
+ licenses:
141
+ - MIT
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 2.4.4
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: A fast Excel 2007/2010 file parser
163
+ test_files:
164
+ - spec/cell_spec.rb
165
+ - spec/fixnum_spec.rb
166
+ - spec/fixtures/shared_strings.xml
167
+ - spec/fixtures/test.xlsx
168
+ - spec/matrix_spec.rb
169
+ - spec/oxcelix_spec.rb
170
+ - spec/sax/shared_strings_spec.rb
171
+ - spec/spec_helper.rb
172
+ - spec/string_spec.rb