Files
nairobi/lib/graph_ql/root_collection_resolver.rb
2017-01-07 22:43:42 +01:00

18 lines
346 B
Ruby

module GraphQL
class RootCollectionResolver
attr_reader :target_model
def initialize(target_model)
@target_model = target_model
end
def call(object, arguments, context)
if target_model.respond_to?(:public_for_api)
target_model.public_for_api
else
target_model.all
end
end
end
end