Class: EacFs::FileInfo
Constant Summary collapse
- UNKNOWN_CONTENT_TYPE_STRING =
'application/octet-stream'
- UNKNOWN_CONTENT_TYPE =
::ContentType.parse(UNKNOWN_CONTENT_TYPE_STRING)
Instance Attribute Summary collapse
- #path ⇒ Pathname readonly
Instance Method Summary collapse
- #description ⇒ String
- #initialize(path) ⇒ Object constructor
- #magic(*flags) ⇒ String
- #open? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Object
20 21 22 |
# File 'lib/eac_fs/file_info.rb', line 20 common_constructor :path do self.path = path.to_pathname end |
Instance Attribute Details
Instance Method Details
#description ⇒ String
27 28 29 |
# File 'lib/eac_fs/file_info.rb', line 27 def description magic end |
#magic(*flags) ⇒ String
37 38 39 |
# File 'lib/eac_fs/file_info.rb', line 37 def magic(*flags) ::FileMagic.new(*flags).file(path.to_path) end |
#open? ⇒ Boolean
32 33 34 |
# File 'lib/eac_fs/file_info.rb', line 32 def open? ::EacFs::Executables.lsof.command(path).execute.fetch(:exit_code).zero? end |