Populates +opts+ for reaction server with defaults.
 @param [Hash] opts          hash of options
 @return [Hash] defaultized options
497546
def mount_reaction_defaults(opts)
      defaults = {
        at: '/reaction',
        server: 'thin',
        key: Rails.application.config.secret_token
      }
      opts = defaults.merge opts
    end
153741
function default_1(opts = {}) {
    return Object.assign({}, ['get', 'head'].reduce((prev, cur) => (prev[cur] = ({ name, meta, url, options }) => request(Object.assign({}, opts, { url, method: cur.toUpperCase(), options })), prev), {}), ['post', 'put', 'patch', 'delete', 'options'].reduce((prev, cur) => (prev[cur] = ({ name, meta, url, body, options, type }) => request(Object.assign({}, opts, { url,
        type,
        options, method: cur.toUpperCase(), data: body })), prev), {}));
}
571122
function loadFromOptions(opts) {
  var defCfg = loadDefault()
  var cfg = opts.config ? loadFromFile(opts.config) : loadDefault()

  // Command line config override file loaded config
  for (var k in opts) {
    defCfg.hasOwnProperty(k) && (defCfg[k] !== opts[k] && (cfg[k] = opts[k]))
  }

  return cfg
}
64225
protected void opts(String[] opts) {
        if(opts.length < 1) {
            sendResponse(501, "Missing parameters");
            return;
        }

        String option = opts[0].toUpperCase();

        if(!options.containsKey(option)) {
            sendResponse(501, "No option found");
        } else if(opts.length < 2) {
            sendResponse(200, options.get(option));
        } else {
            options.put(option, opts[1].toUpperCase());
            sendResponse(200, "Option updated");
        }
    }
226064
function Server(opts){
  // Shorthand, no "new" required.
  if (!(this instanceof Server))
    return new Server(...arguments);

  if (typeof opts !== 'object')
    opts = {};

  this.clients = opts.dummies || [];

  this.server = opts.server || new SocketServer(socket => {
    let client = new Client(socket);
    this.clients.push(client);
    this.emit('connection', client);

    client._socket.once('data', handshake.bind(client));
    client.on('handshake-done', () => {
      client._socket.on('data', message.bind(client));
    });
  });
}
844751
def optparse(*args)
      opts = OptionParser.new

      opts.banner = 'usage: pullr URI [PATH]'

      opts.on('-S','--scm NAME','Source Code Management to use') do |scm|
        @scm = scm
      end

      opts.on('-U','--uri URI','The URI of the repository') do |uri|
        @uri = uri
      end

      opts.on('-u','--update [PATH]','Update the repository') do |path|
        @mode = :update
        @path = (path || Dir.pwd)
      end

      begin
        @args = opts.parse!(args)
      rescue OptionParser::InvalidOption => e
        $stderr.puts e.message
        $stderr.puts opts
        exit -1
      end
    end
526889
def prepare_options(opts = [])
      opts.inject('') do |string, (option, value)|
        string += case
                  when value
                    create_option(option, value)
                  when option.respond_to?(:each_pair)
                    prepare_options(option)
                  else
                    create_option(option)
                  end
      end
    end
52499
function setupOptions(opts) {
    var options = Object.create(null);
    for (var opt in defaultOptions) {
        if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) {
            var incomingOpt = opts[opt];
            options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt;
        } else if (defaultOptions.hasOwnProperty(opt)) {
            var defaultOpt = defaultOptions[opt];
            options[opt] = typeof defaultOpt === 'function' ? defaultOpt() : defaultOpt;
        }
    }
    return options;
  }
67794
def get_options(self, section='default', opt_keys=None, vars=None):
        
        vars = vars if vars else self.default_vars
        conf = self.parser
        opts = {}
        if opt_keys is None:
            if conf is None:
                opt_keys = {}
            else:
                if not self.robust or conf.has_section(section):
                    opt_keys = conf.options(section)
                else:
                    opt_keys = {}
        else:
            logger.debug('conf: %s' % conf)
            copts = conf.options(section) if conf else {}
            opt_keys = set(opt_keys).intersection(set(copts))
        for option in opt_keys:
            logger.debug(f'option: {option}, vars: {vars}')
            opts[option] = conf.get(section, option, vars=vars)
        return opts
354184
def load(opts)
      doc = nil
      if(opts.has_key?(:file)) then
        File.open(opts[:file], "rb") { |fd| doc = Nokogiri::XML::Document.parse(fd, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT) }
      else
        doc = Nokogiri::XML::Document.parse(opts[:data], nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT)
      end

      if doc
        root = doc.root.children.first
        return import_xml(root)
      end
    rescue Nokogiri::XML::SyntaxError => e
      raise CFFormatError.new('invalid XML: ' + e.message)
    end
