Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a private method of CallScope#formatted_digits.

Takes an option of :finish_on_key in order to strip that key from the digits before returning it.

Also encapsulates existing logic to check for a nil value.
  • Loading branch information...
commit 6d56cbf3e51ad1770e483938825539c56a0c5e55 1 parent 9d4a8bf
Jon Gilbraith authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/twilio-test-toolkit/call_scope.rb
View
10 lib/twilio-test-toolkit/call_scope.rb
@@ -121,6 +121,16 @@ def get_gather_node
@xml.at_xpath("Gather")
end
+ def formatted_digits(digits, options = {})
+ if digits.nil?
+ ''
+ elsif options[:finish_on_key]
+ digits.split(options[:finish_on_key])[0]
+ else
+ digits
+ end
+ end
+
protected
# New object creation
def self.from_xml(parent, xml)
Please sign in to comment.
Something went wrong with that request. Please try again.