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.



472
473
474
475
# File 'lib/seatsio/domain.rb', line 472

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

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



464
465
466
# File 'lib/seatsio/domain.rb', line 464

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



464
465
466
# File 'lib/seatsio/domain.rb', line 464

def year
  @year
end

Class Method Details

.from_json(data) ⇒ Object



466
467
468
469
470
# File 'lib/seatsio/domain.rb', line 466

def self.from_json(data)
  @year = data['year']
  @month = data['month']
  self
end

Instance Method Details

#serializeObject



477
478
479
# File 'lib/seatsio/domain.rb', line 477

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