spreadsheet 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### 0.9.3 / 12.11.2013
2
+
3
+ commit e15d8b45d7587f7ab78c7b7768de720de9961341 (refs/remotes/gguerrero/master)
4
+ Author: Guillermo Guerrero <g.guerrero.bus@gmail.com>
5
+ Date: Tue Nov 12 11:50:30 2013 +0100
6
+
7
+ * Refactor update_format for cloning format objects
8
+ * Added lib/spreadsheet/note.rb to Manifest.txt file
9
+ * 'update_format' methods now receive a hash of key => values to update
10
+
11
+ Author: Przemysław Ciąćka <przemyslaw.ciacka@gmail.com>
12
+ Date: Tue Nov 12 00:07:57 2013 +0100
13
+
14
+ * Added lib/spreadsheet/note.rb to Manifest.txt file
15
+
1
16
  ### 0.9.2 / 11.11.2013
2
17
 
3
18
  commit e70dc0dbbc966ce312b45b0d44d0c3b1dc10aad6
data/Manifest.txt CHANGED
@@ -43,6 +43,7 @@ lib/spreadsheet/format.rb
43
43
  lib/spreadsheet/formula.rb
44
44
  lib/spreadsheet/helpers.rb
45
45
  lib/spreadsheet/link.rb
46
+ lib/spreadsheet/note.rb
46
47
  lib/spreadsheet/row.rb
47
48
  lib/spreadsheet/workbook.rb
48
49
  lib/spreadsheet/worksheet.rb
data/lib/spreadsheet.rb CHANGED
@@ -43,7 +43,7 @@ module Spreadsheet
43
43
 
44
44
  ##
45
45
  # The version of Spreadsheet you are using.
46
- VERSION = '0.9.2'
46
+ VERSION = '0.9.3'
47
47
 
48
48
  ##
49
49
  # Default client Encoding. Change this value if your application uses a
@@ -107,18 +107,22 @@ module Spreadsheet
107
107
  :time => Regexp.new(client("[hms]", 'UTF-8')),
108
108
  :number => Regexp.new(client("[\#]", 'UTF-8'))
109
109
  }
110
+
110
111
  # Temp code to prevent merged formats in non-merged cells.
111
- @used_merge = 0
112
- opts.each do |key, val|
113
- writer = "#{key}="
114
- if @font.respond_to? writer
115
- @font.send writer, val
116
- else
117
- self.send writer, val
118
- end
119
- end
112
+ @used_merge = 0
113
+ update_format(opts)
114
+
120
115
  yield self if block_given?
121
116
  end
117
+
118
+ def update_format(opts = {})
119
+ opts.each do |attribute, value|
120
+ writer = "#{attribute}="
121
+ @font.respond_to?(writer) ? @font.send(writer,value) : self.send(writer, value)
122
+ end
123
+ self
124
+ end
125
+
122
126
  ##
123
127
  # Combined method for both horizontal and vertical alignment. Sets the
124
128
  # first valid value (e.g. Format#align = :justify only sets the horizontal
@@ -0,0 +1,23 @@
1
+ require 'spreadsheet/encodings'
2
+
3
+ module Spreadsheet
4
+ ##
5
+ # The Note class is a Subclass of String and represents a comment/note/annotation
6
+ # someone made to a cell.
7
+ #
8
+ #
9
+ # Interesting Attributes
10
+ # #author :: The name of the author who wrote the note
11
+ class Note
12
+ include Encodings
13
+ attr_accessor :author, :length, :objID, :row, :col, :text
14
+ def initialize
15
+ @author = nil
16
+ @length = 0
17
+ @objID = nil
18
+ @row = -1
19
+ @col = -1
20
+ @text = ""
21
+ end
22
+ end
23
+ end
@@ -128,6 +128,19 @@ module Spreadsheet
128
128
  @worksheet.row_updated @idx, self if @worksheet
129
129
  fmt
130
130
  end
131
+
132
+ def update_format(idx, opts = {})
133
+ if @formats[idx]
134
+ @formats[idx].update_format(opts)
135
+ else
136
+ fmt = default_format.clone
137
+ fmt.font = fmt.font.clone
138
+ @formats[idx] = fmt.update_format(opts)
139
+ end
140
+ @worksheet.add_format @formats[idx]
141
+ @worksheet.row_updated @idx, self if @worksheet
142
+ end
143
+
131
144
  private
132
145
  def index_of_first ary # :nodoc:
133
146
  if first = ary.find do |elm| !elm.nil? end
data/spreadsheet.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = "spreadsheet"
3
- s.version = "0.9.2"
3
+ s.version = "0.9.3"
4
4
  s.summary = "The Spreadsheet Library is designed to read and write Spreadsheet Documents"
5
5
  s.description = "As of version 0.6.0, only Microsoft Excel compatible spreadsheets are supported"
6
6
  s.author = "Masaomi Hatakeyama, Zeno R.R. Davatz"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-11 00:00:00.000000000 Z
12
+ date: 2013-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-ole
@@ -114,6 +114,7 @@ files:
114
114
  - lib/spreadsheet/formula.rb
115
115
  - lib/spreadsheet/helpers.rb
116
116
  - lib/spreadsheet/link.rb
117
+ - lib/spreadsheet/note.rb
117
118
  - lib/spreadsheet/row.rb
118
119
  - lib/spreadsheet/workbook.rb
119
120
  - lib/spreadsheet/worksheet.rb