global

def self.parse_variable(variable, game_type)

Returns:
  • (String) -

Parameters:
  • game_type (String) --
  • variable (String) --
def self.parse_variable(variable, game_type)
    unless game_type.nil?
        lines_count = variable.count("\n")

        if lines_count.positive?
            variable = variable.gsub(/\r?\n/, '\#')

            case game_type
                when 'lisa'
                    return nil unless variable.split('\#').all? { |line| line.match?(/^<.*>\.?$/) || line.empty? }
                else
                    nil
            end
        end
    end

    variable
end