free_mutant/lib/mutant/ast/meta/optarg.rb
John Backus 15ced2aed0 Move AST::Meta descendants to their own files
The AST::Meta was a class or two away from exceeding the rubocop
ClassLength limit so this seems like a necessary reorganization.
2015-08-19 21:02:18 -04:00

26 lines
527 B
Ruby

module Mutant
module AST
# Node meta information mixin
module Meta
# Metadata for optional argument nodes
class Optarg
include NamedChildren, Concord.new(:node)
UNDERSCORE = '_'.freeze
children :name, :default_value
# Test if optarg definition intends to be used
#
# @return [Boolean]
#
# @api private
def used?
!name.to_s.start_with?(UNDERSCORE)
end
end # Optarg
end # Meta
end # AST
end # Mutant