dir-lister 0.0.1
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 +7 -0
- data/lib/dir-lister.rb +22 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 03e64c4bd06e3fbc9be4eb8da844cb384eb04a5803c9bb5736bd4d967448556c
|
|
4
|
+
data.tar.gz: fc4092cfb6a579602a851efbbcd94d262aa90d7c40476d18f52eaee8cbaac863
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 30d37eb49d2e9dca980e3373b2d75add98912ca8461b826420c452665ade718e218142d08d46371da8fed25b812127dd2348d2b8d45e90123aadd1e34a4b417c
|
|
7
|
+
data.tar.gz: 351db10875e793e1bacea745648e61bbf42b4ee26305bfc6c04f92dd683280ba48e761b5adcffde8730315b5a8ac16387fd67ff42c9423a071eb3f6943fccf82
|
data/lib/dir-lister.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
class DirLister
|
|
3
|
+
#
|
|
4
|
+
# options[:directory] => directory
|
|
5
|
+
# options[:pattern] => regexp
|
|
6
|
+
#
|
|
7
|
+
def self.list(options={})
|
|
8
|
+
directory = (options[:directory] or options[:dir] or Dir.pwd)
|
|
9
|
+
pattern = (options[:pattern] or //)
|
|
10
|
+
|
|
11
|
+
ret_arr = []
|
|
12
|
+
|
|
13
|
+
return false if File.directory?(directory) == false
|
|
14
|
+
|
|
15
|
+
Dir.entries(directory).each { |entry|
|
|
16
|
+
if entry != '.' and entry != '..' and pattern =~ entry
|
|
17
|
+
ret_arr << entry
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
return ret_arr
|
|
21
|
+
end
|
|
22
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: dir-lister
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- faisalfw
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-11-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple library to Lists a directory with a Pattern!
|
|
14
|
+
email: faisalwahizz@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/dir-lister.rb
|
|
20
|
+
homepage: https://rubygems.org/gems/dir-lister
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.7.6.2
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: Listing a directory with a Pattern!
|
|
44
|
+
test_files: []
|