Class: SyntaxTree::CLI::FileItem
- Inherits:
-
Object
- Object
- SyntaxTree::CLI::FileItem
- Defined in:
- lib/syntax_tree/cli.rb
Overview
An item of work that corresponds to a file to be processed.
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
Instance Method Summary collapse
- #handler ⇒ Object
-
#initialize(filepath) ⇒ FileItem
constructor
A new instance of FileItem.
- #source ⇒ Object
- #writable? ⇒ Boolean
Constructor Details
#initialize(filepath) ⇒ FileItem
Returns a new instance of FileItem.
44 45 46 |
# File 'lib/syntax_tree/cli.rb', line 44 def initialize(filepath) @filepath = filepath end |
Instance Attribute Details
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
42 43 44 |
# File 'lib/syntax_tree/cli.rb', line 42 def filepath @filepath end |
Instance Method Details
#handler ⇒ Object
48 49 50 |
# File 'lib/syntax_tree/cli.rb', line 48 def handler HANDLERS[File.extname(filepath)] end |
#source ⇒ Object
52 53 54 |
# File 'lib/syntax_tree/cli.rb', line 52 def source handler.read(filepath) end |
#writable? ⇒ Boolean
56 57 58 |
# File 'lib/syntax_tree/cli.rb', line 56 def writable? File.writable?(filepath) end |