Sha256: 0fbdfe58b70a4fc5607382ea19eab94f772e74585430212f7c2609ef9d3d6d26
Contents?: true
Size: 1.67 KB
Versions: 29
Compression:
Stored size: 1.67 KB
Contents
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. module Utopia class Content # A namespace which contains tags which can be rendered within a {Document}. module Namespace def self.extended(other) other.class_exec do @named = {} end end attr :named def freeze return self if frozen? @named.freeze @named.values.each(&:freeze) super end def tag(name, klass = nil, &block) @named[name] = klass || block end # @return [Node] The node which should be used to render the named tag. def call(name, node) @named[name] end end end end
Version data entries
29 entries across 29 versions & 1 rubygems