Sha256: 26a88f70f8da658db2b68cf025556832ab44804f08c45031735de2204589d6d4
Contents?: true
Size: 1.08 KB
Versions: 28
Compression:
Stored size: 1.08 KB
Contents
module EbnfArguments class Argument < Treetop::Runtime::SyntaxNode def name text_value.strip end def optional? false end def default_value nil end def flatten_nested_args [self] end end class OptionalArgument < Treetop::Runtime::SyntaxNode def name required_argument.name end def optional? true end def default_value unless default.empty? value = default.value.text_value.strip value.empty? ? nil : value end end def flatten_nested_args arguments = [self] unless nested.empty? nested.elements.each do |optional| arguments.concat(optional.flatten_nested_args) end end arguments end end class Arguments < Treetop::Runtime::SyntaxNode def to_a first_argument.flatten_nested_args + rest_arguments_flattened end def rest_arguments_flattened rest.elements.inject([]) do |args, e| args.concat(e.argument.flatten_nested_args) end end end end
Version data entries
28 entries across 28 versions & 2 rubygems