spreadsheet 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,25 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem install bundler
4
+ script: "ruby -w ./test/suite.rb"
5
+ rvm:
6
+ - ruby-head
7
+ - 2.0.0
8
+ - 1.9.3
9
+ - 1.9.2
10
+ - 1.8.7
11
+ - rbx-19mode
12
+ - rbx-18mode
13
+ - jruby-head
14
+ - jruby-19mode
15
+ - jruby-18mode
16
+ - ree
17
+ matrix:
18
+ allow_failures:
19
+ - rvm: ruby-head
20
+ - rvm: rbx-19mode
21
+ - rvm: rbx-18mode
22
+ - rvm: jruby-head
23
+ - rvm: jruby-19mode
24
+ - rvm: jruby-18mode
25
+ - rvm: ree
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.8.1 / 18.02.2013
2
+
3
+ * Updated Manifest.txt to include lib/spreadsheet/excel/rgb.rb
4
+
1
5
  === 0.8.0 / 18.02.2013
2
6
 
3
7
  * Adding support for converting color palette values to RGB values (not vice-versa..yet)
data/Manifest.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  .gitignore
2
+ .travis.yml
2
3
  GUIDE.txt
3
4
  Gemfile
4
5
  Gemfile.lock
@@ -26,6 +27,7 @@ lib/spreadsheet/excel/password_hash.rb
26
27
  lib/spreadsheet/excel/reader.rb
27
28
  lib/spreadsheet/excel/reader/biff5.rb
28
29
  lib/spreadsheet/excel/reader/biff8.rb
30
+ lib/spreadsheet/excel/rgb.rb
29
31
  lib/spreadsheet/excel/row.rb
30
32
  lib/spreadsheet/excel/sst_entry.rb
31
33
  lib/spreadsheet/excel/workbook.rb
