A tag binding is passed into each tag definition and contains helper methods for working with tags. Use it to gain access to the attributes that were passed to the tag, to render the tag contents, and to do other tasks.
The render block. When called expands the contents of the tag. Use TagBinding#expand instead.
The Context that the TagBinding is associated with. Used internally. Try not to use this object directly.
Creates a new TagBinding object.
# File lib/radius/tag_binding.rb, line 27 def initialize(context, locals, name, attributes, block) @context, @locals, @name, @attributes, @block = context, locals, name, attributes, block end
Shortcut for accessing tag.attr
# File lib/radius/tag_binding.rb, line 67 def [](key) attr[key] end
Returns true if the current tag is a container tag.
# File lib/radius/tag_binding.rb, line 42 def double? not single? end
Evaluates the current tag and returns the rendered contents.
# File lib/radius/tag_binding.rb, line 32 def expand double? ? block.call : '' end
The globals object from which all locals objects ultimately inherit their values.
# File lib/radius/tag_binding.rb, line 47 def globals @context.globals end
Fires off Context#tag_missing for the current tag.
# File lib/radius/tag_binding.rb, line 57 def missing! @context.tag_missing(name, attributes, &block) end
Returns a list of the way tags are nested around the current tag as a string.
# File lib/radius/tag_binding.rb, line 52 def nesting @context.current_nesting end
Generated with the Darkfish Rdoc Generator 2.