77668
def with_options(opts = {}) # :nodoc:
      opts = opts.dup
      opts.delete(:comment)
      @opt_stack.push( @opt_stack.last.merge(opts))
      yield self
      @opt_stack.pop
    end
479466
def optparse_rails
    require 'optparse'
    options = {}

    OptionParser.new do |opt|
      opt.banner = "Usage: rib rails [environment] [options]"
      opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
      opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
      opt.parse!(ARGV)
    end

      # rails 3
    if ::Rails.respond_to?(:application) && (app = ::Rails.application)
      # rails 3.1
      if app.respond_to?(:sandbox)
        app.sandbox = options[:sandbox]
        app.load_console
      # rails 3.0
      else
        app.load_console(options[:sandbox])
      end
    else
      # rails 2
      require 'console_sandbox' if options[:sandbox]
    end

    if options[:debugger]
      begin
        require 'ruby-debug'
        puts "=> Debugger enabled"
      rescue Exception
        puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
        exit
      end
    end

    if options[:sandbox]
      puts "Loading #{::Rails.env} environment in sandbox (Rails #{::Rails.version})"
      puts "Any modifications you make will be rolled back on exit"
    else
      puts "Loading #{::Rails.env} environment (Rails #{::Rails.version})"
    end

    # rails 3.2
    if ::Rails.const_defined?(:ConsoleMethods)
      Rib.shell.eval_binding.eval('extend ::Rails::ConsoleMethods')
    end
  end
732699
def execute(opts={})
      @result = result_class.new(session.execute(statement, execution_options.merge(opts)), result_opts)
      result.success?
    end
219341
function Courier(opts) {
  stream.Transform.call(this, { objectMode: true });

  this.options = merge(Object.create(Courier.DEFAULTS), opts || {});
}
410969
function(opt){
        // merge with default options
        Object.keys(_options).forEach(function(key){
            _options[key] = opt[key] || _options[key];
        });
    }
1174080
def __gen_opts(self, opts):
        '''
        
        '''
        # If the state is intended to be applied locally, then the local opts
        # should have all of the needed data, otherwise overwrite the local
        # data items with data from the master
        if 'local_state' in opts:
            if opts['local_state']:
                return opts
        mopts = self.client.master_opts()
        if not isinstance(mopts, dict):
            # An error happened on the master
            opts['renderer'] = 'jinja|yaml'
            opts['failhard'] = False
            opts['state_top'] = salt.utils.url.create('top.sls')
            opts['nodegroups'] = {}
            opts['file_roots'] = {'base': [syspaths.BASE_FILE_ROOTS_DIR]}
        else:
            opts['renderer'] = mopts['renderer']
            opts['failhard'] = mopts.get('failhard', False)
            if mopts['state_top'].startswith('salt://'):
                opts['state_top'] = mopts['state_top']
            elif mopts['state_top'].startswith('/'):
                opts['state_top'] = salt.utils.url.create(mopts['state_top'][1:])
            else:
                opts['state_top'] = salt.utils.url.create(mopts['state_top'])
            opts['state_top_saltenv'] = mopts.get('state_top_saltenv', None)
            opts['nodegroups'] = mopts.get('nodegroups', {})
            opts['state_auto_order'] = mopts.get(
                'state_auto_order',
                opts['state_auto_order'])
            opts['file_roots'] = mopts['file_roots']
            opts['top_file_merging_strategy'] = mopts.get('top_file_merging_strategy',
                                                           opts.get('top_file_merging_strategy'))
            opts['env_order'] = mopts.get('env_order', opts.get('env_order', []))
            opts['default_top'] = mopts.get('default_top', opts.get('default_top'))
            opts['state_events'] = mopts.get('state_events')
            opts['state_aggregate'] = mopts.get('state_aggregate', opts.get('state_aggregate', False))
            opts['jinja_env'] = mopts.get('jinja_env', {})
            opts['jinja_sls_env'] = mopts.get('jinja_sls_env', {})
            opts['jinja_lstrip_blocks'] = mopts.get('jinja_lstrip_blocks', False)
            opts['jinja_trim_blocks'] = mopts.get('jinja_trim_blocks', False)
        return opts
129279
def with_default_options(options)
      config = RSpec.configuration

      {
        cookbook_root: config.cookbook_root || calling_cookbook_root(options, caller),
        cookbook_path: config.cookbook_path || calling_cookbook_path(options, caller),
        role_path:     config.role_path || default_role_path,
        environment_path: config.environment_path || default_environment_path,
        file_cache_path: config.file_cache_path,
        log_level:     config.log_level,
        path:          config.path,
        platform:      config.platform,
        version:       config.version,
      }.merge(options)
    end