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.



578
579
580
581
# File 'lib/seatsio/domain.rb', line 578

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

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



572
573
574
# File 'lib/seatsio/domain.rb', line 572

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



572
573
574
# File 'lib/seatsio/domain.rb', line 572

def year
  @year
end

Class Method Details

.from_json(data) ⇒ Object



574
575
576
# File 'lib/seatsio/domain.rb', line 574

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

Instance Method Details

#serializeObject



583
584
585
# File 'lib/seatsio/domain.rb', line 583

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