Sha256: a6201ec77f0d224c68695b48aeec3a9b73b1cd43ec1076b5ff575ba6921e9424

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

module LanguageCards
  module Controllers
    module MainMenu
      class << self
        include Helpers::ViewHelper

        def render(courses:, mode:)
          _title = t 'Menu.Title'
          _select = t 'Menu.Choose'
          _mode = t('Menu.GameMode') + case mode.peek
                  when :translate then t 'Menu.ModeTranslate'
                  when :typing_practice then t 'Menu.ModeTyping'
                  end
          _toggle = "m: " + t('Menu.ToggleGameMode')
          _courses = courses.each.with_index.map {|item,index| "#{index + 1}: #{item}" }
          _mexit = t 'Menu.Exit'

          view = File.expand_path('../view/main_menu.erb', __dir__).
            ᐅ( IO.method :read ).
            ᐅ ERB.method :new
          view.result(binding)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_cards-0.3.0 lib/language_cards/controllers/main_menu.rb
language_cards-0.2.0 lib/language_cards/controllers/main_menu.rb