Class: XCPretty::Snippet

Inherits:
Object
  • Object
show all
Defined in:
lib/xcpretty/snippet.rb

Class Method Summary collapse

Class Method Details

.from_filepath(filepath) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/xcpretty/snippet.rb', line 4

def self.from_filepath(filepath)
  path, line = filepath.split(':')
  file = File.open(path)

  text = read_snippet(file, line)

  file.close
  text
rescue
  ''
end