mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Merge pull request #1302 from stefan-lz/rakefile_syntax_highlighting
Enable syntax highlighting for Rakefile and other similarly named files
This commit is contained in:
commit
dab174b13c
1 changed files with 7 additions and 1 deletions
|
@ -18,7 +18,11 @@ class Pry
|
|||
%w(.rhtml) => :rhtml,
|
||||
%w(.yaml .yml) => :yaml,
|
||||
%w(.cpp .hpp .cc .h cxx) => :cpp,
|
||||
%w(.rb .ru .irbrc .gemspec .pryrc) => :ruby,
|
||||
%w(.rb .ru .irbrc .gemspec .pryrc .rake) => :ruby,
|
||||
}
|
||||
|
||||
FILES = {
|
||||
%w(Gemfile Rakefile Guardfile Capfile) => :ruby
|
||||
}
|
||||
|
||||
# @return [Symbol] The type of code stored in this wrapper.
|
||||
|
@ -79,6 +83,8 @@ class Pry
|
|||
def type_from_filename(filename, default = :unknown)
|
||||
_, @code_type = EXTENSIONS.find do |k, _|
|
||||
k.any? { |ext| ext == File.extname(filename) }
|
||||
end || FILES.find do |k, _|
|
||||
k.any? { |file_name| file_name == File.basename(filename) }
|
||||
end
|
||||
|
||||
code_type || default
|
||||
|
|
Loading…
Add table
Reference in a new issue