class GraphqlRails::Router::Route
Generic class for any type graphql action. Should not be used directly
Attributes
function[R]
groups[R]
module_name[R]
name[R]
on[R]
relative_path[R]
Public Class Methods
new(name, to: '', on:, groups: nil, **options)
click to toggle source
# File lib/graphql_rails/router/route.rb, line 11 def initialize(name, to: '', on:, groups: nil, **options) @name = name.to_s.camelize(:lower) @module_name = options[:module].to_s @function = options[:function] @groups = groups @relative_path = to @on = on.to_sym end
Public Instance Methods
collection?()
click to toggle source
# File lib/graphql_rails/router/route.rb, line 26 def collection? on == :collection end
field_options()
click to toggle source
# File lib/graphql_rails/router/route.rb, line 36 def field_options if function { function: function } else { resolver: resolver } end end
path()
click to toggle source
# File lib/graphql_rails/router/route.rb, line 20 def path return relative_path if module_name.empty? [module_name, relative_path].join('/') end
show_in_group?(group_name)
click to toggle source
# File lib/graphql_rails/router/route.rb, line 30 def show_in_group?(group_name) return true if groups.nil? || groups.empty? groups.include?(group_name&.to_sym) end
Private Instance Methods
resolver()
click to toggle source
# File lib/graphql_rails/router/route.rb, line 48 def resolver @resolver ||= Controller::BuildControllerActionResolver.call(route: self) end