Sha256: 19c3d60b3d726e03c8e6a6aa6d4235f0b6fc1f8b721f7b7845d12147dd567b09

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 Bytes

Contents

module Fortune

  class Event
    attr_accessor :has_come, :name, :m, :n
    def initialize(h = {})
      @has_come = false
      [:name, :n, :m].each{|k| instance_variable_set("@#{k}", h[k])}
    end
    def p(h = {})
      P.new(:m => self.m, :n => h[:n] || self.n).value
    end
    def try(h = {})
      @has_come = P.is(self.m, h[:n] || self.n)
      self
    end
    def has_come?
      @has_come
    end
    def set_come
      @has_come = true
    end
    def self.list(h = {})
      EventList.new(h).calc
    end
    def self.select(h = {})
      Event.list(h).active.name
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fortune-0.0.3 lib/fortune/event.rb
fortune-0.0.2 lib/fortune/event.rb
fortune-0.0.1 lib/fortune/event.rb