Sha256: 490186fa93ed068af1f64d6c4119cbcc41c831ee6fc344ac80fbf444859294db

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

new({ particle: :connection, category: :communication, type: :hash }) do |params, bloc|

  # FIXME :  html method shouldn't be here
  html.connect(params, &bloc)
end

new({ particle: :message, category: :communication, type: :hash }) do |params, bloc|
  if Universe.database_ready
    params = { data: params } unless params.instance_of? Hash
    message_id= "msg_#{Universe.messages.length}"
    params[:message_id]=message_id
    Universe.store_messages({msg_nb:message_id, proc: bloc })
    html.send_message(params)
  else
    puts "server not ready "
  end


end



new({ particle: :int8, category: :communication, type: :int })

new({ particle: :language, category: :communication, type: :string }) do |params|
  @data = int8[params]
  params
end
# method below are used for communication with native core
def receptor(msg)
  parsed = JSON.parse(msg)
  A.controller_code[:controller].call(parsed)
end

new({ particle: :controller, category: :communication, type: :hash }) do |msg|
  Atome.controller_sender(msg)
end

new({post: :controller}) do |_p, bloc|
  @controller_proc << bloc
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
atome-0.5.7.4.7 lib/atome/genesis/particles/communication.rb
atome-0.5.7.4.6 lib/atome/genesis/particles/communication.rb
atome-0.5.7.4.3 lib/atome/genesis/particles/communication.rb
atome-0.5.7.4.2 lib/atome/genesis/particles/communication.rb