Class: Atom::Namespace
- Inherits:
-
Object
- Object
- Atom::Namespace
- Defined in:
- lib/atomutil.rb
Overview
Namespace Object Class
Example:
namespace = Atom::Namespace.new(:prefix => 'dc', :uri => 'http://purl.org/dc/elements/1.1/')
# you can omit prefix
# namespace = Atom::Namespace.new(:uri => 'http://purl.org/dc/elements/1.1/')
puts namespace.prefix # dc
puts namespace.uri # http://purl.org/dc/elements/1.1/
Mager namespaces are already set as constants. You can use them directly without making new Atom::Namespace instance
Constant Summary collapse
- ATOM =
Atom namespace
self.new :uri => 'http://www.w3.org/2005/Atom'
- ATOM_WITH_PREFIX =
Atom namespace using prefix
self.new :prefix => 'atom', :uri => 'http://www.w3.org/2005/Atom'
- OBSOLETE_ATOM =
Atom namespace for version 0.3
self.new :uri => 'http://purl.org/atom/ns#'
- OBSOLETE_ATOM_WITH_PREFIX =
Atom namespace for version 0.3 using prefix
self.new :prefix => 'atom', :uri => 'http://purl.org/atom/ns#'
- APP =
Atom app namespace
self.new :uri => 'http://www.w3.org/2007/app'
- APP_WITH_PREFIX =
Atom app namespace with prefix
self.new :prefix => 'app', :uri => 'http://www.w3.org/2007/app'
- OBSOLETE_APP =
Atom app namespace for version 0.3
self.new :uri => 'http://purl.org/atom/app#'
- OBSOLETE_APP_WITH_PREFIX =
Atom app namespace for version 0.3 with prefix
self.new :prefix => 'app', :uri => 'http://purl.org/atom/app#'
- DC =
Dubline Core namespace
self.new :prefix => 'dc', :uri => 'http://purl.org/dc/elements/1.1/'
- OPEN_SEARCH =
Open Search namespace that is often used for pagination
self.new :prefix => 'openSearch', :uri => 'http://a9.com/-/spec/opensearchrss/1.1/'
- RDF =
self.new :prefix => 'rdf', :uri => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
- FOAF =
self.new :prefix => 'foaf', :uri => 'http://xmlns.com/foaf/0.1'
- THR =
self.new :prefix => 'thr', :uri => 'http://purl.org/syndication/thread/1.0'
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(params) ⇒ Namespace
constructor
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(params) ⇒ Namespace
:nodoc:
121 122 123 124 |
# File 'lib/atomutil.rb', line 121 def initialize(params) #:nodoc: @prefix, @uri = params[:prefix], params[:uri] raise ArgumentError.new(%Q<:uri is not found.>) if @uri.nil? end |
Instance Attribute Details
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
120 121 122 |
# File 'lib/atomutil.rb', line 120 def prefix @prefix end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
120 121 122 |
# File 'lib/atomutil.rb', line 120 def uri @uri end |
Instance Method Details
#to_s ⇒ Object
:nodoc:
125 126 127 |
# File 'lib/atomutil.rb', line 125 def to_s #:nodoc: @uri end |