Class: GraphqlRails::Controller::Action
- Inherits:
-
Object
- Object
- GraphqlRails::Controller::Action
- Defined in:
- lib/graphql_rails/controller/action.rb
Overview
analyzes route and extracts controller action related data
Instance Method Summary collapse
- #action_config ⇒ Object
- #arguments ⇒ Object
- #controller ⇒ Object
- #description ⇒ Object
-
#initialize(route) ⇒ Action
constructor
A new instance of Action.
- #name ⇒ Object
- #return_type ⇒ Object
- #type_args ⇒ Object
- #type_options ⇒ Object
Constructor Details
#initialize(route) ⇒ Action
Returns a new instance of Action.
14 15 16 |
# File 'lib/graphql_rails/controller/action.rb', line 14 def initialize(route) @route = route end |
Instance Method Details
#action_config ⇒ Object
46 47 48 |
# File 'lib/graphql_rails/controller/action.rb', line 46 def action_config controller.controller_configuration.action_config(name) end |
#arguments ⇒ Object
22 23 24 |
# File 'lib/graphql_rails/controller/action.rb', line 22 def arguments action_config.attributes.values end |
#controller ⇒ Object
26 27 28 |
# File 'lib/graphql_rails/controller/action.rb', line 26 def controller @controller ||= "#{namespaced_controller_name}_controller".classify.constantize end |
#description ⇒ Object
34 35 36 |
# File 'lib/graphql_rails/controller/action.rb', line 34 def description action_config.description end |
#name ⇒ Object
30 31 32 |
# File 'lib/graphql_rails/controller/action.rb', line 30 def name @name ||= relative_path.split('#').last end |
#return_type ⇒ Object
18 19 20 |
# File 'lib/graphql_rails/controller/action.rb', line 18 def return_type action_config.return_type end |
#type_args ⇒ Object
38 39 40 |
# File 'lib/graphql_rails/controller/action.rb', line 38 def type_args [type_parser.type_arg] end |
#type_options ⇒ Object
42 43 44 |
# File 'lib/graphql_rails/controller/action.rb', line 42 def { null: !type_parser.required? } end |