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.
-
#gem ⇒ Object
readonly
Returns the value of attribute gem.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#source_url ⇒ Object
readonly
Returns the value of attribute source_url.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
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 18 19 |
# File 'lib/octopress/docs/doc.rb', line 6 def initialize(={}) @file = [:file] @path = [:path] ||= '.' @file_dir = File.dirname(@file) @name = [:name] @slug = [:slug] @type = [:type] @base_url = [:base_url] @source_url = [:source_url] @description = [:description] @data = [:data] || {} @gem = [:gem] @version = [:version] 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 |
#gem ⇒ Object (readonly)
Returns the value of attribute gem.
4 5 6 |
# File 'lib/octopress/docs/doc.rb', line 4 def gem @gem end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/octopress/docs/doc.rb', line 4 def name @name end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
4 5 6 |
# File 'lib/octopress/docs/doc.rb', line 4 def slug @slug 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 |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/octopress/docs/doc.rb', line 4 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/octopress/docs/doc.rb', line 4 def version @version end |
Instance Method Details
#add ⇒ Object
Add doc page to Jekyll pages
23 24 25 |
# File 'lib/octopress/docs/doc.rb', line 23 def add Octopress.site.pages << page end |
#disabled? ⇒ Boolean
27 28 29 |
# File 'lib/octopress/docs/doc.rb', line 27 def disabled? false end |
#file ⇒ Object
31 32 33 |
# File 'lib/octopress/docs/doc.rb', line 31 def file File.basename(@file) end |
#info ⇒ Object
35 36 37 |
# File 'lib/octopress/docs/doc.rb', line 35 def info " - #{permalink.ljust(35)}" end |
#page ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/octopress/docs/doc.rb', line 39 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' => @name, 'slug' => @slug, 'type' => @type, 'source_url' => @source_url, 'description' => @description, 'url' => @base_url, 'version' => @version, 'gem' => @gem, } p.data['dir'] = doc_dir p.data = @data.merge(p.data) p.data.merge!(comment_yaml(p.content)) p end end |