Module: Rails::GraphQL::Helpers
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/rails/graphql/helpers.rb,
lib/rails/graphql/helpers/with_name.rb,
lib/rails/graphql/helpers/with_owner.rb,
lib/rails/graphql/helpers/with_events.rb,
lib/rails/graphql/helpers/with_fields.rb,
lib/rails/graphql/helpers/instantiable.rb,
lib/rails/graphql/helpers/leaf_from_ar.rb,
lib/rails/graphql/helpers/registerable.rb,
lib/rails/graphql/helpers/unregisterable.rb,
lib/rails/graphql/helpers/with_arguments.rb,
lib/rails/graphql/helpers/with_callbacks.rb,
lib/rails/graphql/helpers/with_global_id.rb,
lib/rails/graphql/helpers/with_namespace.rb,
lib/rails/graphql/helpers/with_validator.rb,
lib/rails/graphql/helpers/with_assignment.rb,
lib/rails/graphql/helpers/with_directives.rb,
lib/rails/graphql/helpers/with_description.rb,
lib/rails/graphql/helpers/with_schema_fields.rb,
lib/rails/graphql/helpers/attribute_delegator.rb,
lib/rails/graphql/helpers/inherited_collection.rb,
lib/rails/graphql/helpers/inherited_collection/base.rb,
lib/rails/graphql/helpers/inherited_collection/hash.rb,
lib/rails/graphql/helpers/inherited_collection/array.rb
Overview
All helpers that allow this gem to be flexible and extendable to any other sources of objects and other gems as well
Defined Under Namespace
Modules: InheritedCollection, Instantiable, LeafFromAr, Registerable, Unregisterable, WithArguments, WithAssignment, WithCallbacks, WithDescription, WithDirectives, WithEvents, WithFields, WithGlobalID, WithName, WithNamespace, WithOwner, WithSchemaFields, WithValidator Classes: AttributeDelegator
Class Method Summary collapse
-
.dup_all_with_owner(enumerator, owner) ⇒ Object
Easy way to duplicate objects and set a new owner.
-
.dup_with_owner(item, owner) ⇒ Object
Easy way to duplicate a object and set a new owner.
-
.merge_hash_array(one, other) ⇒ Object
Global helper that merge a hash that contains values as arrays.
Class Method Details
.dup_all_with_owner(enumerator, owner) ⇒ Object
Easy way to duplicate objects and set a new owner
32 33 34 |
# File 'lib/rails/graphql/helpers.rb', line 32 def self.dup_all_with_owner(enumerator, owner) enumerator.map { |item| dup_with_owner(item, owner) }.presence end |
.dup_with_owner(item, owner) ⇒ Object
Easy way to duplicate a object and set a new owner
37 38 39 |
# File 'lib/rails/graphql/helpers.rb', line 37 def self.dup_with_owner(item, owner) item.dup.tap { |x| x.instance_variable_set(:@owner, owner) } end |
.merge_hash_array(one, other) ⇒ Object
Global helper that merge a hash that contains values as arrays
42 43 44 |
# File 'lib/rails/graphql/helpers.rb', line 42 def self.merge_hash_array(one, other) one.merge(other) { |_, lval, rval| lval + rval } end |