Class: Fortune::Event
- Inherits:
-
Object
- Object
- Fortune::Event
- Defined in:
- lib/fortune/event.rb
Instance Attribute Summary collapse
-
#has_come ⇒ Object
Returns the value of attribute has_come.
-
#m ⇒ Object
Returns the value of attribute m.
-
#n ⇒ Object
Returns the value of attribute n.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #has_come? ⇒ Boolean
-
#initialize(h = {}) ⇒ Event
constructor
A new instance of Event.
- #p(h = {}) ⇒ Object
- #set_come ⇒ Object
- #try(h = {}) ⇒ Object
Constructor Details
#initialize(h = {}) ⇒ Event
Returns a new instance of Event.
5 6 7 8 |
# 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 |
Instance Attribute Details
#has_come ⇒ Object
Returns the value of attribute has_come.
4 5 6 |
# File 'lib/fortune/event.rb', line 4 def has_come @has_come end |
#m ⇒ Object
Returns the value of attribute m.
4 5 6 |
# File 'lib/fortune/event.rb', line 4 def m @m end |
#n ⇒ Object
Returns the value of attribute n.
4 5 6 |
# File 'lib/fortune/event.rb', line 4 def n @n end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/fortune/event.rb', line 4 def name @name end |
Class Method Details
Instance Method Details
#has_come? ⇒ Boolean
16 17 18 |
# File 'lib/fortune/event.rb', line 16 def has_come? @has_come end |
#p(h = {}) ⇒ Object
9 10 11 |
# File 'lib/fortune/event.rb', line 9 def p(h = {}) P.new(:m => self.m, :n => h[:n] || self.n).value end |
#set_come ⇒ Object
19 20 21 |
# File 'lib/fortune/event.rb', line 19 def set_come @has_come = true end |