Module: FileSet
- Extended by:
- FileSet
- Included in:
- FileSet
- Defined in:
- lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite.rb
Overview
FileSet helper method for iterating and interacting with files inside a directory
Instance Method Summary collapse
-
#glob(glob_pattern, file_path = nil, &block) ⇒ Object
Iterates over every file in the glob pattern and yields to a block Returns the list of files matching the glob pattern FileSet.glob(‘padrino-core/application/*.rb’, __FILE__) { |file| load file }.
-
#glob_require(glob_pattern, file_path = nil) ⇒ Object
Requires each file matched in the glob pattern into the application FileSet.glob_require(‘padrino-core/application/*.rb’, __FILE__).
Instance Method Details
#glob(glob_pattern, file_path = nil, &block) ⇒ Object
Iterates over every file in the glob pattern and yields to a block Returns the list of files matching the glob pattern FileSet.glob(‘padrino-core/application/*.rb’, __FILE__) { |file| load file }
172 173 174 175 176 177 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite.rb', line 172 def glob(glob_pattern, file_path=nil, &block) glob_pattern = File.join(File.dirname(file_path), glob_pattern) if file_path file_list = Dir.glob(glob_pattern).sort file_list.each { |file| block.call(file) } file_list end |
#glob_require(glob_pattern, file_path = nil) ⇒ Object
Requires each file matched in the glob pattern into the application FileSet.glob_require(‘padrino-core/application/*.rb’, __FILE__)
183 184 185 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite.rb', line 183 def glob_require(glob_pattern, file_path=nil) glob(glob_pattern, file_path) { |f| require f } end |