Module: BiweekFinder
- Defined in:
- lib/biweek_finder.rb,
lib/biweek_finder/version.rb
Constant Summary collapse
- VERSION =
biweek_finder version
"0.1.0"
Class Method Summary collapse
- .from_a(arr = []) ⇒ Object
- .from_path(path = '.') ⇒ Object
- .is_biweek?(str) ⇒ Boolean
- .sort(arr = []) ⇒ Object
- .subdirectories(path = '.') ⇒ Object
Class Method Details
.from_a(arr = []) ⇒ Object
13 14 15 16 17 |
# File 'lib/biweek_finder.rb', line 13 def self.from_a(arr = []) arr.find_all do |name| self.is_biweek? name end end |
.from_path(path = '.') ⇒ Object
4 5 6 |
# File 'lib/biweek_finder.rb', line 4 def self.from_path(path = '.') sort from_a subdirectories(path) end |
.is_biweek?(str) ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/biweek_finder.rb', line 23 def self.is_biweek?(str) if /^20/ =~ str true else false end end |
.sort(arr = []) ⇒ Object
19 20 21 |
# File 'lib/biweek_finder.rb', line 19 def self.sort(arr = []) arr.sort {|a, b| a <=> b} end |
.subdirectories(path = '.') ⇒ Object
8 9 10 11 |
# File 'lib/biweek_finder.rb', line 8 def self.subdirectories(path = '.') dir = Dir.open(path) dir.select {|f| File.directory?(File.join(path, f))} end |