Sha256: 82ecd29878f613d8ea1160fe93e58e7c02a0c49a6a5cae3ae82635aae18292a7

Contents?: true

Size: 596 Bytes

Versions: 13

Compression:

Stored size: 596 Bytes

Contents

class MessageStore < Hyperloop::Store
  state :messages, scope: :class, reader: :all
  state :user_name, scope: :class, reader: true

  def self.online?
    state.messages
  end

  receives Operations::Join do |params|
    puts "receiving Operations::Join(#{params})"
    mutate.user_name params.user_name
  end

  receives Operations::GetMessages do |params|
    puts "receiving Operations::GetMessages(#{params})"
    mutate.messages params.messages
  end

  receives Operations::Send do |params|
    puts "receiving Operations::Send(#{params})"
    mutate.messages << params.message
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyper-operation-0.5.12 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.11 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.10 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.9 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.8 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.7 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.6 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.5 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.4 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.3 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.2 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.1 examples/chat-app/app/hyperloop/stores/message_store.rb
hyper-operation-0.5.0 examples/chat-app/app/hyperloop/stores/message_store.rb