osheet 1.0.0.rc.3 → 1.0.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osheet (1.0.0.rc.3)
4
+ osheet (1.0.0.rc.4)
5
5
  enumeration (~> 1.3)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module Osheet
2
- VERSION = "1.0.0.rc.3"
2
+ VERSION = "1.0.0.rc.4"
3
3
  end
@@ -163,19 +163,21 @@ module Osheet::WorkbookApi
163
163
  # an elements style data and style_id.
164
164
 
165
165
  # used by: column, row, cell
166
- def style_class(value)
166
+ def style_class(value=nil)
167
167
  current_class = element_stack.current.style_class(value) # for self referencing
168
- if self.writer # for writing
168
+ if value && self.writer # for writing
169
169
  self.writer.style(current_class, element_stack.current.format)
170
170
  end
171
+ current_class
171
172
  end
172
173
 
173
174
  # used by: cell
174
175
  def format(*args)
175
- current_format = element_stack.current.format(*args) # for self referencing
176
- if self.writer # for writing
176
+ current_format = element_stack.current.format(*args) # for self referencing
177
+ if !args.empty? && self.writer # for writing
177
178
  self.writer.style(element_stack.current.style_class, current_format)
178
179
  end
180
+ current_format
179
181
  end
180
182
 
181
183
  # used by: workbook_element
@@ -198,10 +200,10 @@ module Osheet::WorkbookApi
198
200
  :colspan, # cell
199
201
  ].each do |meth|
200
202
  define_method(meth) do |*args|
201
- element_stack.current.send(meth, *args) # for self referencing
202
- if self.writer # for writing
203
+ if !args.empty? && self.writer # for writing
203
204
  self.writer.send(meth, *args)
204
205
  end
206
+ element_stack.current.send(meth, *args) # for self referencing
205
207
  end
206
208
  end
207
209
 
@@ -61,7 +61,7 @@ class TestWriter
61
61
  ].each do |meth|
62
62
  define_method(meth) do |*args|
63
63
  # cool story bro (don't do anything, just allow)
64
- return *args
64
+ return args
65
65
  end
66
66
  end
67
67
 
@@ -161,7 +161,7 @@ module Osheet
161
161
  }
162
162
  worksheet {
163
163
  name "two"
164
- meta :some_meta
164
+ meta :val => 'some meta', :wksht_name => self.name
165
165
  }
166
166
  }
167
167
  end
@@ -174,7 +174,7 @@ module Osheet
174
174
  assert_equal 2, subject.worksheets.size
175
175
  assert_equal "one", subject.worksheets.first.name
176
176
  assert_equal "two", subject.worksheets.last.name
177
- assert_equal :some_meta, subject.worksheets.last.meta
177
+ assert_equal({:val => 'some meta', :wksht_name => 'two'}, subject.worksheets.last.meta)
178
178
  end
179
179
 
180
180
  should "return the last worksheet added if called with no args" do
@@ -202,11 +202,13 @@ module Osheet
202
202
  }
203
203
  row(120) {
204
204
  cell {
205
- data 12234
205
+ style_class 'too awesome'
206
+ data self.style_class.to_s
206
207
  format :currency
207
208
  }
208
209
  cell(Time.now) {
209
210
  format :datetime, 'mm/dd/yyyy'
211
+ data self.format.key
210
212
  }
211
213
 
212
214
  }
@@ -232,10 +234,11 @@ module Osheet
232
234
 
233
235
  should "access the cells of its last row" do
234
236
  assert_equal 2, subject.cells.size
235
- assert_equal 12234, subject.cells.first.data
237
+ assert_equal 'too awesome', subject.cells.first.data
238
+ assert_equal 'datetime_mm/dd/yyyy', subject.cells.last.data
236
239
 
237
- assert_equal 4, subject.writer.cells.size
238
240
  assert_equal subject.cells.last, subject.writer.rows.last.cells.last
241
+ assert_equal 4, subject.writer.cells.size
239
242
  end
240
243
 
241
244
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osheet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424051
4
+ hash: 15424061
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 3
12
- version: 1.0.0.rc.3
11
+ - 4
12
+ version: 1.0.0.rc.4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Kelly Redding
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-18 00:00:00 Z
20
+ date: 2012-05-03 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  type: :development