Method: Elementor::ElementSet#with_attrs

Defined in:
lib/elementor/element_set.rb

#with_attrs(options = {}) ⇒ Object Also known as: attrs

Attribute filtering using hashes. See the specs for examples.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/elementor/element_set.rb', line 59

def with_attrs(options={})
  filter do |item|
    options.all? do |key, value|
      case value
      when Regexp then item[key.to_s] =~ value
      when String then item[key.to_s] == value
      else item[key.to_s] == value.to_s
      end
    end
  end
end