Class: Meteor::Core::Util::FileReader
- Inherits:
-
Object
- Object
- Meteor::Core::Util::FileReader
- Defined in:
- lib/meteor/core/util/file_reader.rb
Overview
FileReader Class (ファイル・リーダー クラス)
Class Method Summary collapse
-
.read(file_path, enc) ⇒ Object
read file (ファイルを読み込む).
Class Method Details
.read(file_path, enc) ⇒ Object
read file (ファイルを読み込む)
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/meteor/core/util/file_reader.rb', line 15 def self.read(file_path, enc) mode = if enc == 'UTF-8' # String.new("") << "r:" << enc 'r:UTF-8' else String.new('') << 'r:' << enc << ':utf-8' end # open file (ファイルのオープン) io = File.open(file_path, mode) # load (読込) data = io.read # close file (ファイルのクローズ) io.close data end |