Module: GraphitiGql::ResourceExtras
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/graphiti_gql/graphiti_hax.rb
Instance Method Summary collapse
- #around_scoping(original_scope, query_hash) ⇒ Object
- #filterings ⇒ Object
- #parent_field ⇒ Object
- #selections ⇒ Object
- #value_object? ⇒ Boolean
Instance Method Details
#around_scoping(original_scope, query_hash) ⇒ Object
67 68 69 70 71 |
# File 'lib/graphiti_gql/graphiti_hax.rb', line 67 def around_scoping(original_scope, query_hash) run_callbacks :query do super { |scope| yield scope } end end |
#filterings ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/graphiti_gql/graphiti_hax.rb', line 32 def filterings @filterings ||= begin if @params.key?(:filter) @params[:filter].keys else [] end end end |
#parent_field ⇒ Object
42 43 44 |
# File 'lib/graphiti_gql/graphiti_hax.rb', line 42 def parent_field context[:current_arguments][:lookahead].field.owner end |
#selections ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/graphiti_gql/graphiti_hax.rb', line 46 def selections return @selections if @selections lookahead = context[:current_arguments] .keyword_arguments[:lookahead] nodes = lookahead.selection(:nodes) if !nodes.selected? nodes = lookahead .selection(:edges) .selection(:node) end if !nodes.selected? nodes = lookahead end @selections = nodes .selections .map(&:name).map { |name| name.to_s.underscore.to_sym } @selections end |
#value_object? ⇒ Boolean
28 29 30 |
# File 'lib/graphiti_gql/graphiti_hax.rb', line 28 def value_object? self.class.value_object? end |