Method: GQL::Registry#fetch
- Defined in:
- lib/gql/registry.rb
#fetch(key, baseclass = Field) ⇒ Object Also known as: []
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gql/registry.rb', line 18 def fetch(key, baseclass = Field) cache[key] || begin raise Errors::FieldClassNotSet.new(baseclass, 'TODO') if key.nil? const, name = if key.instance_of? ::Class [key, key.name] else [key.constantize, key] end raise Errors::InvalidFieldClass.new(const, baseclass) unless const <= baseclass cache.update name => const, const => const cache[key] end end |