Module: GraphQL::Schema::Member::HasFields::InterfaceMethods Private
- Defined in:
- lib/graphql/schema/member/has_fields.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#fields(context = GraphQL::Query::NullContext.instance) ⇒ Hash<String => GraphQL::Schema::Field>
private
Fields on this object, keyed by name, including inherited fields.
-
#get_field(field_name, context = GraphQL::Query::NullContext.instance) ⇒ Object
private
Instance Method Details
#fields(context = GraphQL::Query::NullContext.instance) ⇒ Hash<String => GraphQL::Schema::Field>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Fields on this object, keyed by name, including inherited fields.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/graphql/schema/member/has_fields.rb', line 126 def fields(context = GraphQL::Query::NullContext.instance) warden = Warden.from_context(context) # Local overrides take precedence over inherited fields visible_fields = {} for ancestor in ancestors if ancestor.respond_to?(:own_fields) ancestor.own_fields.each do |field_name, fields_entry| # Choose the most local definition that passes `.visible?` -- # stop checking for fields by name once one has been found. if !visible_fields.key?(field_name) && (f = Warden.visible_entry?(:visible_field?, fields_entry, context, warden)) visible_fields[field_name] = f.ensure_loaded end end end end visible_fields end |
#get_field(field_name, context = GraphQL::Query::NullContext.instance) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/graphql/schema/member/has_fields.rb', line 112 def get_field(field_name, context = GraphQL::Query::NullContext.instance) warden = Warden.from_context(context) skip_visible = context.respond_to?(:types) && context.types.is_a?(GraphQL::Schema::Visibility::Profile) for ancestor in ancestors if ancestor.respond_to?(:own_fields) && (f_entry = ancestor.own_fields[field_name]) && (skip_visible || (f_entry = Warden.visible_entry?(:visible_field?, f_entry, context, warden))) return f_entry end end nil end |