class GraphqlMigrateExecution::FieldDefinition
Attributes
Public Class Methods
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 4 def initialize(type_definition, name, node) @type_definition = type_definition @name = name.to_sym @node = node @resolve_mode = nil @hash_key = nil @resolver = nil @type_instance_method = nil @object_direct_method = nil @dig = nil @already_migrated = nil @resolver_method = nil @unknown_options = [] end
Public Instance Methods
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 107 def check_for_resolver_method if resolve_mode.nil? && (resolver_method) @resolve_mode = :type_instance_method @type_instance_method = @name end nil end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 69 def future_resolve_shorthand method_name = resolver_method.name name == method_name ? true : method_name end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 99 def implicit_resolve @name end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 21 def migration_strategy if unsupported_extras? return UnsupportedExtra elsif resolver_method&.uses_current_path return UnsupportedCurrentPath end if @type_definition.is_resolver && @type_definition.returns_hash? return HashKey end case resolve_mode when nil, :implicit_resolve if @type_definition.migration.implicit == "ignore" DoNothing else Implicit end when :hash_key, :object_direct_method, :dig DoNothing when :already_migrated case @already_migrated.keys.first when :resolve_each ResolveEach when :resolve_static ResolveStatic when :resolve_batch ResolveBatch when :resolve_legacy_instance_method DoNothing else raise ArgumentError, "Unexpected already_migrated: #{@already_migrated.inspect}" end when :type_instance_method resolver_method.migration_strategy when :resolver DoNothing else raise "No migration strategy for resolve_mode #{@resolve_mode.inspect}" end end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 78 def path @path ||= "#{type_definition.name}.#{@name}" end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 103 def resolve_mode_key resolve_mode && public_send(resolve_mode) end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 86 def resolver_method case @resolver_method when nil method_name = @type_instance_method || @name @resolver_method = @type_definition.resolver_methods[method_name] || :NOT_FOUND resolver_method when :NOT_FOUND nil else @resolver_method end end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 65 def source node.location.slice end
Source
# File lib/graphql_migrate_execution/field_definition.rb, line 82 def source_line @node.location.start_line end