Class: Ellen::SyoboiCalendar::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/ellen/syoboi_calendar/record.rb

Direct Known Subclasses

Program, Title

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ Record

Returns a new instance of Record.



24
25
26
# File 'lib/ellen/syoboi_calendar/record.rb', line 24

def initialize(properties)
  @properties = properties
end

Instance Attribute Details

#propertiesObject (readonly)

Returns the value of attribute properties.



22
23
24
# File 'lib/ellen/syoboi_calendar/record.rb', line 22

def properties
  @properties
end

Class Method Details

.property(*names) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/ellen/syoboi_calendar/record.rb', line 5

def property(*names)
  names.each do |name|
    define_method(name) do
      properties[name]
    end
  end
end

.time_property(*names) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ellen/syoboi_calendar/record.rb', line 13

def time_property(*names)
  names.each do |name|
    define_method(name) do
      Time.parse(properties[name])
    end
  end
end