free_mutant/lib/mutant/ast/meta/optarg.rb
2016-03-21 21:44:07 +00:00

26 lines
532 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
public :name, :default_value
# Test if optarg definition intends to be used
#
# @return [Boolean]
def used?
!name.to_s.start_with?(UNDERSCORE)
end
end # Optarg
end # Meta
end # AST
end # Mutant