Sha256: b2a1d38924a545a7f8b258c332ea7697093d5729b2bdc1b2094b9f446c508135

Contents?: true

Size: 644 Bytes

Versions: 5

Compression:

Stored size: 644 Bytes

Contents

require 'passive_record'
require 'frappuccino'

require 'metacosm/version'
require 'metacosm/model'
require 'metacosm/simulation'

module Metacosm
  class View
    include PassiveRecord
  end

  class Command
    include PassiveRecord

    def attrs
      to_h.keep_if { |k,_| k != :id }
    end

    def ==(other)
      attrs == other.attrs
    end
  end

  class Event
    include PassiveRecord

    def attrs
      to_h.keep_if { |k,_| k != :id }
    end

    def ==(other)
      attrs == other.attrs
    end
  end

  class EventListener < Struct.new(:simulation)
    def fire(command)
      self.simulation.apply(command)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metacosm-0.2.0 lib/metacosm.rb
metacosm-0.1.8 lib/metacosm.rb
metacosm-0.1.7 lib/metacosm.rb
metacosm-0.1.6 lib/metacosm.rb
metacosm-0.1.5 lib/metacosm.rb