Skip to content

Instantly share code, notes, and snippets.

@valikos
Last active May 7, 2019 19:27
Show Gist options
  • Save valikos/649261bbf9d6db18b92fe3c666ebd121 to your computer and use it in GitHub Desktop.
Save valikos/649261bbf9d6db18b92fe3c666ebd121 to your computer and use it in GitHub Desktop.
class Types::ResultType < Types::BaseUnion
possible_types Types::CharacterType, Types::LandType, Types::BuildingType
# Optional: if this method is defined, it will override `Schema.resolve_type`
def self.resolve_type(object, context)
if object.is_a?(Character)
Types::CharacterType
elsif object.is_a?(Land)
Types::LandType
else
Types::BuildingType
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment