Class: AgentXmpp::View

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_xmpp/app/view.rb

Overview


Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, format, params) ⇒ View

.….….….….….….….….….….….….….….….….….….….….….….….….….….



12
13
14
15
16
# File 'lib/agent_xmpp/app/view.rb', line 12

def initialize(connection, format, params)
  @connection = connection
  @format = format
  @params = params
end

Instance Attribute Details

#connectionObject (readonly)




8
9
10
# File 'lib/agent_xmpp/app/view.rb', line 8

def connection
  @connection
end

#formatObject (readonly)




8
9
10
# File 'lib/agent_xmpp/app/view.rb', line 8

def format
  @format
end

#paramsObject (readonly)




8
9
10
# File 'lib/agent_xmpp/app/view.rb', line 8

def params
  @params
end

Instance Method Details

#add_payload_to_container(payload) ⇒ Object

.….….….….….….….….….….….….….….….….….….….….….….….….….….



19
20
21
22
23
24
25
# File 'lib/agent_xmpp/app/view.rb', line 19

def add_payload_to_container(payload)
  container_type = case format.xmlns
    when 'jabber:x:data' then :add_x_data_to_container
    when 'message:chat'  then :add_chat_message_body_container
  end
  container_type.nil? ? nil : send(container_type, payload)
end