dir-to-xml 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dir-to-xml.rb +14 -0
- metadata +13 -11
data/lib/dir-to-xml.rb
CHANGED
@@ -12,6 +12,7 @@ class DirToXML
|
|
12
12
|
def initialize(path= '.')
|
13
13
|
super()
|
14
14
|
old_path = Dir.pwd
|
15
|
+
raise "Directory not found." unless File.exists? path
|
15
16
|
Dir.chdir path
|
16
17
|
|
17
18
|
a = Dir.glob("*").sort
|
@@ -19,6 +20,19 @@ class DirToXML
|
|
19
20
|
|
20
21
|
@doc, @status = self.send command, a
|
21
22
|
Dir.chdir old_path #File.expand_path('~')
|
23
|
+
@h = self.to_dynarex.to_h
|
24
|
+
@object = @h
|
25
|
+
end
|
26
|
+
|
27
|
+
def select_by_ext(ext)
|
28
|
+
@object = @h.select{|x| x[:ext] == ext}
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def sort_by(sym)
|
33
|
+
procs = [[:last_modified, lambda{|obj| obj.sort_by{|x| x[:last_modified]}}]]
|
34
|
+
proc1 = procs.assoc(sym).last
|
35
|
+
proc1.call(@object)
|
22
36
|
end
|
23
37
|
|
24
38
|
def to_xml
|
metadata
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dir-to-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.7
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
|
7
|
+
authors:
|
8
|
+
- James Robertson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date: 2011-
|
13
|
+
date: 2011-09-03 00:00:00 +01:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: dynarex
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
20
21
|
requirements:
|
21
22
|
- - ">="
|
22
23
|
- !ruby/object:Gem::Version
|
23
24
|
version: "0"
|
24
|
-
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
25
27
|
description:
|
26
28
|
email:
|
27
29
|
executables: []
|
@@ -42,21 +44,21 @@ rdoc_options: []
|
|
42
44
|
require_paths:
|
43
45
|
- lib
|
44
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
45
48
|
requirements:
|
46
49
|
- - ">="
|
47
50
|
- !ruby/object:Gem::Version
|
48
51
|
version: "0"
|
49
|
-
version:
|
50
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: "0"
|
55
|
-
version:
|
56
58
|
requirements: []
|
57
59
|
|
58
60
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.5.2
|
60
62
|
signing_key:
|
61
63
|
specification_version: 3
|
62
64
|
summary: dir-to-xml
|