Class: Rng::NamespaceDeclaration
- Inherits:
-
Object
- Object
- Rng::NamespaceDeclaration
- Defined in:
- lib/rng/namespace_declaration.rb
Overview
Represents a namespace declaration in RNC
Supports both default and prefixed namespace declarations:
-
default namespace = “uri”
-
default namespace prefix = “uri”
-
namespace prefix = “uri”
Instance Attribute Summary collapse
-
#is_default ⇒ Object
readonly
Returns the value of attribute is_default.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#default? ⇒ Boolean
Check if this is the default namespace.
-
#initialize(uri:, prefix: nil, is_default: false) ⇒ NamespaceDeclaration
constructor
Initialize a namespace declaration.
-
#prefixed? ⇒ Boolean
Check if this namespace has a prefix.
Constructor Details
#initialize(uri:, prefix: nil, is_default: false) ⇒ NamespaceDeclaration
Initialize a namespace declaration
27 28 29 30 31 |
# File 'lib/rng/namespace_declaration.rb', line 27 def initialize(uri:, prefix: nil, is_default: false) @prefix = prefix @uri = uri @is_default = is_default end |
Instance Attribute Details
#is_default ⇒ Object (readonly)
Returns the value of attribute is_default.
20 21 22 |
# File 'lib/rng/namespace_declaration.rb', line 20 def is_default @is_default end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
20 21 22 |
# File 'lib/rng/namespace_declaration.rb', line 20 def prefix @prefix end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
20 21 22 |
# File 'lib/rng/namespace_declaration.rb', line 20 def uri @uri end |
Instance Method Details
#default? ⇒ Boolean
Check if this is the default namespace
36 37 38 |
# File 'lib/rng/namespace_declaration.rb', line 36 def default? @is_default end |
#prefixed? ⇒ Boolean
Check if this namespace has a prefix
43 44 45 |
# File 'lib/rng/namespace_declaration.rb', line 43 def prefixed? !@prefix.nil? end |