Class: Twilio::Rails::Phone::Tree::After
- Inherits:
-
Object
- Object
- Twilio::Rails::Phone::Tree::After
- Defined in:
- lib/twilio/rails/phone/tree.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#proc ⇒ Object
readonly
Returns the value of attribute proc.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Instance Method Summary collapse
- #hangup? ⇒ Boolean
-
#initialize(args) ⇒ After
constructor
A new instance of After.
Constructor Details
#initialize(args) ⇒ After
Returns a new instance of After.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/twilio/rails/phone/tree.rb', line 58 def initialize(args) case args when Symbol, String @prompt = args.to_sym when Proc @proc = args when Hash args = args.with_indifferent_access @prompt = args[:prompt]&.to_sym @hangup = !!args[:hangup] @messages = if args[:message].is_a?(Proc) args[:message] else Twilio::Rails::Phone::Tree::MessageSet.new(args[:message]) end raise Twilio::Rails::Phone::InvalidTreeError, "cannot have both prompt: and hangup:" if @prompt && @hangup raise Twilio::Rails::Phone::InvalidTreeError, "must have either prompt: or hangup:" unless @prompt || @hangup else raise Twilio::Rails::Phone::InvalidTreeError, "cannot parse :after from #{args.inspect}" end end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
56 57 58 |
# File 'lib/twilio/rails/phone/tree.rb', line 56 def @messages end |
#proc ⇒ Object (readonly)
Returns the value of attribute proc.
56 57 58 |
# File 'lib/twilio/rails/phone/tree.rb', line 56 def proc @proc end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
56 57 58 |
# File 'lib/twilio/rails/phone/tree.rb', line 56 def prompt @prompt end |
Instance Method Details
#hangup? ⇒ Boolean
82 83 84 |
# File 'lib/twilio/rails/phone/tree.rb', line 82 def hangup? !!@hangup end |