Class: Relish::Command::Dsl::Command

Inherits:
Object
  • Object
show all
Includes:
ContextClass
Defined in:
lib/relish/commands/dsl/command.rb

Instance Attribute Summary

Attributes included from ContextClass

#context_class

Instance Method Summary collapse

Methods included from ContextClass

#context_class_eval, #context_class_name, #initialize

Instance Method Details

#define(name, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/relish/commands/dsl/command.rb', line 7

def define(name, &block)
  context_class_eval do
    define_method(name) do
      begin
        instance_exec(&block)
      rescue RestClient::Exception => exception
        warn exception.response
        exit 1
      end
    end
  end
  HelpText.add(name, context_class_name)
end