Remove extra block body leftover from debug

Update docs to show example of default method implementation.
This commit is contained in:
Michael Miller 2022-03-19 12:37:46 -06:00
parent 25f546245a
commit d40040c8ee
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2

View file

@ -39,6 +39,11 @@ module Spectator
# ``` # ```
# Double.define(SomeDouble, meth1: 42, meth2: "foobar") do # Double.define(SomeDouble, meth1: 42, meth2: "foobar") do
# stub abstract def meth3 : Symbol # stub abstract def meth3 : Symbol
#
# # Default implementation with a dynamic value.
# stub def meth4
# Time.utc
# end
# end # end
# ``` # ```
macro define(type_name, name = nil, **value_methods, &block) macro define(type_name, name = nil, **value_methods, &block)
@ -50,7 +55,7 @@ module Spectator
end end
{% end %} {% end %}
{% if block %}{% block.body %} {% if block %}
{% for expr in block.body.is_a?(Expressions) ? block.body.expressions : [block.body] %} {% for expr in block.body.is_a?(Expressions) ? block.body.expressions : [block.body] %}
{% if expr.is_a?(Call) && expr.name == :stub.id %} {% if expr.is_a?(Call) && expr.name == :stub.id %}
inject_{{expr}} inject_{{expr}}