xmlss 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -2
- data/lib/xmlss/style/font.rb +12 -9
- data/lib/xmlss/version.rb +1 -1
- data/test/style/font_test.rb +12 -10
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -108,8 +108,9 @@ These classes define how a spreadsheet cells are styled.
|
|
108
108
|
* *italic*: bool, default: false
|
109
109
|
* *size*: int
|
110
110
|
* *strike_through*: bool, default: false
|
111
|
-
* *
|
112
|
-
* *
|
111
|
+
* *shadow*: bool, default: false
|
112
|
+
* *underline*: :single, :double, :single_accounting, :double_accounting
|
113
|
+
* *alignment*: :subscript, :superscript
|
113
114
|
|
114
115
|
=== Xmlss::Style::Interior
|
115
116
|
* *color*: hex string
|
data/lib/xmlss/style/font.rb
CHANGED
@@ -4,24 +4,25 @@ module Xmlss::Style
|
|
4
4
|
def xml
|
5
5
|
{ :node => :font,
|
6
6
|
:attributes => [
|
7
|
-
:bold, :color, :italic, :size,
|
8
|
-
:strike_through, :underline, :
|
7
|
+
:bold, :color, :italic, :size, :shadow,
|
8
|
+
:strike_through, :underline, :vertical_align
|
9
9
|
] }
|
10
10
|
end
|
11
11
|
|
12
12
|
include Enumeration
|
13
13
|
enum :underline, {
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
14
|
+
:single => 'Single',
|
15
|
+
:double => 'Double',
|
16
|
+
:single_accounting => 'SingleAccounting',
|
17
|
+
:double_accounting => 'DoubleAccounting'
|
17
18
|
}
|
18
19
|
enum :alignment, {
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:superscript => 2
|
20
|
+
:subscript => 'Subscript',
|
21
|
+
:superscript => 'Superscript'
|
22
22
|
}
|
23
|
+
alias_method :vertical_align, :alignment
|
23
24
|
|
24
|
-
attr_accessor :bold, :color, :italic, :size, :strike_through
|
25
|
+
attr_accessor :bold, :color, :italic, :size, :strike_through, :shadow
|
25
26
|
|
26
27
|
def initialize(attrs={})
|
27
28
|
self.bold = attrs[:bold] || false
|
@@ -29,6 +30,7 @@ module Xmlss::Style
|
|
29
30
|
self.italic = attrs[:italic] || false
|
30
31
|
self.size = attrs[:size]
|
31
32
|
self.strike_through = attrs[:strike_through] || false
|
33
|
+
self.shadow = attrs[:shadow] || false
|
32
34
|
self.underline = attrs[:underline]
|
33
35
|
self.alignment = attrs[:alignment]
|
34
36
|
end
|
@@ -36,6 +38,7 @@ module Xmlss::Style
|
|
36
38
|
def bold?; !!self.bold; end
|
37
39
|
def italic?; !!self.italic; end
|
38
40
|
def strike_through?; !!self.strike_through; end
|
41
|
+
def shadow?; !!self.shadow; end
|
39
42
|
|
40
43
|
end
|
41
44
|
end
|
data/lib/xmlss/version.rb
CHANGED
data/test/style/font_test.rb
CHANGED
@@ -8,9 +8,10 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
should_have_class_method :underline
|
10
10
|
{
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
11
|
+
:single => 'Single',
|
12
|
+
:double => 'Double',
|
13
|
+
:single_accounting => 'SingleAccounting',
|
14
|
+
:double_accounting => 'DoubleAccounting'
|
14
15
|
}.each do |underline, value|
|
15
16
|
should "provide the value for the '#{underline}' underline" do
|
16
17
|
assert_equal value, Xmlss::Style::Font.underline(underline)
|
@@ -19,18 +20,18 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
|
|
19
20
|
|
20
21
|
should_have_class_method :alignment
|
21
22
|
{
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:superscript => 2
|
23
|
+
:subscript => 'Subscript',
|
24
|
+
:superscript => 'Superscript'
|
25
25
|
}.each do |alignment, value|
|
26
26
|
should "provide the value for the '#{alignment}' alignment" do
|
27
27
|
assert_equal value, Xmlss::Style::Font.alignment(alignment)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
should_have_accessors :bold, :color, :italic, :size, :strike_through
|
31
|
+
should_have_accessors :bold, :color, :italic, :size, :strike_through, :shadow
|
32
32
|
should_have_accessors :underline, :alignment
|
33
|
-
should_have_instance_methods :bold?, :italic?, :strike_through?
|
33
|
+
should_have_instance_methods :bold?, :italic?, :strike_through?, :shadow?
|
34
|
+
should_have_reader :vertical_align
|
34
35
|
|
35
36
|
should "set it's defaults" do
|
36
37
|
assert_equal false, subject.bold
|
@@ -38,8 +39,9 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
|
|
38
39
|
assert_equal false, subject.italic
|
39
40
|
assert_equal nil, subject.size
|
40
41
|
assert_equal false, subject.strike_through
|
41
|
-
assert_equal
|
42
|
-
assert_equal
|
42
|
+
assert_equal false, subject.shadow
|
43
|
+
assert_equal nil, subject.underline
|
44
|
+
assert_equal nil, subject.alignment
|
43
45
|
end
|
44
46
|
|
45
47
|
context "that sets attributes at init" do
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|