class Oga::XML::Doctype

Class used for storing information about Doctypes.

Attributes

inline_rules[RW]

The inline doctype rules. @return [String]

name[RW]

The name of the doctype (e.g. “HTML”). @return [String]

public_id[RW]

The public ID of the doctype. @return [String]

system_id[RW]

The system ID of the doctype. @return [String]

type[RW]

The type of the doctype (e.g. “PUBLIC”). @return [String]

Public Class Methods

new(options = {}) click to toggle source

@example

dtd = Doctype.new(:name => 'html', :type => 'PUBLIC')

@param [Hash] options

@option options [String] :name @option options [String] :type @option options [String] :public_id @option options [String] :system_id

# File lib/oga/xml/doctype.rb, line 34
def initialize(options = {})
  @name         = options[:name]
  @type         = options[:type]
  @public_id    = options[:public_id]
  @system_id    = options[:system_id]
  @inline_rules = options[:inline_rules]
end

Public Instance Methods

inspect() click to toggle source

Inspects the doctype.

@return [String]

# File lib/oga/xml/doctype.rb, line 45
def inspect
  segments = []

  [:name, :type, :public_id, :system_id, :inline_rules].each do |attr|
    value = send(attr)

    if value and !value.empty?
      segments << "#{attr}: #{value.inspect}"
    end
  end

  "Doctype(#{segments.join(' ')})"
end