Class: CouchDB::Design
- Defined in:
- lib/couchdb/design.rb,
lib/couchdb/design/view.rb
Overview
See CouchDB::Design class for description.
Defined Under Namespace
Classes: View, ViewsProxy
Instance Attribute Summary collapse
-
#language ⇒ Object
Returns the value of attribute language.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Attributes inherited from Document
Instance Method Summary collapse
- #id ⇒ Object
- #id=(value) ⇒ Object
-
#initialize(database, id, language = "javascript") ⇒ Design
constructor
A new instance of Design.
- #url ⇒ Object
Methods inherited from Document
#==, #[], #[]=, #clear_rev, #destroy, #exists?, #fetch_rev, #load, #new?, #rev, #rev=, #rev?, #save
Constructor Details
#initialize(database, id, language = "javascript") ⇒ Design
Returns a new instance of Design.
12 13 14 15 16 |
# File 'lib/couchdb/design.rb', line 12 def initialize(database, id, language = "javascript") super database self.id, self.language = id, language @views = ViewsProxy.new self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CouchDB::Document
Instance Attribute Details
#language ⇒ Object
Returns the value of attribute language.
9 10 11 |
# File 'lib/couchdb/design.rb', line 9 def language @language end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
10 11 12 |
# File 'lib/couchdb/design.rb', line 10 def views @views end |
Instance Method Details
#id ⇒ Object
18 19 20 21 |
# File 'lib/couchdb/design.rb', line 18 def id id = super id ? id.sub(/^_design\//, "") : nil end |
#id=(value) ⇒ Object
23 24 25 |
# File 'lib/couchdb/design.rb', line 23 def id=(value) super((value =~ /^_design\//) ? value : "_design/#{value}") end |
#url ⇒ Object
35 36 37 |
# File 'lib/couchdb/design.rb', line 35 def url "#{self.database.url}/_design/#{self.id}" end |