Class: Orthor::Object
Instance Attribute Summary collapse
Instance Method Summary
collapse
#cache_for
Constructor Details
#initialize(path, options = {}) ⇒ Object
Returns a new instance of Object.
9
10
11
12
13
14
15
16
|
# File 'lib/orthor/object.rb', line 9
def initialize(path, options = {})
@path = path
raise ArgumentError, "Path required" unless @path
options.each { |key, val| send(key, val) }
@id ||= @path.split("/").last
@template ||= Orthor::Site.current_template
end
|
Instance Attribute Details
Returns the value of attribute path.
6
7
8
|
# File 'lib/orthor/object.rb', line 6
def path
@path
end
|
Instance Method Details
18
19
20
|
# File 'lib/orthor/object.rb', line 18
def content
fetch_content
end
|
#fetch_content ⇒ Object
30
31
32
|
# File 'lib/orthor/object.rb', line 30
def fetch_content
raise "This must be overriden in any Orthor::Object subclass"
end
|
#path_name ⇒ Object
26
27
28
|
# File 'lib/orthor/object.rb', line 26
def path_name
@id.gsub(/[^a-z0-9]+/i, '_')
end
|
22
23
24
|
# File 'lib/orthor/object.rb', line 22
def title
""
end
|