Class: Grouik::Types::Loadables
- Inherits:
-
Array
- Object
- Array
- Grouik::Types::Loadables
- Defined in:
- src/lib/grouik/types.rb
Overview
Get filtered loadables, using ignores regexp
Instance Method Summary collapse
- #add_file(file, basedir = nil) ⇒ self
-
#ignores(regexps) ⇒ self
Removes ignored patterns (regexps).
- #make_loadable(*args) ⇒ Grouik::Loadable
Instance Method Details
#add_file(file, basedir = nil) ⇒ self
36 37 38 39 40 |
# File 'src/lib/grouik/types.rb', line 36 def add_file(file, basedir = nil) self.push(make_loadable(basedir, file)) self end |
#ignores(regexps) ⇒ self
Removes ignored patterns (regexps)
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'src/lib/grouik/types.rb', line 21 def ignores(regexps) filter = lambda do |loadable, regexps| regexps.each do |regexp| return true if loadable and regexp.match(loadable.to_s) end false end self.clone.delete_if do |loadable| filter.call(loadable, regexps) end end |
#make_loadable(*args) ⇒ Grouik::Loadable
43 44 45 |
# File 'src/lib/grouik/types.rb', line 43 def make_loadable(*args) Grouik.get(:loadable_factory).call(*args) end |