Sha256: bf8d279ba50e462132fe9d79239e566d7c28e6597e7844fef07e0896da387342
Contents?: true
Size: 707 Bytes
Versions: 13
Compression:
Stored size: 707 Bytes
Contents
# frozen_string_literal: true require 'graphql_rails/model/configuration' module GraphqlRails # this module allows to convert any ruby class in to grapql type object # # usage: # class YourModel # include GraphqlRails::Model # # graphql do # attribute :id # attribute :title # end # end # # YourModel.new.grapql_type # => type with [:id, :title] attributes module Model def self.included(base) base.extend(ClassMethods) end # static methods for GraphqlRails::Model module ClassMethods def graphql @graphql ||= Model::Configuration.new(self) yield(@graphql) if block_given? @graphql end end end end
Version data entries
13 entries across 13 versions & 1 rubygems