Sha256: 50b075ba83d96cb08e47a548c059ca5ee170c5be0990a9e226fcd4939ab018d7
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Rails module GraphQL class Request # Helper methods for the prepare step of a request module Preparable # Prepare the object def prepare! prepare rescue => error report_exception(error) end # Marks that the field has prepared data that came outside from the # request def prepared_data! @prepared_data = true end # Checks if the field has prepared data def prepared_data? defined?(@prepared_data) && @prepared_data end protected # Normal mode of the prepare step def prepare prepare_then { prepare_fields } end # The actual process that prepare the object def prepare_then(after_block = nil, &block) return if unresolvable? stacked do block.call if block.present? trigger_event(:prepared) after_block.call if after_block.present? end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-graphql-1.0.0.beta | lib/rails/graphql/request/steps/preparable.rb |