Method: YARD::Server::Commands::Base#initialize

Defined in:
lib/yard/server/commands/base.rb

#initialize(opts = {}) ⇒ Base

Creates a new command object, setting attributes named by keys in the options hash. After initialization, the options hash is saved in #command_options for further inspection.

Examples:

Creating a Command

cmd = DisplayObjectCommand.new(:caching => true, :library => mylib)
cmd.library # => mylib
cmd.command_options # => {:caching => true, :library => mylib}

Parameters:

  • opts (Hash) (defaults to: {})

    the options hash, saved to #command_options after initialization.

Since:

  • 0.6.0


74
75
76
77
78
79
# File 'lib/yard/server/commands/base.rb', line 74

def initialize(opts = {})
  opts.each do |key, value|
    send("#{key}=", value) if respond_to?("#{key}=")
  end
  self.command_options = opts
end