Class: Availabiliter::OutputFormatter
- Inherits:
-
Object
- Object
- Availabiliter::OutputFormatter
- Defined in:
- lib/availabiliter/output_formatter.rb
Overview
Transform availabilities to the required format
Instance Attribute Summary collapse
-
#availabilities ⇒ Object
readonly
Returns the value of attribute availabilities.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
Instance Method Summary collapse
- #format_availabilities ⇒ Object
-
#initialize(availabilities, format:, time_zone:) ⇒ OutputFormatter
constructor
A new instance of OutputFormatter.
Constructor Details
#initialize(availabilities, format:, time_zone:) ⇒ OutputFormatter
Returns a new instance of OutputFormatter.
6 7 8 9 10 |
# File 'lib/availabiliter/output_formatter.rb', line 6 def initialize(availabilities, format:, time_zone:) @availabilities = availabilities @format = format @time_zone = time_zone end |
Instance Attribute Details
#availabilities ⇒ Object (readonly)
Returns the value of attribute availabilities.
4 5 6 |
# File 'lib/availabiliter/output_formatter.rb', line 4 def availabilities @availabilities end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
4 5 6 |
# File 'lib/availabiliter/output_formatter.rb', line 4 def format @format end |
#time_zone ⇒ Object (readonly)
Returns the value of attribute time_zone.
4 5 6 |
# File 'lib/availabiliter/output_formatter.rb', line 4 def time_zone @time_zone end |
Instance Method Details
#format_availabilities ⇒ Object
12 13 14 15 16 |
# File 'lib/availabiliter/output_formatter.rb', line 12 def format_availabilities availabilities.map do |availability| convert_to_format(availability) end end |