dev_projects 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/project.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6242bd1484ed36b28381653bb3755878b594a9fd
|
4
|
+
data.tar.gz: b28569cab3c00991c5c5f8ceabea5f9614078817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f44ed0d090a1441173383c196a1f040ca1ead0e8338a154595162e2d0c6aaba903e6b09aed8514e67339f3be7631634d85ee82cb353d477b3f5480b8bdf9f8
|
7
|
+
data.tar.gz: ffeb59f04ea57abe8da568faaecee3ef59acf8576c97db3a9157060c26b733bfee7248f51e2af1fd3816eac190060ee660c8463d776d28b109961c91db988526
|
data/lib/project.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class Project < Hash
|
2
|
+
attr_accessor :filename
|
2
3
|
def initialize value=''
|
4
|
+
@filename=''
|
3
5
|
self[:url]=''
|
4
6
|
self[:url] = value if value.is_a?(String)
|
5
7
|
if(value.is_a?(Hash))
|
@@ -18,8 +20,14 @@ class Project < Hash
|
|
18
20
|
|
19
21
|
def self.load_projects
|
20
22
|
projects=Project.new
|
21
|
-
|
22
|
-
|
23
|
+
if File.exists?(projects_filename)
|
24
|
+
projects=Project.new(JSON.parse(IO.read(projects_filename)))
|
25
|
+
@filename=projects_filename
|
26
|
+
end
|
23
27
|
projects
|
24
28
|
end
|
29
|
+
|
30
|
+
def save
|
31
|
+
File.open(@filename,'w'){|f|f.write(self.to_json)} if @filename.length > 0
|
32
|
+
end
|
25
33
|
end
|