-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Fix handling of millisecond values (#48) #49
Conversation
2 similar comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to my eye 👍
Nicely done, thank you James! 👍
else | ||
value.to_f | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
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" | ||
self[key] = value == value.round ? "#{value.to_i}s" : "#{(value * 1000).to_i}ms" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nicely done 👌
When trying an SSML Break time of 0.5 under Adhearsion, FreeSWITCH treats this as 0 seconds. This makes some sense as the spec does not say that you can pass fractional seconds, only whole seconds or milliseconds with the appropriate suffix. This change adds the appropriate suffix when rendering XML and converts back to seconds again when reading XML.
e88c85f
to
b319b70
Compare
2 similar comments
Guys, any chance we could cut a new release with this fix? We need it in production but we're using JRuby and perhaps I'm being stupid but when installing from git, Bundler always gets the platform wrong. It either doesn't build native extensions at all or tries to build the C versions. |
I'm totally in favor 👍 FYI, if it helps, the only way I've successfully deployed a ruby_speech fork is by forcefully adding That reminds me (oops) can you add an entry related to this ms fix to the CHANGELOG.md? |
@benlangfeld, @bklang, the boss is asking where this fix is. I would push a new release myself if I could but I guess only you guys can? Pretty please? |
LGTM but I do not have release privileges on this one. |
I’ll push a release when I get back to my computer in a few hours. I’ll also give you both access to do so. |
Awesome, thanks very much. I'll be putting it into action on Monday. |
https://rubygems.org/gems/ruby_speech/versions/2.4.0 You both have release permission; for punchblock and adhearsion also. |
When trying an SSML Break time of 0.5 under Adhearsion, FreeSWITCH
treats this as 0 seconds. This makes some sense as the spec does not
say that you can pass fractional seconds, only whole seconds or
milliseconds with the appropriate suffix.
This change adds the appropriate suffix when rendering XML and
converts back to seconds again when reading XML.