class Haml::Parser
def merge_value(key, to, from)
-
(String, Hash)
-
Parameters:
-
from
(Object
) -- -
to
(String, Hash, nil
) --
def merge_value(key, to, from) if from.kind_of?(Hash) || to.kind_of?(Hash) from = { nil => from } if !from.is_a?(Hash) to = { nil => to } if !to.is_a?(Hash) to.merge(from) elsif key == 'id' merged_id = filter_and_join(from, '_') if to && merged_id merged_id = "#{to}_#{merged_id}" elsif to || merged_id merged_id ||= to end merged_id elsif key == 'class' merged_class = filter_and_join(from, ' ') if to && merged_class merged_class = (to.split(' ') | merged_class.split(' ')).join(' ') elsif to || merged_class merged_class ||= to end merged_class else from end end