Class: Aws::Lex::Conversation::Type::Slot
- Inherits:
-
Object
- Object
- Aws::Lex::Conversation::Type::Slot
- Includes:
- Base
- Defined in:
- lib/aws/lex/conversation/type/slot.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #blank? ⇒ Boolean
- #filled? ⇒ Boolean
- #requestable? ⇒ Boolean
- #resolvable? ⇒ Boolean
- #resolve!(index: 0) ⇒ Object
- #to_lex ⇒ Object
- #value ⇒ Object
- #value=(val) ⇒ Object
- #values ⇒ Object
-
#values=(vals) ⇒ Object
takes an array of slot values.
Methods included from Base
Instance Method Details
#active? ⇒ Boolean
60 61 62 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 60 def active? @active end |
#blank? ⇒ Boolean
68 69 70 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 68 def blank? !filled? end |
#filled? ⇒ Boolean
64 65 66 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 64 def filled? shape.list? ? values.any? : value != '' && !value.nil? end |
#requestable? ⇒ Boolean
84 85 86 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 84 def requestable? active? && blank? end |
#resolvable? ⇒ Boolean
78 79 80 81 82 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 78 def resolvable? return false if shape.list? lex_value.resolvable? end |
#resolve!(index: 0) ⇒ Object
72 73 74 75 76 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 72 def resolve!(index: 0) return if shape.list? lex_value.resolve!(index: index) end |
#to_lex ⇒ Object
22 23 24 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 22 def to_lex super.merge(extra_response_attributes) end |
#value ⇒ Object
32 33 34 35 36 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 32 def value raise TypeError, 'use values for List-type slots' if shape.list? lex_value&.interpreted_value end |
#value=(val) ⇒ Object
26 27 28 29 30 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 26 def value=(val) raise TypeError, 'use values= for List-type slots' if shape.list? lex_value.interpreted_value = val end |
#values ⇒ Object
54 55 56 57 58 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 54 def values raise TypeError, 'use value for Scalar-type slots' if shape.scalar? lex_values.map(&:value) end |
#values=(vals) ⇒ Object
takes an array of slot values
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aws/lex/conversation/type/slot.rb', line 39 def values=(vals) raise TypeError, 'use value= for Scalar-type slots' if shape.scalar? self.lex_values = vals.map do |val| Slot.shrink_wrap( active: true, value: { interpretedValue: val, originalValue: val, resolvedValues: [val] } ) end end |