Method: Nokogiri::XML::Node#classes
- Defined in:
- lib/nokogiri/xml/node.rb
#classes ⇒ Object
:call-seq: classes() → Array<String>
Fetch CSS class names of a Node.
This is a convenience function and is equivalent to:
node.kwattr_values("class")
See related: #kwattr_values, #add_class, #append_class, #remove_class
- Returns
-
The CSS classes (Array of String) present in the Node’s “class” attribute. If the attribute is empty or non-existent, the return value is an empty array.
Example
node # => <div class="section title header"></div>
node.classes # => ["section", "title", "header"]
744 745 746 |
# File 'lib/nokogiri/xml/node.rb', line 744 def classes kwattr_values("class") end |