class Algebrick::Matchers::Or

noinspection RubyClassModuleNamingConvention

Public Instance Methods

to_s() click to toggle source
# File lib/algebrick/matchers/or.rb, line 19
def to_s
  matchers.join ' | '
end

Protected Instance Methods

children() click to toggle source
# File lib/algebrick/matchers/or.rb, line 32
def children
  super.select &:matched?
end
Also aliased as: super_children
matching?(other) click to toggle source
# File lib/algebrick/matchers/or.rb, line 25
def matching?(other)
  matchers.any? { |m| m === other }
end
super_children()
Alias for: children

Private Instance Methods

assigns_size() click to toggle source
# File lib/algebrick/matchers/or.rb, line 45
def assigns_size
  # TODO is it efficient?
  super_children.map { |ch| ch.assigns.size }.max
end
collect_assigns() click to toggle source
# File lib/algebrick/matchers/or.rb, line 38
def collect_assigns
  super.tap do |assigns|
    missing = assigns_size - assigns.size
    assigns.push(*::Array.new(missing))
  end
end