Method: BotFramework::Entity#initialize

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

#initialize(attributes = {}) ⇒ Entity

Initializes the object

Parameters:

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

    Model attributes in the form of hash



17
18
19
20
21
22
23
24
# File 'lib/bot_framework/models/entity.rb', line 17

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.type = attributes[:type] if attributes.key?(:type)
end