lib/streamlined/helpers.rb in streamlined-0.3.0 vs lib/streamlined/helpers.rb in streamlined-0.3.1

- old
+ new

@@ -42,13 +42,15 @@ # # @param options [Hash] key-value pairs of HTML attributes (or use keyword arguments) # @param prefix_space [Boolean] add a starting space if attributes are present, # useful in tag builders # @return [String] - def html_attributes(options = nil, prefix_space: false, **kwargs) + def html_attributes(options = nil, prefix_space: false, **kwargs) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity options ||= kwargs segments = [] options.each do |attr, option| + next if option == false || option.nil? + attr = dashed(attr) if option.is_a?(Hash) option = option.transform_keys { |key| "#{attr}-#{dashed(key)}" } segments << html_attributes(option) else