Module: GQL::Mixins::HasCalls::ClassMethods
- Defined in:
- lib/gql/mixins/has_calls.rb
Instance Method Summary collapse
- #add_call(id, *args, &block) ⇒ Object (also: #call)
- #has_call?(id) ⇒ Boolean
- #remove_call(id) ⇒ Object
Instance Method Details
#add_call(id, *args, &block) ⇒ Object Also known as: call
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gql/mixins/has_calls.rb', line 19 def add_call(id, *args, &block) remove_call id id = id.to_sym = args. call_spec = args.shift || block || proc_for_call(id) result_spec = [:returns] || call_spec.try(:result_class) result_class = result_class_from_spec(result_spec) build_call_class(call_spec, id, result_class).tap do |call_class| propagate :call, id, call_class end end |
#has_call?(id) ⇒ Boolean
39 40 41 |
# File 'lib/gql/mixins/has_calls.rb', line 39 def has_call?(id) calls.has_key? id.to_sym end |
#remove_call(id) ⇒ Object
35 36 37 |
# File 'lib/gql/mixins/has_calls.rb', line 35 def remove_call(id) shutdown :call, id.to_sym end |