Sha256: 0548b3a480b89b6ec5c69fcf7a8587b55f40c1924b66541eb64da55e9497007b
Contents?: true
Size: 1019 Bytes
Versions: 1
Compression:
Stored size: 1019 Bytes
Contents
class Breadcrumbs module Render class Base # :nodoc: all attr_accessor :breadcrumbs attr_accessor :default_options def initialize(breadcrumbs, default_options = {}) @breadcrumbs = breadcrumbs @default_options = default_options end # Build a HTML tag. # # tag(:p, "Hello!") # tag(:p, "Hello!", class: "hello") # tag(:p, class: "phrase") { "Hello" } # def tag(name, *args, &block) options = args.pop if args.last.kind_of?(Hash) options ||= {} content = args.first content = self.instance_eval(&block) if block_given? attrs = " " + options.collect {|n, v| %[%s="%s"] % [n, v] }.join(" ") unless options.empty? %[<#{name}#{attrs}>#{content}</#{name}>] end protected def wrap_item(url, text, options) if url tag(:a, text, options.merge(:href => url)) else tag(:span, text, options) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
breadcrumbs-0.1.7 | lib/breadcrumbs/render/base.rb |