Skip to content

Commit

Permalink
Create new Arrow type for reuse.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Nov 21, 2024
1 parent febe11b commit a417acd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions lib/config/arrow.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule ScreensConfig.Arrow do
@moduledoc false

@type t :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil
end
6 changes: 3 additions & 3 deletions lib/config/v2/blue_bikes/station.ex
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
defmodule ScreensConfig.V2.BlueBikes.Station do
@moduledoc false

alias ScreensConfig.Arrow

@type t :: %__MODULE__{
id: String.t(),
arrow: arrow(),
arrow: Arrow.t(),
walk_distance_minutes: non_neg_integer(),
walk_distance_feet: non_neg_integer()
}

@type arrow :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil

@enforce_keys [:id, :arrow, :walk_distance_minutes, :walk_distance_feet]
defstruct @enforce_keys

Expand Down
4 changes: 3 additions & 1 deletion lib/config/v2/departures/header.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ defmodule ScreensConfig.V2.Departures.Header do
If `title` is not set, there is no visual header, but `read_as` is still read out, if set.
"""

alias ScreensConfig.Arrow

@type t :: %__MODULE__{
arrow: nil | :n | :ne | :e | :se | :s | :sw | :w | :nw,
arrow: Arrow.t(),
read_as: String.t() | nil,
title: String.t() | nil
}
Expand Down
5 changes: 2 additions & 3 deletions lib/config/v2/elevator.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
defmodule ScreensConfig.V2.Elevator do
@moduledoc false

alias ScreensConfig.Arrow
alias ScreensConfig.V2.EvergreenContentItem

@type arrow_direction :: :n | :s | :e | :w

@type t :: %__MODULE__{
elevator_id: String.t(),
evergreen_content: list(EvergreenContentItem.t()),
alternate_direction_text: String.t(),
accessible_path_image_url: String.t(),
accessible_path_direction_arrow: arrow_direction()
accessible_path_direction_arrow: Arrow.t()
}

@enforce_keys [
Expand Down
8 changes: 3 additions & 5 deletions lib/config/v2/shuttle_bus_info.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
defmodule ScreensConfig.V2.ShuttleBusInfo do
@moduledoc false

alias ScreensConfig.V2.ShuttleBusSchedule
alias ScreensConfig.V2.WidgetInstance
alias ScreensConfig.Arrow
alias ScreensConfig.V2.{ShuttleBusSchedule, WidgetInstance}

@type t :: %__MODULE__{
minutes_range_to_destination_schedule: list(ShuttleBusSchedule.t()),
destination: String.t(),
arrow: arrow(),
arrow: Arrow.t(),
english_boarding_instructions: String.t(),
spanish_boarding_instructions: String.t(),
audio_boarding_instructions: String.t(),
priority: WidgetInstance.priority(),
enabled: boolean()
}

@type arrow :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil

defstruct minutes_range_to_destination_schedule: [],
destination: nil,
arrow: nil,
Expand Down

0 comments on commit a417acd

Please sign in to comment.