Method: Cinch::Plugin::ClassMethods#set

Defined in:
lib/cinch/plugin.rb

#set(key, value) #set(options)

This method returns an undefined value.

Set options.

Available options:

Overloads:

  • #set(key, value)

    This method returns an undefined value.

    Parameters:

    • key (Symbol)

      The option’s name

    • value (Object)
  • #set(options)

    This method returns an undefined value.

    Examples:

    set(:help   => "the help message",
        :prefix => "^")

    Parameters:

    • options (Hash{Symbol => Object})

      The options, as key => value associations

Since:

  • 2.0.0



159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/cinch/plugin.rb', line 159

def set(*args)
  case args.size
  when 1
    # {:key => value, ...}
    args.first.each do |key, value|
      self.send("#{key}=", value)
    end
  when 2
    # key, value
    self.send("#{args.first}=", args.last)
  else
    raise ArgumentError # TODO proper error message
  end
end