class Fortune::Event

Attributes

has_come[RW]
m[RW]
n[RW]
name[RW]

Public Class Methods

list(h = {}) click to toggle source
# File lib/fortune/event.rb, line 22
def self.list(h = {})
  EventList.new(h).calc
end
new(h = {}) click to toggle source
# File lib/fortune/event.rb, line 5
def initialize(h = {})
  @has_come = false
  [:name, :n, :m].each{|k| instance_variable_set("@#{k}", h[k])}
end
select(h = {}) click to toggle source
# File lib/fortune/event.rb, line 25
def self.select(h = {})
  Event.list(h).active.name
end

Public Instance Methods

has_come?() click to toggle source
# File lib/fortune/event.rb, line 16
def has_come?
  @has_come
end
p(h = {}) click to toggle source
# File lib/fortune/event.rb, line 9
def p(h = {})
  P.new(:m => self.m, :n => h[:n] || self.n).value
end
set_come() click to toggle source
# File lib/fortune/event.rb, line 19
def set_come
  @has_come = true
end
try(h = {}) click to toggle source
# File lib/fortune/event.rb, line 12
def try(h = {})
  @has_come = P.is(self.m, h[:n] || self.n)
  self
end