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.



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

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



39
40
41
# File 'lib/syntax_tree/cli.rb', line 39

def filepath
  @filepath
end

Instance Method Details

#handlerObject



45
46
47
# File 'lib/syntax_tree/cli.rb', line 45

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

#sourceObject



49
50
51
# File 'lib/syntax_tree/cli.rb', line 49

def source
  handler.read(filepath)
end