Skip to content

Commit

Permalink
Merge branch 'release/2.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
benlangfeld committed Sep 3, 2013
2 parents d907085 + 279cbb6 commit efea1f7
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ doc
.*.swp
vendor
tmp/
coverage
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# [develop](https://github.com/benlangfeld/ruby_speech)

# [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)
* Bugfix: Fix an exception message to include object type

# [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)
* Bugfix: Ensure that concatenating documents doesn't mutate the originals on JRuby

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[![Gem Version](https://badge.fury.io/rb/ruby_speech.png)](https://rubygems.org/gems/ruby_speech)
[![Build Status](https://secure.travis-ci.org/benlangfeld/ruby_speech.png?branch=develop)](http://travis-ci.org/benlangfeld/ruby_speech)
[![Dependency Status](https://gemnasium.com/benlangfeld/ruby_speech.png?travis)](https://gemnasium.com/benlangfeld/ruby_speech)
[![Code Climate](https://codeclimate.com/github/benlangfeld/ruby_speech.png)](https://codeclimate.com/github/benlangfeld/ruby_speech)
[![Coverage Status](https://coveralls.io/repos/benlangfeld/ruby_speech/badge.png?branch=develop)](https://coveralls.io/r/benlangfeld/ruby_speech)

# RubySpeech
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.

Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_speech/generic_element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def embed(other)
when self.class.module::Element
self << other
else
raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other}"
raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other.class}"
end
end

Expand Down
3 changes: 1 addition & 2 deletions lib/ruby_speech/ssml/break.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def time
# @raises ArgumentError if t is nota positive numeric value
#
def time=(t)
raise ArgumentError, "You must specify a valid time (positive float value in seconds)" unless t.is_a?(Numeric) && t >= 0
self[:time] = "#{t}s"
set_time_attribute :time, t
end

def <<(*args)
Expand Down
7 changes: 7 additions & 0 deletions lib/ruby_speech/ssml/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ def self.module
def to_doc
document
end

private

def set_time_attribute(key, value)
raise ArgumentError, "You must specify a valid #{key} (positive float value in seconds)" unless value.is_a?(Numeric) && value >= 0
self[key] = "#{value}s"
end
end # Element
end # SSML
end # RubySpeech
19 changes: 11 additions & 8 deletions lib/ruby_speech/ssml/prosody.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def pitch
# @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
#
def pitch=(p)
hz = p.is_a?(String) && p.include?('Hz') && p.to_f > 0
raise ArgumentError, "You must specify a valid pitch (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
self[:pitch] = p
set_frequency_attribute :pitch, p
end

##
Expand Down Expand Up @@ -100,9 +98,7 @@ def range
# @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
#
def range=(p)
hz = p.is_a?(String) && p.include?('Hz') && p.to_f > 0
raise ArgumentError, "You must specify a valid range (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
self[:range] = p
set_frequency_attribute :range, p
end

##
Expand Down Expand Up @@ -145,8 +141,7 @@ def duration
# @raises ArgumentError if t is not a positive numeric value
#
def duration=(t)
raise ArgumentError, "You must specify a valid duration (positive float value in seconds)" unless t.is_a?(Numeric) && t >= 0
self[:duration] = "#{t}s"
set_time_attribute :duration, t
end

##
Expand Down Expand Up @@ -182,6 +177,14 @@ def <<(arg)
def eql?(o)
super o, :pitch, :contour, :range, :rate, :duration, :volume
end

private

def set_frequency_attribute(key, value)
hz = value.is_a?(String) && value.include?('Hz') && value.to_f > 0
raise ArgumentError, "You must specify a valid #{key} (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(value)
self[key] = value
end
end # Prosody
end # SSML
end # RubySpeech
2 changes: 1 addition & 1 deletion lib/ruby_speech/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RubySpeech
VERSION = "2.2.1"
VERSION = "2.2.2"
end
1 change: 1 addition & 0 deletions ruby_speech.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Gem::Specification.new do |s|
s.add_development_dependency %q<ruby_gntp>, [">= 0"]
s.add_development_dependency %q<guard-rake>, [">= 0"]
s.add_development_dependency %q<rake-compiler>, [">= 0"]
s.add_development_dependency %q<coveralls>, [">= 0"]
end
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require 'ruby_speech'

require 'coveralls'
Coveralls.wear!

Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

schema_file_path = File.expand_path File.join(__FILE__, '../../assets/synthesis.xsd')
Expand Down

0 comments on commit efea1f7

Please sign in to comment.