Skip to content

Commit

Permalink
Model#each
Browse files Browse the repository at this point in the history
  • Loading branch information
mosop committed Jan 19, 2017
1 parent bc80bc3 commit f4d1d32
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions src/optarg/model.cr
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
module Optarg
abstract class Model
# macro define_dynamic_definition(df)
# {%
# df = df.resolve if df.class_name == "Path"
# local = df.name.split("::").last.id
# %}
#
# class Class
# def with_definition(df : ::{{df}})
# yield Dynamic{{local}}.new(df)
# end
# end
#
# class Dynamic{{local}}
# getter definition : ::{{df}}
#
# def initialize(@definition)
# end
#
# def on_validate(&block : Dynamic{{local}}Context ->)
# this = self
# Parser.on_validate do |parser|
# block.call Dynamic{{local}}Context.new(parser, this.definition)
# end
# end
# end
#
# class Dynamic{{local}}Context < DynamicDefinitionContext
# include ::{{df}}::DynamicContext
#
# getter definition : ::{{df}}
# end
# end

macro inherited
{% if @type.superclass == ::Optarg::Model %}
{%
Expand Down Expand Up @@ -176,6 +143,12 @@ module Optarg
__parser.parsed_args[index]?
end

def each
__parser.parsed_args.each do |i|
yield i
end
end

def self.__with_self(*args)
with self yield *args
end
Expand Down

0 comments on commit f4d1d32

Please sign in to comment.