Module: Spire::API::Requestable::ClassMethods

Defined in:
lib/spire/api/requestable.rb

Instance Method Summary collapse

Instance Method Details

#define_request(name, &block) ⇒ Object



30
31
32
# File 'lib/spire/api/requestable.rb', line 30

def define_request(name, &block)
  requests[name] = block
end

#get_request(name) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/spire/api/requestable.rb', line 20

def get_request(name)
  if req = requests[name]
    req
  elsif superclass.respond_to?(:get_request)
    superclass.get_request(name)
  else
    nil
  end
end

#requestsObject



16
17
18
# File 'lib/spire/api/requestable.rb', line 16

def requests
  @requests ||= {}
end