ruby_speech 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.2.1
2
+ Bugfix: SSML element's children now include any text content, and text content is copied when importing/concatenating documents
3
+
1
4
  # 0.2.0
2
5
  Feature: SSML elements can now be imported from a Nokogiri Node or a string
3
6
  Feature: SSML elements now respond to #children with an array of SSML elements, rather than a Nokogiri NodeSet
@@ -37,8 +37,9 @@ module RubySpeech
37
37
  # @param [XML::Node] node the node to import
38
38
  # @return the appropriate object based on the node name and namespace
39
39
  def self.import(node)
40
+ return node.content if node.is_a?(Nokogiri::XML::Text)
40
41
  klass = class_from_registration(node.element_name)
41
- event = if klass && klass != self
42
+ if klass && klass != self
42
43
  klass.import node
43
44
  else
44
45
  new.inherit node
@@ -66,7 +67,7 @@ module RubySpeech
66
67
  end
67
68
 
68
69
  def children
69
- super.reject { |c| c.is_a?(Nokogiri::XML::Text) }.map { |c| Element.import c }
70
+ super.map { |c| Element.import c }
70
71
  end
71
72
 
72
73
  def method_missing(method_name, *args, &block)
@@ -1,3 +1,3 @@
1
1
  module RubySpeech
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -160,10 +160,12 @@ module RubySpeech
160
160
  speak1 = Speak.new
161
161
  speak1 << Voice.new(:name => 'frank', :content => "Hi, I'm Frank")
162
162
  speak2 = Speak.new
163
+ speak2 << "Hello there"
163
164
  speak2 << Voice.new(:name => 'millie', :content => "Hi, I'm Millie")
164
165
 
165
166
  expected_concat = Speak.new
166
167
  expected_concat << Voice.new(:name => 'frank', :content => "Hi, I'm Frank")
168
+ expected_concat << "Hello there"
167
169
  expected_concat << Voice.new(:name => 'millie', :content => "Hi, I'm Millie")
168
170
 
169
171
  concat = (speak1 + speak2)
@@ -160,9 +160,11 @@ module RubySpeech
160
160
  end
161
161
 
162
162
  describe "importing nested tags" do
163
+ let(:say_as) { SSML::SayAs.new :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960" }
164
+ let(:string) { "Hi, I'm Fred. The time is currently " }
163
165
  let :voice do
164
- SSML::Voice.new(:gender => :male, :name => 'fred', :content => "Hi, I'm Fred. The time is currently ").tap do |voice|
165
- voice << SSML::SayAs.new(:interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
166
+ SSML::Voice.new(:gender => :male, :name => 'fred', :content => string).tap do |voice|
167
+ voice << say_as
166
168
  end
167
169
  end
168
170
 
@@ -170,7 +172,9 @@ module RubySpeech
170
172
  SSML::Speak.new.tap { |doc| doc << voice }.to_s
171
173
  end
172
174
 
173
- subject { SSML::Element.import parse_xml(document).root }
175
+ let(:import) { SSML::Element.import parse_xml(document).root }
176
+
177
+ subject { import }
174
178
 
175
179
  it "should work" do
176
180
  lambda { subject }.should_not raise_error
@@ -179,6 +183,12 @@ module RubySpeech
179
183
  it { should be_a SSML::Speak }
180
184
 
181
185
  its(:children) { should == [voice] }
186
+
187
+ describe "voice" do
188
+ subject { import.children.first }
189
+
190
+ its(:children) { should == [string, say_as] }
191
+ end
182
192
  end
183
193
  end
184
194
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-26 00:00:00.000000000 +01:00
12
+ date: 2011-08-30 00:00:00.000000000 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: niceogiri
17
- requirement: &2152713180 !ruby/object:Gem::Requirement
17
+ requirement: &2160574820 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.0.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152713180
25
+ version_requirements: *2160574820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &2152712660 !ruby/object:Gem::Requirement
28
+ requirement: &2160574300 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.7
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152712660
36
+ version_requirements: *2160574300
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2152712180 !ruby/object:Gem::Requirement
39
+ requirement: &2160573820 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2152712180
47
+ version_requirements: *2160573820
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &2152711700 !ruby/object:Gem::Requirement
50
+ requirement: &2160573340 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.3.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2152711700
58
+ version_requirements: *2160573340
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: ci_reporter
61
- requirement: &2152711220 !ruby/object:Gem::Requirement
61
+ requirement: &2160572860 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.6.3
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2152711220
69
+ version_requirements: *2160572860
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: yard
72
- requirement: &2152710740 !ruby/object:Gem::Requirement
72
+ requirement: &2160572380 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.7.0
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2152710740
80
+ version_requirements: *2160572380
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rake
83
- requirement: &2152710260 !ruby/object:Gem::Requirement
83
+ requirement: &2160571900 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2152710260
91
+ version_requirements: *2160571900
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: mocha
94
- requirement: &2152709780 !ruby/object:Gem::Requirement
94
+ requirement: &2160571420 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2152709780
102
+ version_requirements: *2160571420
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: i18n
105
- requirement: &2152709300 !ruby/object:Gem::Requirement
105
+ requirement: &2160570940 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *2152709300
113
+ version_requirements: *2160570940
114
114
  description: Prepare SSML and GRXML documents with ease
115
115
  email:
116
116
  - ben@langfeld.me