class Undies::Element::Closed

Public Class Methods

new(name, attrs={}) click to toggle source
# File lib/undies/element.rb, line 140
def initialize(name, attrs={})
  @name    = name.to_s
  @attrs   = {}
  proxy([attrs])
end

Public Instance Methods

==(other) click to toggle source
# File lib/undies/element.rb, line 163
def ==(other)
  other.instance_variable_get("@name")  == @name  &&
  other.instance_variable_get("@attrs") == @attrs
end
__build() click to toggle source

closed elements should have no build so do nothing

# File lib/undies/element.rb, line 154
def __build; end
__content() click to toggle source

closed elements have no content

# File lib/undies/element.rb, line 151
def __content; ''; end
__end_tag() click to toggle source

closed elements have no end tag

# File lib/undies/element.rb, line 157
def __end_tag; ''; end
__start_tag() click to toggle source
# File lib/undies/element.rb, line 146
def __start_tag
  "<#{@name}#{Undies::Element.hash_attrs(@attrs)} />"
end
inspect(*args)
Alias for: to_str
to_s() click to toggle source
# File lib/undies/element.rb, line 159
def to_s
  Undies::Raw.new("#{__start_tag}")
end
to_str(*args) click to toggle source

overriding this because the base Node class defines a 'to_s' method that needs to be honored

# File lib/undies/element.rb, line 170
def to_str(*args)
  "Undies::Element::Closed:#{self.object_id} " +
  "@name=#{@name.inspect}, @attrs=#{@attrs.inspect}"
end
Also aliased as: inspect

Private Instance Methods

proxy(args, build=nil) click to toggle source
# File lib/undies/element.rb, line 178
def proxy(args, build=nil)
  @attrs.merge!(args.last || {})
  self
end