Class: Aws::Lex::Conversation::Type::Slot

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/aws/lex/conversation/type/slot.rb

Instance Method Summary collapse

Methods included from Base

included

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/aws/lex/conversation/type/slot.rb', line 60

def active?
  @active
end

#blank?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/aws/lex/conversation/type/slot.rb', line 68

def blank?
  !filled?
end

#filled?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


84
85
86
# File 'lib/aws/lex/conversation/type/slot.rb', line 84

def requestable?
  active? && blank?
end

#resolvable?Boolean

Returns:

  • (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_lexObject



22
23
24
# File 'lib/aws/lex/conversation/type/slot.rb', line 22

def to_lex
  super.merge(extra_response_attributes)
end

#valueObject

Raises:

  • (TypeError)


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

Raises:

  • (TypeError)


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

#valuesObject

Raises:

  • (TypeError)


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

Raises:

  • (TypeError)


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