# Commands

> 🚨 En Platanus dejamos de usar comandos. Ahora estamos usando Active Job como lugar para la lógica de negocio

Los *Comandos* son clases destinadas a realizar operaciones acotadas e independientes. Se implementan a través de un método `perform` que recibe argumentos y realiza operaciones con ellos entregando un resultado. También poseen un generador para construir su estructura,

```bash
$ rails generate command DoSomething foo
```

Esto generará una clase que implementa el método `perform`

```ruby
class DoSomething < PowerTypes::Command.new(:foo, :bar)
  def perform(args)
  end
end
```

Luego pueden ser llamados y ejecutados de la siguiente forma,

```ruby
result = DoSomething.for(foo: waffle, bar: pancake)
```

Donde `:foo, :bar` son los argumentos. Están disponibles en el comando como variables de instancia `@foo, @bar`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://la-guia.platan.us/stack/ruby_rails/power_types/patrones/commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
