Class: SubSetter::Fast::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/sub-setter/fast/dir.rb

Overview

Specific subsetter for Dir entries. Should inherit or invoke the SubSetter::Array Just a stub for the moment

Instance Method Summary collapse

Constructor Details

#initialize(set) ⇒ Dir

Returns a new instance of Dir.



6
7
8
# File 'lib/sub-setter/fast/dir.rb', line 6

def initialize set
  @set = set
end

Instance Method Details

#ending(the_ending) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/sub-setter/fast/dir.rb', line 18

def ending the_ending
  return_me = ::Fast::Dir.new
  @set.each do |entry|
    return_me << entry if entry.end_with? the_ending
  end
  return_me
end

#extension(the_extension) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/sub-setter/fast/dir.rb', line 10

def extension the_extension
  return_me = ::Fast::Dir.new
  @set.each do |entry|
    return_me << entry if entry.end_with? the_extension
  end
  return_me
end

#match(regexp) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/sub-setter/fast/dir.rb', line 34

def match regexp
  return_me = ::Fast::Dir.new
  @set.each do |entry|
    return_me << entry if entry.match regexp
  end
  return_me
end

#strip_extensionObject



26
27
28
29
30
31
32
# File 'lib/sub-setter/fast/dir.rb', line 26

def strip_extension
  return_me = ::Fast::Dir.new
  @set.each do |entry|
    return_me.push entry.gsub /\.(\w+?)$/, ""
  end
  return_me
end