Change described_class to a macro

This commit is contained in:
Michael Miller 2019-01-19 14:17:28 -07:00
parent 46875d7770
commit e66c0abcfb

View file

@ -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.