Class: Coradoc::Element::AttributeList::Matchers::Many

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/element/attribute_list.rb

Overview

TODO: Find a way to only reject some values but not all?

Instance Method Summary collapse

Constructor Details

#initialize(*possibilities) ⇒ Many

Returns a new instance of Many.



123
124
125
# File 'lib/coradoc/element/attribute_list.rb', line 123

def initialize(*possibilities)
  @possibilities = possibilities
end

Instance Method Details

#===(other) ⇒ Object



127
128
129
130
131
132
# File 'lib/coradoc/element/attribute_list.rb', line 127

def ===(other)
  other = other.split(",") if other.is_a?(String)

  other.is_a?(Array) &&
    other.all? { |i| @possibilities.any? { |p| p === i } }
end