Files
bbs-server/lib/model/game_model.rb
Zsolt Tasnadi a01dad96d9 Game catalog shows story and links; new_msg returns to menu on send
Game catalog: replaced emoji badges with the story field (word-wrapped)
and external links listed as label + URL. GameModel gains story and
external_links attributes.

New message: navigates back to idle immediately after a successful send
instead of sitting on the sent confirmation screen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 22:08:31 +02:00

26 lines
950 B
Ruby

# frozen_string_literal: true
class GameModel
attr_reader :title, :platform, :author, :desc, :story,
:play_path, :download_path, :source_path, :docs_path,
:release_count, :external_links
def initialize(entry)
sw = entry['software'] || {}
latest = entry['latestRelease'] || {}
@title = sw['title'].to_s
@platform = sw['platform'].to_s
@author = sw['author'].to_s
@desc = sw['desc'].to_s
@story = sw['story'].to_s
@play_path = latest['htmlFolderPath'].to_s
@download_path = latest['cartridgePath'].to_s
@source_path = latest['sourcePath'].to_s
@docs_path = latest['docsFolderPath'].to_s
@release_count = (entry['releases'] || []).length
@external_links = (sw['externalLinks'] || []).filter_map do |l|
{ label: l['label'].to_s, url: l['url'].to_s } unless l['url'].to_s.empty?
end
end
end