Class: SyntaxTree::CLI::FileItem

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/cli.rb

Overview

An item of work that corresponds to a file to be processed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ FileItem

Returns a new instance of FileItem.



43
44
45
# File 'lib/syntax_tree/cli.rb', line 43

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



41
42
43
# File 'lib/syntax_tree/cli.rb', line 41

def filepath
  @filepath
end

Instance Method Details

#handlerObject



47
48
49
# File 'lib/syntax_tree/cli.rb', line 47

def handler
  HANDLERS[File.extname(filepath)]
end

#sourceObject



51
52
53
# File 'lib/syntax_tree/cli.rb', line 51

def source
  handler.read(filepath)
end