class Haml::Buffer
def self.merge_attrs(to, from)
-
({String => String})
- `to`, after being merged
Parameters:
-
from
({String => String}
) -- The attribute hash to merge from -
to
({String => String}
) -- The attribute hash to merge into
def self.merge_attrs(to, from) if to['id'] && from['id'] to['id'] << '_' << from.delete('id').to_s elsif to['id'] || from['id'] from['id'] ||= to['id'] end if to['class'] && from['class'] # Make sure we don't duplicate class names from['class'] = (from['class'].split(' ') | to['class'].split(' ')).sort.join(' ') elsif to['class'] || from['class'] from['class'] ||= to['class'] end to.merge!(from) end