Class: Xommelier::Xml::Namespace
- Inherits:
-
Object
- Object
- Xommelier::Xml::Namespace
- Defined in:
- lib/xommelier/xml/namespace.rb
Instance Attribute Summary (collapse)
-
- (Object) attributes
readonly
Returns the value of attribute attributes.
-
- (Object) elements
readonly
Returns the value of attribute elements.
-
- (Object) options
Returns the value of attribute options.
-
- (Object) uri
(also: #to_s)
readonly
Returns the value of attribute uri.
Instance Method Summary (collapse)
- - (Object) as
- - (Object) attribute_name
- - (Boolean) default?
-
- (Namespace) initialize(uri, options = {}, &block)
constructor
A new instance of Namespace.
- - (Object) inspect
- - (Object) module
- - (Object) ns
- - (Object) schema
- - (Object) scoped(&block)
- - (Object) to_hash
Constructor Details
- (Namespace) initialize(uri, options = {}, &block)
A new instance of Namespace
11 12 13 14 15 16 17 18 |
# File 'lib/xommelier/xml/namespace.rb', line 11 def initialize(uri, = {}, &block) @uri = uri @options = {} @as = .delete(:as) self. = scoped(&block) if block_given? end |
Instance Attribute Details
- (Object) attributes (readonly)
Returns the value of attribute attributes
8 9 10 |
# File 'lib/xommelier/xml/namespace.rb', line 8 def attributes @attributes end |
- (Object) elements (readonly)
Returns the value of attribute elements
8 9 10 |
# File 'lib/xommelier/xml/namespace.rb', line 8 def elements @elements end |
- (Object) options
Returns the value of attribute options
8 9 10 |
# File 'lib/xommelier/xml/namespace.rb', line 8 def @options end |
- (Object) uri (readonly) Also known as: to_s
Returns the value of attribute uri
8 9 10 |
# File 'lib/xommelier/xml/namespace.rb', line 8 def uri @uri end |
Instance Method Details
- (Object) as
20 21 22 |
# File 'lib/xommelier/xml/namespace.rb', line 20 def as @as unless default? end |
- (Object) attribute_name
58 59 60 |
# File 'lib/xommelier/xml/namespace.rb', line 58 def attribute_name default? ? 'xmlns' : "xmlns:#{as}" end |
- (Boolean) default?
50 51 52 |
# File 'lib/xommelier/xml/namespace.rb', line 50 def default? uri.to_s == DEFAULT_NS end |
- (Object) inspect
62 63 64 |
# File 'lib/xommelier/xml/namespace.rb', line 62 def inspect %(#{attribute_name}="#{uri}") end |
- (Object) module
38 39 40 |
# File 'lib/xommelier/xml/namespace.rb', line 38 def module [:module] end |
- (Object) ns
24 25 26 |
# File 'lib/xommelier/xml/namespace.rb', line 24 def ns Xommelier::Xml::Namespace.registry end |
- (Object) schema
42 43 44 |
# File 'lib/xommelier/xml/namespace.rb', line 42 def schema self.module.schema end |
- (Object) scoped(&block)
46 47 48 |
# File 'lib/xommelier/xml/namespace.rb', line 46 def scoped(&block) instance_exec(&block) end |
- (Object) to_hash
54 55 56 |
# File 'lib/xommelier/xml/namespace.rb', line 54 def to_hash {as.to_s => uri.to_s} end |