Class: Seatsio::Month

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year, month) ⇒ Month

Returns a new instance of Month.



629
630
631
632
# File 'lib/seatsio/domain.rb', line 629

def initialize(year, month)
  @year = year
  @month = month
end

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



623
624
625
# File 'lib/seatsio/domain.rb', line 623

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



623
624
625
# File 'lib/seatsio/domain.rb', line 623

def year
  @year
end

Class Method Details

.from_json(data) ⇒ Object



625
626
627
# File 'lib/seatsio/domain.rb', line 625

def self.from_json(data)
  return Month.new(data['year'], data['month'])
end

Instance Method Details

#serializeObject



634
635
636
# File 'lib/seatsio/domain.rb', line 634

def serialize
  @year.to_s + "-" + @month.to_s.rjust(2, "0")
end