Commit fdf33012 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Eliminate the one-line methods in Options::Processor.

parent 29193541
Loading
Loading
Loading
Loading
+10 −31
Original line number Diff line number Diff line
@@ -19,14 +19,17 @@ module JsDuck
      def process!(opts)
        @opts = opts

        # Apply the various options.
        # Expand list of input files
        configure_input_files
        configure_logger
        configure_parallel
        configure_tags
        configure_json
        configure_encoding
        configure_ext_patterns

        # Configure various objects with these options
        Logger.configure(@opts)
        Util::Parallel.configure(@opts)
        TagRegistry.configure(@opts)

        Util::Json.pretty = true if @opts.pretty_json
        JsDuck::Util::IO.encoding = @opts.encoding if @opts.encoding
        Js::ExtPatterns.set(@opts.ext_namespaces) if @opts.ext_namespaces

        validate

@@ -74,30 +77,6 @@ module JsDuck
        end
      end

      def configure_logger
        Logger.configure(@opts)
      end

      def configure_parallel
        Util::Parallel.configure(@opts)
      end

      def configure_tags
        TagRegistry.configure(@opts)
      end

      def configure_json
        Util::Json.pretty = true if @opts.pretty_json
      end

      def configure_encoding
        JsDuck::Util::IO.encoding = @opts.encoding if @opts.encoding
      end

      def configure_ext_patterns
        Js::ExtPatterns.set(@opts.ext_namespaces) if @opts.ext_namespaces
      end

      # Runs checks on the options
      def validate
        if @opts.input_files.length == 0 && !@opts.welcome && !@opts.guides && !@opts.videos && !@opts.examples