Class: OnyxCord::Commands::GroupProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/onyxcord/commands/container.rb

Overview

Proxy object used inside a CommandContainer#group block to prefix command names.

Instance Method Summary collapse

Constructor Details

#initialize(container, group_name, shared_attributes) ⇒ GroupProxy

Returns a new instance of GroupProxy.



171
172
173
174
175
# File 'lib/onyxcord/commands/container.rb', line 171

def initialize(container, group_name, shared_attributes)
  @container = container
  @group_name = group_name
  @shared_attributes = shared_attributes
end

Instance Method Details

#command(name, attributes = {}, &block) ⇒ Object



177
178
179
180
# File 'lib/onyxcord/commands/container.rb', line 177

def command(name, attributes = {}, &block)
  merged = @shared_attributes.merge(attributes)
  @container.command(:"#{@group_name}_#{name}", merged, &block)
end