Class: Respect::Rails::ActionDef

Inherits:
Object
  • Object
show all
Defined in:
lib/respect/rails/action_def.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ActionDef) initialize(*args)

A new instance of ActionDef



11
12
13
# File 'lib/respect/rails/action_def.rb', line 11

def initialize(*args)
  @action_schema = ActionSchema.new(*args)
end

Class Method Details

+ (Object) eval(*args, &block)



6
7
8
# File 'lib/respect/rails/action_def.rb', line 6

def eval(*args, &block)
  new(*args).eval(&block)
end

Instance Method Details

- (Object) documentation(text)

Set the documentation to text.



31
32
33
# File 'lib/respect/rails/action_def.rb', line 31

def documentation(text)
  @action_schema.documentation = text
end

- (Object) eval(&block)



15
16
17
18
# File 'lib/respect/rails/action_def.rb', line 15

def eval(&block)
  block.call(self)
  @action_schema
end

- (Object) request(&block)



20
21
22
23
# File 'lib/respect/rails/action_def.rb', line 20

def request(&block)
  @action_schema.request = RequestSchema.define(@action_schema.controller_name,
    @action_schema.action_name, &block)
end

- (Object) response_for(&block)



25
26
27
28
# File 'lib/respect/rails/action_def.rb', line 25

def response_for(&block)
  block.call(@action_schema.responses)
  @action_schema.responses
end