tmp 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/VERSION +1 -1
- data/examples/path.rb +5 -0
- data/examples/sugar_use.rb +0 -4
- data/examples/test.rb +0 -4
- data/examples/tmp_folder/hello +3 -0
- data/lib/tmp/core.rb +16 -1
- data/lib/tmp/dsl.rb +6 -7
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66a42b973054f5d571c6e8732470f943fe5f005
|
4
|
+
data.tar.gz: 9dc2be715eec51546ddbb6d4cdfe4720c61a3580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8ac7b605356c620670439776686854ab917c80223270619efaa88dc40bf642627e67a33ca6dba923f012b526c52350715711b623af3a9af31a31026b0105b8e
|
7
|
+
data.tar.gz: c54e7a1ed989f95dce5aa018323c0286ac394c892d3485b6e83b295f61953b8069e9119e4141d6c20e1bdd0a94ce61e8f1b3689b23d37bb097a4475b43d2c79f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -58,6 +58,14 @@ you can config the folder path for custom tmp folder use case if you dont want t
|
|
58
58
|
# to check the current path use this
|
59
59
|
TMP.folder_path #> return the current path
|
60
60
|
|
61
|
+
```
|
62
|
+
|
63
|
+
### Get file path for the tmp object
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
|
67
|
+
|
68
|
+
|
61
69
|
```
|
62
70
|
|
63
71
|
### Remove tmp objects
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
data/examples/path.rb
ADDED
data/examples/sugar_use.rb
CHANGED
data/examples/test.rb
CHANGED
data/lib/tmp/core.rb
CHANGED
@@ -74,8 +74,23 @@ module TMP
|
|
74
74
|
end
|
75
75
|
|
76
76
|
File.open( File.join(tmp_folder_path,variable_name.to_s) ,"r") do |file|
|
77
|
-
|
77
|
+
begin
|
78
|
+
return ::Marshal.load file.read
|
79
|
+
rescue
|
80
|
+
return file.read
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
def path variable_name
|
87
|
+
|
88
|
+
tmp_folder_init
|
89
|
+
path_to_file= File.join(tmp_folder_path,variable_name.to_s)
|
90
|
+
unless File.exist?(path_to_file)
|
91
|
+
File.open( path_to_file ,"w")
|
78
92
|
end
|
93
|
+
return path_to_file
|
79
94
|
|
80
95
|
end
|
81
96
|
|
data/lib/tmp/dsl.rb
CHANGED
@@ -12,10 +12,8 @@ module TMP
|
|
12
12
|
|
13
13
|
def method_missing( method, *args, &block )
|
14
14
|
|
15
|
-
@target_methods = [:write,:read,:file]
|
16
|
-
|
17
15
|
if method.to_s.reverse[0] == '='
|
18
|
-
target_obj.__send__
|
16
|
+
target_obj.__send__ :write, method.to_s.reverse.sub('=','').reverse, args.first
|
19
17
|
return args.first
|
20
18
|
else
|
21
19
|
|
@@ -31,12 +29,13 @@ module TMP
|
|
31
29
|
|
32
30
|
else
|
33
31
|
|
34
|
-
|
35
|
-
target_obj.__send__
|
36
|
-
|
37
|
-
|
32
|
+
if method =~ /^\w+__path__$/
|
33
|
+
return target_obj.__send__ :path, method.to_s.sub!( /__path__$/,"" )
|
34
|
+
else
|
35
|
+
return target_obj.__send__ :read, method
|
38
36
|
end
|
39
37
|
|
38
|
+
|
40
39
|
end
|
41
40
|
|
42
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -61,8 +61,10 @@ files:
|
|
61
61
|
- examples/blocks.rb
|
62
62
|
- examples/config_exmpl.rb
|
63
63
|
- examples/instance.rb
|
64
|
+
- examples/path.rb
|
64
65
|
- examples/sugar_use.rb
|
65
66
|
- examples/test.rb
|
67
|
+
- examples/tmp_folder/hello
|
66
68
|
- examples/tmp_folder/test
|
67
69
|
- files.rb
|
68
70
|
- lib/tmp.rb
|