# frozen_string_literal: true module Conwaymp class Options include Hanami::Validations predicate :file_exists?, message: 'file must exist' do |current| File.exist?(File.expand_path(current)) end validations do optional(:seed) { str? > included_in?(Conwaymp::Game.available_seeds) } required(:rows) { int? & included_in?(1..100) } required(:cols) { int? & included_in?(1..100) } optional(:load) { str? > file_exists? } end end end