Sha256: 300d4299772557cb876be0e0e2a10937b216d803a9cda4e3e3f5fda5e03aab81
Contents?: true
Size: 540 Bytes
Versions: 1
Compression:
Stored size: 540 Bytes
Contents
module SeatSelector class Seat attr_reader :row, :column, :id, :distance def initialize(params, converter = AlphaConverter) @row = converter.to_i(params.fetch("row")) @column = params.fetch("column") @id = params.fetch("id") @is_available = (params.fetch("status") == "AVAILABLE") end def to_s @id.to_s.upcase end def available? @is_available end def set_distance!(median_column) @distance = (@row - 1).abs + (@column - median_column).abs end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seat_selector-0.1.1 | lib/seat_selector/seat.rb |