lib/graph_ql/directive.rb in graphql-0.3.0 vs lib/graph_ql/directive.rb in graphql-0.4.0

- old
+ new

@@ -1,7 +1,11 @@ +# This implementation of `Directive` is ... not robust. +# It seems like this area of the spec is still getting worked out, so +# {Directive} & {DirectiveChain} implement `@skip` and `@include` with +# minimal impact on query execution. class GraphQL::Directive - extend GraphQL::Definable + extend GraphQL::DefinitionHelpers::Definable attr_definable :on, :arguments, :name, :description LOCATIONS = [ ON_OPERATION = :on_operation?, ON_FRAGMENT = :on_fragment?, @@ -13,11 +17,16 @@ def initialize @arguments = {} @on = [] - yield(self, GraphQL::TypeDefiner.instance, GraphQL::FieldDefiner.instance, GraphQL::ArgumentDefiner.instance) + yield( + self, + GraphQL::DefinitionHelpers::TypeDefiner.instance, + GraphQL::DefinitionHelpers::FieldDefiner.instance, + GraphQL::DefinitionHelpers::ArgumentDefiner.instance + ) end def resolve(proc_or_arguments, proc=nil) if proc.nil? # resolve is being defined, just set it @@ -27,18 +36,17 @@ end end def arguments(new_arguments=nil) if !new_arguments.nil? - @arguments = GraphQL::StringNamedHash.new(new_arguments).to_h + @arguments = GraphQL::DefinitionHelpers::StringNamedHash.new(new_arguments).to_h end @arguments end def to_s "<GraphQL::Directive #{name}>" end end -require 'graph_ql/directives/directive_chain' -require 'graph_ql/directives/include_directive' -require 'graph_ql/directives/skip_directive' +require 'graph_ql/directive/include_directive' +require 'graph_ql/directive/skip_directive'