Class: Moxml::Declaration

Inherits:
Node
  • Object
show all
Defined in:
lib/moxml/declaration.rb

Constant Summary collapse

ALLOWED_VERSIONS =
["1.0", "1.1"].freeze
ALLOWED_STANDALONE =
%w[yes no].freeze
ALLOWED_ATTRIBUTES =
%w[version encoding standalone].freeze

Constants inherited from Node

Node::TYPES

Instance Attribute Summary

Attributes inherited from Node

#context, #native

Instance Method Summary collapse

Methods inherited from Node

#==, #[], #add_child, #add_next_sibling, #add_previous_sibling, #at_xpath, #children, #clone, #document, #each_node, #find, #find_all, #first_child, #has_children?, #initialize, #last_child, #namespace, #namespaces, #next_sibling, #parent, #previous_sibling, #remove, #replace, #text, #to_xml, wrap, #xpath

Methods included from XmlUtils

#encode_entities, #normalize_xml_value, #validate_comment_content, #validate_declaration_encoding, #validate_declaration_standalone, #validate_declaration_version, #validate_element_name, #validate_pi_target, #validate_prefix, #validate_uri

Constructor Details

This class inherits a constructor from Moxml::Node

Instance Method Details

#declaration?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/moxml/declaration.rb', line 36

def declaration?
  true
end

#encodingObject



18
19
20
# File 'lib/moxml/declaration.rb', line 18

def encoding
  adapter.declaration_attribute(@native, "encoding")
end

#encoding=(new_encoding) ⇒ Object



22
23
24
25
# File 'lib/moxml/declaration.rb', line 22

def encoding=(new_encoding)
  adapter.validate_declaration_encoding(new_encoding)
  adapter.set_declaration_attribute(@native, "encoding", new_encoding)
end

#standaloneObject



27
28
29
# File 'lib/moxml/declaration.rb', line 27

def standalone
  adapter.declaration_attribute(@native, "standalone")
end

#standalone=(new_standalone) ⇒ Object



31
32
33
34
# File 'lib/moxml/declaration.rb', line 31

def standalone=(new_standalone)
  adapter.validate_declaration_standalone(new_standalone)
  adapter.set_declaration_attribute(@native, "standalone", new_standalone)
end

#versionObject



9
10
11
# File 'lib/moxml/declaration.rb', line 9

def version
  adapter.declaration_attribute(@native, "version")
end

#version=(new_version) ⇒ Object



13
14
15
16
# File 'lib/moxml/declaration.rb', line 13

def version=(new_version)
  adapter.validate_declaration_version(new_version)
  adapter.set_declaration_attribute(@native, "version", new_version)
end