Hide method to infer type of first in collection in given macro

This was a bit of a hack.
This commit is contained in:
Michael Miller 2018-09-15 23:38:07 -06:00
parent 80fbe89b4c
commit fa73bf3a60

View file

@ -64,11 +64,15 @@ module Spectator
{{collection}} {{collection}}
end end
def self.{{var_name}} def self.%first
%collection.first %collection.first
end end
\{% ::Spectator::Definitions::ALL[@type.id][:given] << {name: "{{var_name}}".id, collection: "{{collection}}".id, type_def: (@type.id + ".{{var_name}}").id} %} \{% ::Spectator::Definitions::ALL[@type.id][:given] << {
name: "{{var_name}}".id,
collection: "{{collection}}".id,
type_def: (@type.id + '.' + :%first.stringify[1..-1]).id
} %}
{{block.body}} {{block.body}}
end end