Method: CSL::Node#attributes_for

Defined in:
lib/csl/node.rb

#attributes_for(*filter) ⇒ Hash

Returns the node’s attributes matching the filter.

Parameters:

  • filter (Hash)

    a customizable set of options

Options Hash (*filter):

  • a (Array)

    list of attribute names

Returns:

  • (Hash)

    the node’s attributes matching the filter



427
428
429
430
431
432
433
# File 'lib/csl/node.rb', line 427

def attributes_for(*filter)
  filter.flatten!

  Hash[map { |name, value|
    !value.nil? && filter.include?(name) ? [name, value.to_s] : nil
  }.compact]
end