Class: Event

Inherits:
Object
  • Object
show all
Defined in:
lib/event.rb

Overview

An object of this class is representing a historical event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ev) ⇒ Event

Returns a new instance of Event.



20
21
22
23
24
25
# File 'lib/event.rb', line 20

def initialize(ev)
  @title = ev[0] 
  @year = ev[1]
  @detail = ev[2]
  @disp_index = 0
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail.



30
31
32
# File 'lib/event.rb', line 30

def detail
  @detail
end

#disp_indexObject

Returns the value of attribute disp_index.



31
32
33
# File 'lib/event.rb', line 31

def disp_index
  @disp_index
end

#titleObject (readonly)

Returns the value of attribute title.



30
31
32
# File 'lib/event.rb', line 30

def title
  @title
end

#yearObject (readonly)

Returns the value of attribute year.



30
31
32
# File 'lib/event.rb', line 30

def year
  @year
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/event.rb', line 27

def to_s
  str = '' << self.class.name << '{ title=' << @title << ', year=' << @year.to_s << ', detail=' << @detail << ', disp_index=' << @disp_index.to_s << '}'
end