ruby_speech 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d2f6765271223b5fc417d31f0900f66c1cdd366
4
- data.tar.gz: 3a416c4ee1c850fab6b7cde4a14d01060d725ed8
3
+ metadata.gz: f773e0cb875c8a40f62c2fbf8763293fc1666ff7
4
+ data.tar.gz: 7c54e1b650e3e9542740608f108a7455c7625e9c
5
5
  SHA512:
6
- metadata.gz: 0e18c6d6732eb36965c454cd9e432ac0057b03104251a550494c237df86b5304fc18e51b8ff956875ae39b23d7df6ffce7462b43f9d5454f980a39ca58d91f8d
7
- data.tar.gz: 94a964e21a7b6cf4dec062462855ef28e1c889e14413cee7d2e1cf6cbecc8a138782e0a6330cd97cf4a5ff8c72360e00601c61112fdc776afe0e32fee9bc80a8
6
+ metadata.gz: 31b7e25e0214bf2738601217c0a417c308c8057a5a109f39eaa80632dbfc9fc7423122ac9dc7e7c2de665b4a6be4fe563338749f0d4093fb648246dad27656b2
7
+ data.tar.gz: 5140d70c2c151201ffe5fe75e14653292944111470f86caa483d4fee774fc0f92d21ddea656f62f722e95482deba0da8e6fb16e5652b3bcb4cc76041bf956392
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ doc
10
10
  .*.swp
11
11
  vendor
12
12
  tmp/
13
+ coverage
@@ -1,5 +1,8 @@
1
1
  # [develop](https://github.com/benlangfeld/ruby_speech)
2
2
 
3
+ # [2.2.2](https://github.com/benlangfeld/ruby_speech/compare/v2.2.1...v2.2.2) - [2013-09-03](https://rubygems.org/gems/ruby_speech/versions/2.2.2)
4
+ * Bugfix: Fix an exception message to include object type
5
+
3
6
  # [2.2.1](https://github.com/benlangfeld/ruby_speech/compare/v2.2.0...v2.2.1) - [2013-07-02](https://rubygems.org/gems/ruby_speech/versions/2.2.1)
4
7
  * Bugfix: Ensure that concatenating documents doesn't mutate the originals on JRuby
5
8
 
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/ruby_speech.png)](https://rubygems.org/gems/ruby_speech)
2
+ [![Build Status](https://secure.travis-ci.org/benlangfeld/ruby_speech.png?branch=develop)](http://travis-ci.org/benlangfeld/ruby_speech)
3
+ [![Dependency Status](https://gemnasium.com/benlangfeld/ruby_speech.png?travis)](https://gemnasium.com/benlangfeld/ruby_speech)
4
+ [![Code Climate](https://codeclimate.com/github/benlangfeld/ruby_speech.png)](https://codeclimate.com/github/benlangfeld/ruby_speech)
5
+ [![Coverage Status](https://coveralls.io/repos/benlangfeld/ruby_speech/badge.png?branch=develop)](https://coveralls.io/r/benlangfeld/ruby_speech)
6
+
1
7
  # RubySpeech
2
8
  RubySpeech is a library for constructing and parsing Text to Speech (TTS) and Automatic Speech Recognition (ASR) documents such as [SSML](http://www.w3.org/TR/speech-synthesis), [GRXML](http://www.w3.org/TR/speech-grammar/) and [NLSML](http://www.w3.org/TR/nl-spec/). Such documents can be constructed to be processed by TTS and ASR engines, parsed as the result from such, or used in the implementation of such engines.
3
9
 
@@ -163,7 +163,7 @@ module RubySpeech
163
163
  when self.class.module::Element
164
164
  self << other
165
165
  else
166
- raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other}"
166
+ raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other.class}"
167
167
  end
168
168
  end
169
169
 
@@ -45,8 +45,7 @@ module RubySpeech
45
45
  # @raises ArgumentError if t is nota positive numeric value
46
46
  #
47
47
  def time=(t)
48
- raise ArgumentError, "You must specify a valid time (positive float value in seconds)" unless t.is_a?(Numeric) && t >= 0
49
- self[:time] = "#{t}s"
48
+ set_time_attribute :time, t
50
49
  end
51
50
 
52
51
  def <<(*args)
@@ -20,6 +20,13 @@ module RubySpeech
20
20
  def to_doc
21
21
  document
22
22
  end
23
+
24
+ private
25
+
26
+ def set_time_attribute(key, value)
27
+ raise ArgumentError, "You must specify a valid #{key} (positive float value in seconds)" unless value.is_a?(Numeric) && value >= 0
28
+ self[key] = "#{value}s"
29
+ end
23
30
  end # Element
24
31
  end # SSML
25
32
  end # RubySpeech
@@ -56,9 +56,7 @@ module RubySpeech
56
56
  # @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
57
57
  #
58
58
  def pitch=(p)
59
- hz = p.is_a?(String) && p.include?('Hz') && p.to_f > 0
60
- raise ArgumentError, "You must specify a valid pitch (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
61
- self[:pitch] = p
59
+ set_frequency_attribute :pitch, p
62
60
  end
63
61
 
64
62
  ##
@@ -100,9 +98,7 @@ module RubySpeech
100
98
  # @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
101
99
  #
102
100
  def range=(p)
103
- hz = p.is_a?(String) && p.include?('Hz') && p.to_f > 0
104
- raise ArgumentError, "You must specify a valid range (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
105
- self[:range] = p
101
+ set_frequency_attribute :range, p
106
102
  end
107
103
 
108
104
  ##
@@ -145,8 +141,7 @@ module RubySpeech
145
141
  # @raises ArgumentError if t is not a positive numeric value
146
142
  #
147
143
  def duration=(t)
148
- raise ArgumentError, "You must specify a valid duration (positive float value in seconds)" unless t.is_a?(Numeric) && t >= 0
149
- self[:duration] = "#{t}s"
144
+ set_time_attribute :duration, t
150
145
  end
151
146
 
152
147
  ##
@@ -182,6 +177,14 @@ module RubySpeech
182
177
  def eql?(o)
183
178
  super o, :pitch, :contour, :range, :rate, :duration, :volume
184
179
  end
180
+
181
+ private
182
+
183
+ def set_frequency_attribute(key, value)
184
+ hz = value.is_a?(String) && value.include?('Hz') && value.to_f > 0
185
+ raise ArgumentError, "You must specify a valid #{key} (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(value)
186
+ self[key] = value
187
+ end
185
188
  end # Prosody
186
189
  end # SSML
187
190
  end # RubySpeech
@@ -1,3 +1,3 @@
1
1
  module RubySpeech
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
@@ -38,4 +38,5 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency %q<ruby_gntp>, [">= 0"]
39
39
  s.add_development_dependency %q<guard-rake>, [">= 0"]
40
40
  s.add_development_dependency %q<rake-compiler>, [">= 0"]
41
+ s.add_development_dependency %q<coveralls>, [">= 0"]
41
42
  end
@@ -1,5 +1,8 @@
1
1
  require 'ruby_speech'
2
2
 
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
3
6
  Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
4
7
 
5
8
  schema_file_path = File.expand_path File.join(__FILE__, '../../assets/synthesis.xsd')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Langfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-02 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -184,6 +184,20 @@ dependencies:
184
184
  - - '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
+ - !ruby/object:Gem::Dependency
188
+ name: coveralls
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - '>='
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
187
201
  description: Prepare SSML and GRXML documents with ease
188
202
  email:
189
203
  - ben@langfeld.me