Method: BotFramework::Fact#initialize

Defined in:
lib/bot_framework/models/fact.rb

#initialize(attributes = {}) ⇒ Fact

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



18
19
20
21
22
23
24
25
26
27
# File 'lib/bot_framework/models/fact.rb', line 18

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.key = attributes[:key] if attributes.key?(:key)

  self.value = attributes[:value] if attributes.key?(:value)
end