Class: HornOfPlenty::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/horn_of_plenty/request.rb

Instance Method Summary collapse

Instance Method Details

#query_classObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/horn_of_plenty/request.rb', line 19

def query_class
  @query_class ||= begin
    query_class_name             = self.class.name.gsub(/::Requests/, '::Queries')
    underscored_query_class_name = HornOfPlenty::CoreExt::String.underscore(
                                     query_class_name,
    )

    require underscored_query_class_name

    HornOfPlenty::CoreExt::String.constantize(query_class_name)
  end
end

#response_classObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/horn_of_plenty/request.rb', line 6

def response_class
  @response_class ||= begin
    response_class_name             = self.class.name.gsub(/::Requests/, '::Responses')
    underscored_response_class_name = HornOfPlenty::CoreExt::String.underscore(
                                        response_class_name,
    )

    require underscored_response_class_name

    HornOfPlenty::CoreExt::String.constantize(response_class_name)
  end
end