Sha256: 08f4790c7ba7b0bc17bbc5ae6d645653ed084595df908518fff1cce68c137799
Contents?: true
Size: 629 Bytes
Versions: 2
Compression:
Stored size: 629 Bytes
Contents
# frozen_string_literal: true module Mutant class Matcher # Matcher for all descendants by constant name class Descendants < self include Anima.new(:const_name) def call(env) const = env.world.try_const_get(const_name) or return EMPTY_ARRAY Chain.new( matchers: matched_scopes(env, const).map { |scope| Scope.new(scope:) } ).call(env) end private def matched_scopes(env, const) env.matchable_scopes.select do |scope| scope.raw.equal?(const) || const > scope.raw end end end # Descendant end # Matcher end # Mutant
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mutant-0.12.4 | lib/mutant/matcher/descendants.rb |
mutant-0.12.3 | lib/mutant/matcher/descendants.rb |