Sha256: 9950a7f7c8441f69f82a4d6be4ec552943d64c54f73f639435b86c785bad8758
Contents?: true
Size: 1.06 KB
Versions: 30
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Mutant class Mutator class Node # Mutator for required arguments class Argument < self handle(:arg, :kwarg) UNDERSCORE = '_' children :name private def dispatch emit_name_mutation end def emit_name_mutation return if skip? emit_name(:"#{UNDERSCORE}#{name}") end def skip? name.start_with?(UNDERSCORE) end # Mutator for optional arguments class Optional < self TYPE_MAP = { optarg: :arg, kwoptarg: :kwarg }.freeze handle(:optarg, :kwoptarg) children :name, :default private def dispatch emit_name_mutation emit_required_mutation emit_default_mutations end def emit_required_mutation emit(s(TYPE_MAP.fetch(node.type), name)) end end # Optional end # Argument end # Node end # Mutator end # Mutant
Version data entries
30 entries across 30 versions & 1 rubygems