Method: RichText::Attributes.compose

Defined in:
lib/rich-text/attributes.rb

.compose(a, b, keep_nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
10
11
# File 'lib/rich-text/attributes.rb', line 5

def compose(a, b, keep_nil)
  return b if a.nil?
  return a if b.nil?
  result = b.merge(a) { |k,vb,va| vb }
  result.delete_if { |k,v| v.nil? } unless keep_nil
  result
end