Class: Seatsio::Month
- Inherits:
-
Object
- Object
- Seatsio::Month
- Defined in:
- lib/seatsio/domain.rb
Instance Attribute Summary collapse
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(year, month) ⇒ Month
constructor
A new instance of Month.
- #serialize ⇒ Object
Constructor Details
#initialize(year, month) ⇒ Month
Returns a new instance of Month.
527 528 529 530 |
# File 'lib/seatsio/domain.rb', line 527 def initialize(year, month) @year = year @month = month end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
521 522 523 |
# File 'lib/seatsio/domain.rb', line 521 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
521 522 523 |
# File 'lib/seatsio/domain.rb', line 521 def year @year end |
Class Method Details
.from_json(data) ⇒ Object
523 524 525 |
# File 'lib/seatsio/domain.rb', line 523 def self.from_json(data) return Month.new(data['year'], data['month']) end |
Instance Method Details
#serialize ⇒ Object
532 533 534 |
# File 'lib/seatsio/domain.rb', line 532 def serialize @year.to_s + "-" + @month.to_s.rjust(2, "0") end |