Class: Trout::VersionList

Inherits:
Object
  • Object
show all
Defined in:
lib/trout/version_list.rb

Constant Summary collapse

FILE_VERSION =
'1.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ VersionList

Returns a new instance of VersionList.



10
11
12
# File 'lib/trout/version_list.rb', line 10

def initialize(path)
  @path = path
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/trout/version_list.rb', line 8

def data
  @data
end

#filesObject

Returns the value of attribute files.



8
9
10
# File 'lib/trout/version_list.rb', line 8

def files
  @files
end

#pathObject

Returns the value of attribute path.



8
9
10
# File 'lib/trout/version_list.rb', line 8

def path
  @path
end

Instance Method Details

#<<(managed_file) ⇒ Object



26
27
28
# File 'lib/trout/version_list.rb', line 26

def <<(managed_file)
  self[managed_file.filename] = managed_file
end

#[](filename) ⇒ Object



14
15
16
17
18
# File 'lib/trout/version_list.rb', line 14

def [](filename)
  read
  attributes = files[filename] || { :filename => filename }
  ManagedFile.new(attributes)
end

#[]=(filename, managed_file) ⇒ Object



20
21
22
23
24
# File 'lib/trout/version_list.rb', line 20

def []=(filename, managed_file)
  read
  files[filename] = managed_file.to_hash
  write
end