lib/csl/node.rb in csl-1.0.1 vs lib/csl/node.rb in csl-1.0.2
- old
+ new
@@ -291,10 +291,19 @@
# false otherwise.
def attribute?(name)
attributes.fetch(name, false)
end
+ # @param [[String]] names list of attribute names
+ # @return [Boolean] true if the node contains attributes for all
+ # passed-in names; false otherwise.
+ def attributes?(*names)
+ names.flatten(1).all? do |name|
+ attribute?(name)
+ end
+ end
+
# Returns true if the node contains any attributes (ignores nil values);
# false otherwise.
def has_attributes?
!attributes.empty?
end
@@ -539,6 +548,6 @@
"#<#{[self.class.name, text.inspect, *attribute_assignments].join(' ')}>"
end
end
-end
\ No newline at end of file
+end