Sha256: 28a1b4ffccec09b398ea39e224a635640de0453d35b73a645e619ef5981787ea

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

#--
# wwwjdic
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020  Marco Bresciani
#
# This file is part of wwwjdic.
#
# wwwjdic is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
#++

require_relative '../constants'

module WWWJDic
  module Parsers

    # This class is an implementation of the Parsable duck type that
    # checks the display type. The only needed parameter is a boolean,
    # with +true+ for regular.
    #
    # Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
    # Copyright:: Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020  Marco Bresciani
    # License:: GNU General Public License version 3
    class Server
      include Utils::Raisers

      # The parsable duck type interface to every parser usage.
      def parse(value = :edrdg)
        raise ArgumentError, I18n.t('error.nil') if value.nil?
        raise ArgumentError, I18n.t('error.param', value: value) unless value.is_a? Symbol

        raiser_array('error.param', value, URIS.keys)

        value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wwwjdic-14.0.0 lib/wwwjdic/parsers/server.rb