Class: Util
- Inherits:
-
Object
- Object
- Util
- Defined in:
- lib/base/util.rb
Class Method Summary collapse
- .dir_glob(*patterns) ⇒ Object
- .directory?(*args) ⇒ Boolean
- .file?(*args) ⇒ Boolean
- .load_gemspec(*args) ⇒ Object
- .load_yaml(*args) ⇒ Object
- .open_file(*args, &block) ⇒ Object
- .rm(*args) ⇒ Object
- .write_file(file_path, array) ⇒ Object
Class Method Details
.dir_glob(*patterns) ⇒ Object
2 3 4 |
# File 'lib/base/util.rb', line 2 def self.dir_glob(*patterns) Dir.glob(*patterns) end |
.directory?(*args) ⇒ Boolean
22 23 24 |
# File 'lib/base/util.rb', line 22 def self.directory?(*args) File.directory?(*args) end |
.file?(*args) ⇒ Boolean
18 19 20 |
# File 'lib/base/util.rb', line 18 def self.file?(*args) File.file?(*args) end |
.load_gemspec(*args) ⇒ Object
36 37 38 |
# File 'lib/base/util.rb', line 36 def self.load_gemspec(*args) Gem::Specification.load(*args) end |
.load_yaml(*args) ⇒ Object
30 31 32 33 34 |
# File 'lib/base/util.rb', line 30 def self.load_yaml(*args) # Psych must be available on the system, # preferably via installing ruby with libyaml already installed. Psych.load_file(*args) end |
.open_file(*args, &block) ⇒ Object
6 7 8 |
# File 'lib/base/util.rb', line 6 def self.open_file(*args, &block) File.open(*args, &block) end |
.rm(*args) ⇒ Object
26 27 28 |
# File 'lib/base/util.rb', line 26 def self.rm(*args) FileUtils.rm(*args) end |
.write_file(file_path, array) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/base/util.rb', line 10 def self.write_file(file_path, array) open_file(file_path, 'w') do |file| array.each do |element| file.puts element end end end |