@@ -0,0 +1,122 @@
1
+ # A quick and dirty class for converting color palette values to RGB values.
2
+ # The values below have the form 0xRRGGBB, where RR is the red level, GG the
3
+ # green level, and BB the blue level. Each level is a value from 0 to 255,
4
+ # just as one would expect in HTML markup.
5
+
6
+ # Future directions may include:
7
+ # - support for mapping RGB values to "best fit" palette values
8
+ #
9
+ # by Dan Caugherty https://github.com/dancaugherty/spreadsheet/compare/master...rgb
10
+
11
+ module Spreadsheet
12
+ module Excel
13
+ class Rgb
14
+ attr_accessor :r, :g, :b
15
+
16
+ @@RGB_MAP = {
17
+ :xls_color_0 => 0x000000,
18
+ :xls_color_1 => 0xffffff,
19
+ :xls_color_2 => 0xff0000,
20
+ :xls_color_3 => 0x00ff00,
21
+ :xls_color_4 => 0x0000ff,
22
+ :xls_color_5 => 0xffff00,
23
+ :xls_color_6 => 0xff00ff,
24
+ :xls_color_7 => 0x00ffff,
25
+ :xls_color_8 => 0x800000,
26
+ :xls_color_9 => 0x008000,
27
+ :xls_color_10 => 0x008000,
28
+ :xls_color_11 => 0x000080,
29
+ :xls_color_12 => 0x808080,
30
+ :xls_color_13 => 0x008080,
31
+ :xls_color_14 => 0xc0c0c0,
32
+ :xls_color_15 => 0x808080,
33
+ :xls_color_16 => 0x9999ff,
34
+ :xls_color_17 => 0x993366,
35
+ :xls_color_18 => 0xffffcc,
36
+ :xls_color_19 => 0xccffff,
37
+ :xls_color_20 => 0x660066,
38
+ :xls_color_21 => 0xff8080,
39
+ :xls_color_22 => 0x0066cc,
40
+ :xls_color_23 => 0xccccff,
41
+ :xls_color_24 => 0x000080,
42
+ :xls_color_25 => 0xff00ff,
43
+ :xls_color_26 => 0xffff00,
44
+ :xls_color_27 => 0x00ffff,
45
+ :xls_color_28 => 0x800080,
46
+ :xls_color_29 => 0x800000,
47
+ :xls_color_30 => 0x008080,
48
+ :xls_color_31 => 0x0000ff,
49
+ :xls_color_32 => 0x00ccff,
50
+ :xls_color_33 => 0xccffff,
51
+ :xls_color_34 => 0xccffcc,
52
+ :xls_color_35 => 0xffff99,
53
+ :xls_color_36 => 0x99ccff,
54
+ :xls_color_37 => 0xff99cc,
55
+ :xls_color_38 => 0xcc99ff,
56
+ :xls_color_39 => 0xffcc99,
57
+ :xls_color_40 => 0x3366ff,
58
+ :xls_color_41 => 0x33cccc,
59
+ :xls_color_42 => 0x99cc00,
60
+ :xls_color_43 => 0xffcc00,
61
+ :xls_color_44 => 0xff9900,
62
+ :xls_color_45 => 0xff6600,
63
+ :xls_color_46 => 0x666699,
64
+ :xls_color_47 => 0x969696,
65
+ :xls_color_48 => 0x003366,
66
+ :xls_color_49 => 0x339966,
67
+ :xls_color_50 => 0x003300,
68
+ :xls_color_51 => 0x333300,
69
+ :xls_color_52 => 0x993300,
70
+ :xls_color_53 => 0x993366,
71
+ :xls_color_54 => 0x333399,
72
+ :xls_color_55 => 0x333333,
73
+ :builtin_black => 0x000000,
74
+ :builtin_white => 0xffffff,
75
+ :builtin_red => 0xff0000,
76
+ :builtin_green => 0x00ff00,
77
+ :builtin_blue => 0x0000ff,
78
+ :builtin_yellow => 0xffff00,
79
+ :builtin_magenta => 0xff00ff,
80
+ :builtin_cyan => 0x00ffff,
81
+ :aqua => 0x00ffff,
82
+ :black => 0x000000,
83
+ :blue => 0x0000ff,
84
+ :cyan => 0x00ffff,
85
+ :brown => 0x800000,
86
+ :fuchsia => 0xff00ff,
87
+ :gray => 0x808080,
88
+ :grey => 0x808080,
89
+ :green => 0x008000,
90
+ :lime => 0x00ff00,
91
+ :magenta => 0xff00ff,
92
+ :navy => 0x000080,
93
+ :orange => 0xff9900,
94
+ :purple => 0x800080,
95
+ :red => 0xff0000,
96
+ :silver => 0xc0c0c0,
97
+ :white => 0xffffff,
98
+ :yellow => 0xffff00
99
+ }
100
+
101
+ def self.to_rgb color_symbol
102
+ col = @@RGB_MAP[color_symbol]
103
+ return Rgb.new(col >> 16, (col & 0xff00) >> 8, col & 0xff) if col
104
+ nil
105
+ end
106
+
107
+ def initialize(r,g,b)
108
+ @r = r & 0xff
109
+ @g = g & 0xff
110
+ @b = b & 0xff
111
+ end
112
+
113
+ def to_i
114
+ (r * (256 * 256)) + (g * 256) + b
115
+ end
116
+
117
+ def as_hex
118
+ to_i.to_s(16)
119
+ end
120
+ end
121
+ end
122
+ end
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.8.0'
46
+ VERSION = '0.8.1'
47
47
 
48
48
  ##
49
49
  # Default client Encoding. Change this value if your application uses a
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.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-ole
16
- requirement: &16653180 !ruby/object:Gem::Requirement
16
+ requirement: &10733540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16653180
24
+ version_requirements: *10733540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &16652620 !ruby/object:Gem::Requirement
27
+ requirement: &10733120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *16652620
35
+ version_requirements: *10733120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &16652200 !ruby/object:Gem::Requirement
38
+ requirement: &10732560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.13'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *16652200
46
+ version_requirements: *10732560
47
47
  description: ! 'The Spreadsheet Library is designed to read and write Spreadsheet
48
48
  Documents.
49
49
 
@@ -67,6 +67,7 @@ extra_rdoc_files:
67
67
  - README.txt
68
68
  files:
69
69
  - .gitignore
70
+ - .travis.yml
70
71
  - GUIDE.txt
71
72
  - Gemfile
72
73
  - Gemfile.lock
@@ -94,6 +95,7 @@ files:
94
95
  - lib/spreadsheet/excel/reader.rb
95
96
  - lib/spreadsheet/excel/reader/biff5.rb
96
97
  - lib/spreadsheet/excel/reader/biff8.rb
98
+ - lib/spreadsheet/excel/rgb.rb
97
99
  - lib/spreadsheet/excel/row.rb
98
100
  - lib/spreadsheet/excel/sst_entry.rb
99
101
  - lib/spreadsheet/excel/workbook.rb