Class: CC::Analyzer::Formatters::HTMLFormatter::SourceFile
- Inherits:
-
Object
- Object
- CC::Analyzer::Formatters::HTMLFormatter::SourceFile
- Defined in:
- lib/cc/analyzer/formatters/html_formatter.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #buffer ⇒ Object
- #code ⇒ Object
-
#initialize(path, filesystem) ⇒ SourceFile
constructor
A new instance of SourceFile.
- #location(loc) ⇒ Object
- #syntaxes ⇒ Object
Constructor Details
#initialize(path, filesystem) ⇒ SourceFile
Returns a new instance of SourceFile.
221 222 223 224 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 221 def initialize(path, filesystem) @path = path @filesystem = filesystem end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
226 227 228 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 226 def path @path end |
Instance Method Details
#buffer ⇒ Object
237 238 239 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 237 def buffer @buffer ||= SourceBuffer.new(path, code) end |
#code ⇒ Object
233 234 235 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 233 def code filesystem.read_path(path) end |
#location(loc) ⇒ Object
241 242 243 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 241 def location(loc) Location.new(buffer, loc) end |
#syntaxes ⇒ Object
228 229 230 231 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 228 def syntaxes ext = File.basename(path).split(".").last.downcase Array(LANGUAGES[ext]) end |