Class: Seatsio::Domain::Month
- Inherits:
-
Object
- Object
- Seatsio::Domain::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.
405 406 407 408 |
# File 'lib/seatsio/domain.rb', line 405 def initialize(year, month) @year = year @month = month end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
397 398 399 |
# File 'lib/seatsio/domain.rb', line 397 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
397 398 399 |
# File 'lib/seatsio/domain.rb', line 397 def year @year end |
Class Method Details
.from_json(data) ⇒ Object
399 400 401 402 403 |
# File 'lib/seatsio/domain.rb', line 399 def self.from_json(data) @year = data['year'] @month = data['month'] self end |
Instance Method Details
#serialize ⇒ Object
410 411 412 |
# File 'lib/seatsio/domain.rb', line 410 def serialize @year.to_s + "-" + @month.to_s.rjust(2, "0") end |