Class: StaticDocs::Page
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- StaticDocs::Page
- Defined in:
- app/models/static_docs/page.rb
Instance Attribute Summary collapse
-
#meta ⇒ Object
Returns the value of attribute meta.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'app/models/static_docs/page.rb', line 3 def @meta end |
Class Method Details
.matched(path) ⇒ Object
6 7 8 9 |
# File 'app/models/static_docs/page.rb', line 6 def matched(path) namespace, _, namespaced_path = path.partition('/') namespaced_matched(namespaced_path, namespace) || namespaced_matched(path) || raise(ActiveRecord::RecordNotFound) end |
.namespaced_matched(path, namespace = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'app/models/static_docs/page.rb', line 11 def namespaced_matched(path, namespace = nil) if StaticDocs.namespaces.include?(namespace) path = 'index' unless path.present? where(:namespace => namespace, :path => path).first end end |
Instance Method Details
#rendered_body(context) ⇒ Object
27 28 29 |
# File 'app/models/static_docs/page.rb', line 27 def rendered_body(context) context.instance_exec(body, self, &renderer) end |
#renderer ⇒ Object
23 24 25 |
# File 'app/models/static_docs/page.rb', line 23 def renderer @renderer ||= StaticDocs.renderers[namespace].try(:fetch, extension) || StaticDocs.renderers[:default][extension] end |
#to_param ⇒ Object
31 32 33 |
# File 'app/models/static_docs/page.rb', line 31 def to_param namespace && path == 'index' ? namespace : [namespace, path].compact.join('/') end |