Class: Terraspace::Compiler::Strategy::Mod::TextFile
- Inherits:
-
Object
- Object
- Terraspace::Compiler::Strategy::Mod::TextFile
- Includes:
- Util::Logging
- Defined in:
- lib/terraspace/compiler/strategy/mod/text_file.rb
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(filename) ⇒ TextFile
constructor
A new instance of TextFile.
Methods included from Util::Logging
Constructor Details
#initialize(filename) ⇒ TextFile
Returns a new instance of TextFile.
7 8 9 |
# File 'lib/terraspace/compiler/strategy/mod/text_file.rb', line 7 def initialize(filename) @filename = filename end |
Instance Method Details
#check ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/terraspace/compiler/strategy/mod/text_file.rb', line 11 def check return true if Gem.win_platform? # assume text file if on windows return true unless file_installed? # Thanks: https://stackoverflow.com/questions/2355866/ruby-how-to-determine-if-file-being-read-is-binary-or-text file_type, status = Open3.capture2e("file", @filename) status.success? && file_type.include?("text") end |