From e66c0abcfb2b9b6e69ebc3b2c6a95c744d22b2c8 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 19 Jan 2019 14:17:28 -0700 Subject: [PATCH] Change `described_class` to a macro --- src/spectator/dsl/structure_dsl.cr | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/spectator/dsl/structure_dsl.cr b/src/spectator/dsl/structure_dsl.cr index 17e1d21..8a69acf 100644 --- a/src/spectator/dsl/structure_dsl.cr +++ b/src/spectator/dsl/structure_dsl.cr @@ -258,12 +258,8 @@ module Spectator::DSL # Need to investigate, but would also increase minimum version. {% if what.is_a?(Path) || what.is_a?(Generic) %} # Returns the type currently being described. - def described_class - {{what}}.tap do |thing| - # Runtime check to ensure that `what` is a type. - raise "#{thing} must be a type name to use #described_class or #subject,\ - but it is a #{typeof(thing)}" unless thing.is_a?(Class) - end + macro described_class + {{what}} end # Implicit subject definition.