module Ecoportal module API module Common module GraphQL module ClassHelpers module InstanceMethods def becomes(klass) klass.new.tap do |becoming| instance_variables.each do |var| becoming.instance_variable_set(var, instance_variable_get(var)) end end end def becomes_parent_class becomes(self.class.superclass) end end module ClassMethods include Ecoportal::API::Common::Content::ClassHelpers def const?(value) begin const_get(value) rescue NameError => e return false end true end end class << self def included(base) base.send(:include, InstanceMethods) base.extend(ClassMethods) end end end end end end end