Class: Checkm::Manifest
- Inherits:
-
Object
- Object
- Checkm::Manifest
- Defined in:
- lib/checkm.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #add(path, args = {}) ⇒ Object
-
#initialize(checkm, args = {}) ⇒ Manifest
constructor
A new instance of Manifest.
- #remove(path) ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(checkm, args = {}) ⇒ Manifest
Returns a new instance of Manifest.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/checkm.rb', line 35 def initialize checkm, args = {} @args = args @version = nil @checkm = checkm @lines = checkm.split "\n" @entries = [] @eof = false @fields= nil @path = args[:path] @path ||= Dir.pwd parse_lines # xxx error on empty entries? @lines.unshift('#%checkm_0.7') and @version = '0.7' if @version.nil? end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
31 32 33 |
# File 'lib/checkm.rb', line 31 def entries @entries end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
32 33 34 |
# File 'lib/checkm.rb', line 32 def fields @fields end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
33 34 35 |
# File 'lib/checkm.rb', line 33 def path @path end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
30 31 32 |
# File 'lib/checkm.rb', line 30 def version @version end |
Class Method Details
Instance Method Details
#add(path, args = {}) ⇒ Object
56 57 58 59 60 |
# File 'lib/checkm.rb', line 56 def add path, args = {} line = Checkm::Entry.create path, args Checkm::Manifest.new [@lines, line].flatten.join("\n"), @args end |
#remove(path) ⇒ Object
62 63 64 |
# File 'lib/checkm.rb', line 62 def remove path Checkm::Manifest.new @lines.reject { |x| x =~ /^@?#{path}/ }.join("\n"), @args end |
#to_s ⇒ Object
66 67 68 |
# File 'lib/checkm.rb', line 66 def to_s @lines.join("\n") end |
#valid? ⇒ Boolean
51 52 53 54 |
# File 'lib/checkm.rb', line 51 def valid? return true if @entries.empty? not @entries.map { |e| e.valid? }.any? { |b| b == false } end |