Sha256: c0ee493abb84641d19fe122811ec286d6d222db104fbb02e8ecb0b4965689bbc
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
breadcrumbs-0.1.6 | lib/breadcrumbs/render/base.rb |
breadcrumbs-0.1.5 | lib/breadcrumbs/render/base.rb |