Class: FileLike
- Inherits:
-
Object
- Object
- FileLike
- Defined in:
- app/models/file_like.rb
Overview
Base class for Github API files and mock files that perform basic operations on the blob and path
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#basename(ext = nil) ⇒ Object
8 9 10 |
# File 'app/models/file_like.rb', line 8 def basename(ext = nil) File.basename path, ext end |
#extname ⇒ Object
4 5 6 |
# File 'app/models/file_like.rb', line 4 def extname File.extname(path).gsub(/^\./, '') # without leading . end |
#first_line_of_patch ⇒ Object
12 13 14 |
# File 'app/models/file_like.rb', line 12 def first_line_of_patch patch.changed_lines.first.try(:number) end |