Class: Bagboy::Core::FileHelper

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/bagboy/core/file_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_directories(path) ⇒ Object



7
8
9
# File 'lib/bagboy/core/file_helper.rb', line 7

def get_directories ( path)
  Dir.entries(path).select { |entry| File.directory?(File.join(path, entry)) and !(entry == '.' || entry == '..')}.sort
end

#get_files(path) ⇒ Object



11
12
13
# File 'lib/bagboy/core/file_helper.rb', line 11

def get_files( path )
  Dir.entries(path).select { |entry| !(entry == '.' || entry == '..')}.sort
end

#read(path) ⇒ Object



15
16
17
# File 'lib/bagboy/core/file_helper.rb', line 15

def read( path )
  File.read path
end

#write(path, text) ⇒ Object



19
20
21
# File 'lib/bagboy/core/file_helper.rb', line 19

def write ( path, text )
  File.open(path, 'w') { |file| file.write(text) }
end