Class: Rake::Pipeline::ManifestEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/rake-pipeline/manifest_entry.rb

Overview

Represents a single entry in a dynamic dependency Manifest.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deps = {}, mtime = nil) ⇒ ManifestEntry

Returns a new instance of ManifestEntry.



20
21
22
# File 'lib/rake-pipeline/manifest_entry.rb', line 20

def initialize(deps={}, mtime=nil)
  @deps, @mtime = deps, mtime
end

Instance Attribute Details

#depsObject

Returns the value of attribute deps.



18
19
20
# File 'lib/rake-pipeline/manifest_entry.rb', line 18

def deps
  @deps
end

#mtimeObject

Returns the value of attribute mtime.



18
19
20
# File 'lib/rake-pipeline/manifest_entry.rb', line 18

def mtime
  @mtime
end

Class Method Details

.from_hash(hash) ⇒ Object

Create a new entry from the given hash.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rake-pipeline/manifest_entry.rb', line 6

def self.from_hash(hash)
  entry = new

  entry.mtime = DateTime.parse(hash["mtime"]).to_time

  hash["deps"].each do |dep, time_string|
    entry.deps[dep] = DateTime.parse(time_string).to_time
  end

  entry
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
# File 'lib/rake-pipeline/manifest_entry.rb', line 28

def ==(other)
  mtime == other.mtime
  deps == other.deps
end

#as_jsonObject



24
25
26
# File 'lib/rake-pipeline/manifest_entry.rb', line 24

def as_json
  { :deps => @deps, :mtime => @mtime }
end