Sha256: e4e07eb38ffb8f2a0b668e6dde74183c799ca2a09a7ff237d455da1bf0be2dfd
Contents?: true
Size: 610 Bytes
Versions: 32
Compression:
Stored size: 610 Bytes
Contents
# This is a helper class. It lets you build simple DSL's. Methods called against the class are # converted into attributes in a hash. module GraphQL module Models class Definer def initialize(*methods) @values = {} methods.each do |m| define_singleton_method(m) do |*args| if args.blank? @values[m] = nil elsif args.length == 1 @values[m] = args[0] else @values[m] = args end end end end def defined_values @values end end end end
Version data entries
32 entries across 32 versions & 1 rubygems