Class: Rubble::Resource::Base
- Inherits:
-
Object
- Object
- Rubble::Resource::Base
show all
- Defined in:
- lib/rubble/resource/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, *params) ⇒ Base
Returns a new instance of Base.
10
11
12
|
# File 'lib/rubble/resource/base.rb', line 10
def initialize(name, *params)
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9
10
11
|
# File 'lib/rubble/resource/base.rb', line 9
def name
@name
end
|
Instance Method Details
#get_filesets ⇒ Object
28
29
30
|
# File 'lib/rubble/resource/base.rb', line 28
def get_filesets
[]
end
|
#get_version(filesets) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/rubble/resource/base.rb', line 18
def get_version(filesets)
md = Digest::SHA1.new
filesets.each do |fileset|
fileset.paths.each do |path|
md.file(path)
end
end
md.hexdigest.force_encoding('UTF-8')
end
|
#snapshot ⇒ Object
32
33
34
35
36
|
# File 'lib/rubble/resource/base.rb', line 32
def snapshot
filesets = get_filesets
version = get_version(filesets)
Snapshot.new(version, *filesets)
end
|
#to_s ⇒ Object
38
39
40
|
# File 'lib/rubble/resource/base.rb', line 38
def to_s
to_yaml
end
|
#type ⇒ Object
14
15
16
|
# File 'lib/rubble/resource/base.rb', line 14
def type
self.class.name.split('::').last.downcase
end
|