Class: VersionInfo::Storage
- Inherits:
-
Object
- Object
- VersionInfo::Storage
show all
- Defined in:
- lib/version_info/storage.rb
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Storage
Returns a new instance of Storage.
4
5
6
7
|
# File 'lib/version_info/storage.rb', line 4
def initialize(data)
super()
@data = data
end
|
Instance Method Details
#data ⇒ Object
9
10
11
|
# File 'lib/version_info/storage.rb', line 9
def data
@data
end
|
#file_name ⇒ Object
13
14
15
|
# File 'lib/version_info/storage.rb', line 13
def file_name
@data.file_name
end
|
#load ⇒ Object
21
22
23
24
25
|
# File 'lib/version_info/storage.rb', line 21
def load
content = load_content
parse_from(content)
self
end
|
#load_content ⇒ Object
17
18
19
|
# File 'lib/version_info/storage.rb', line 17
def load_content
File.exist?(file_name) ? File.readlines(file_name) : [""]
end
|
#save ⇒ Object
27
28
29
30
|
# File 'lib/version_info/storage.rb', line 27
def save
File.open(file_name, 'w' ) {|out| save_to(out)}
self
end
|