module FishingReport
Constants
- FOOTER_LIST
- FOOTER_OUTLOOK
- FOOTER_OUTLOOK_GEO
- TAG
- TOP_DAYS
Public Instance Methods
Source
# File lib/fishing_report.rb, line 55 def build_list_report(sites, max_bytes: RabbotConfig::PRIVMSG_CHUNK_BYTES) body_lines = FishingListFormat.build_list_body(sites, max_bytes: max_bytes) IrcReply.card( tag: TAG, title: "QLD primary tide ports", body_lines: body_lines, footer_parts: FOOTER_LIST ) end
Source
# File lib/fishing_report.rb, line 45 def build_outlook_report(query_location:, port:, ranked_days:, analysis_days: 60) footer = port[:match] == :geo ? FOOTER_OUTLOOK_GEO : FOOTER_OUTLOOK IrcReply.card( tag: TAG, title: outlook_title(query_location, port), body_lines: format_report_body(ranked_days, analysis_days: analysis_days), footer_parts: footer ) end
Source
# File lib/fishing_report.rb, line 22 def display_name(text) text.to_s.split.map(&:capitalize).join(" ") end
Source
# File lib/fishing_report.rb, line 36 def format_report_body(ranked_days, analysis_days: 60) top = ranked_days.first(TOP_DAYS) return ["No suitable tide days found."] if top.empty? header = "Top days โ next #{analysis_days} days" lines = top.map.with_index { |day, index| FishingTideFormat.format_day_line(day, index) } [header, *lines] end
Source
# File lib/fishing_report.rb, line 26 def outlook_title(query_location, port) if port[:match] == :geo label = display_name(port[:matched_as] || query_location) km = port[:distance_km].to_f.round "#{label} ยท nearest #{port[:name]} (#{km} km)" else "#{port[:name]} ยท tide outlook" end end