Object
@api private
# File lib/slim/splat/builder.rb, line 37 def attr(name, value) if @attrs[name] if delim = @options[:merge_attrs][name] @attrs[name] << delim << value else raise("Multiple #{name} attributes specified") end else @attrs[name] = value end end
# File lib/slim/splat/builder.rb, line 59 def build_attrs attrs = @options[:sort_attrs] ? @attrs.sort_by(&:first) : @attrs attrs.map do |k, v| " #{k}=#{@options[:attr_quote]}#{v}#{@options[:attr_quote]}" end.join end
# File lib/slim/splat/builder.rb, line 49 def build_tag tag = @attrs.delete('tag').to_s tag = @options[:default_tag] if tag.empty? if block_given? "<#{tag}#{build_attrs}>#{yield}</#{tag}>" else "<#{tag}#{build_attrs} />" end end
# File lib/slim/splat/builder.rb, line 10 def code_attr(name, escape, value) if delim = @options[:merge_attrs][name] value = Array === value ? value.join(delim) : value.to_s attr(name, escape ? Temple::Utils.escape_html(value) : value) unless value.empty? elsif @options[:hyphen_attrs].include?(name) && Hash === value hyphen_attr(name, escape, value) else case value when false, nil # Boolean false attribute return when true # Boolean true attribute value = '' else value = value.to_s end attr(name, escape ? Temple::Utils.escape_html(value) : value) end end
Generated with the Darkfish Rdoc Generator 2.