Class: Octopress::Docs::Doc
- Inherits:
-
Object
- Object
- Octopress::Docs::Doc
- Defined in:
- lib/octopress-docs/doc.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#plugin_name ⇒ Object
readonly
Returns the value of attribute plugin_name.
-
#plugin_type ⇒ Object
readonly
Returns the value of attribute plugin_type.
-
#source_url ⇒ Object
readonly
Returns the value of attribute source_url.
Instance Method Summary collapse
-
#add ⇒ Object
Add doc page to Jekyll pages.
- #disabled? ⇒ Boolean
- #file ⇒ Object
- #info ⇒ Object
-
#initialize(options = {}) ⇒ Doc
constructor
A new instance of Doc.
- #page ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Doc
Returns a new instance of Doc.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/octopress-docs/doc.rb', line 6 def initialize(={}) @file = [:file] @path = [:path] ||= '.' @file_dir = File.dirname(@file) @plugin_name = [:name] @plugin_slug = [:slug] @plugin_type = [:type] @base_url = [:base_url] @source_url = [:source_url] @description = [:description] @data = [:data] || {} end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def base_url @base_url end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def description @description end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def filename @filename end |
#plugin_name ⇒ Object (readonly)
Returns the value of attribute plugin_name.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def plugin_name @plugin_name end |
#plugin_type ⇒ Object (readonly)
Returns the value of attribute plugin_type.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def plugin_type @plugin_type end |
#source_url ⇒ Object (readonly)
Returns the value of attribute source_url.
4 5 6 |
# File 'lib/octopress-docs/doc.rb', line 4 def source_url @source_url end |
Instance Method Details
#add ⇒ Object
Add doc page to Jekyll pages
21 22 23 |
# File 'lib/octopress-docs/doc.rb', line 21 def add Octopress.site.pages << page end |
#disabled? ⇒ Boolean
25 26 27 |
# File 'lib/octopress-docs/doc.rb', line 25 def disabled? false end |
#file ⇒ Object
29 30 31 |
# File 'lib/octopress-docs/doc.rb', line 29 def file File.basename(@file) end |
#info ⇒ Object
33 34 35 |
# File 'lib/octopress-docs/doc.rb', line 33 def info " - #{permalink.ljust(35)}" end |
#page ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/octopress-docs/doc.rb', line 37 def page @page ||= begin p = Octopress::Docs::Page.new(Octopress.site, @path, page_dir, file, {'path'=>@base_url}) p.data['layout'] = 'docs' p.data['escape_code'] = true p.data['plugin'] = { 'name' => @plugin_name, 'slug' => @plugin_slug, 'type' => @plugin_type, 'source_url' => @source_url, 'description' => @description, 'url' => @base_url } p.data['dir'] = doc_dir p.data = @data.merge(p.data) p.data.merge!(comment_yaml(p.content)) p end end |