Class: Jekyll::Cargodoc::Crate
- Inherits:
-
Object
- Object
- Jekyll::Cargodoc::Crate
- Defined in:
- lib/jekyll/cargodoc.rb
Instance Attribute Summary collapse
-
#destination_root ⇒ Object
readonly
Returns the value of attribute destination_root.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #dependency_line ⇒ Object
- #dependency_section ⇒ Object
- #doc_files_paths(root) ⇒ Object
-
#initialize(config) ⇒ Crate
constructor
A new instance of Crate.
Constructor Details
#initialize(config) ⇒ Crate
Returns a new instance of Crate.
8 9 10 11 12 13 |
# File 'lib/jekyll/cargodoc.rb', line 8 def initialize(config) @name = config['crate'] || '' @version = config['version'] || '*' @destination_root = config['destination_root'] || name @git = config['git'] end |
Instance Attribute Details
#destination_root ⇒ Object (readonly)
Returns the value of attribute destination_root.
6 7 8 |
# File 'lib/jekyll/cargodoc.rb', line 6 def destination_root @destination_root end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/jekyll/cargodoc.rb', line 6 def name @name end |
Instance Method Details
#dependency_line ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/jekyll/cargodoc.rb', line 23 def dependency_line if !@git.nil? "git = \"#{@git}\"" else "#{@name} = \"#{@version}\"\n" end end |
#dependency_section ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/jekyll/cargodoc.rb', line 15 def dependency_section section = "\n[dependencies" section << ".#{name}" unless @git.nil? section << "]\n" section end |
#doc_files_paths(root) ⇒ Object
31 32 33 34 35 |
# File 'lib/jekyll/cargodoc.rb', line 31 def doc_files_paths(root) Dir.chdir("#{root}/#{name}") do Dir.glob("**/*").reject { |path| Dir.exist?(path) } end end |