parent
66e6b2f2d3
commit
4ecbeb4063
|
@ -447,6 +447,7 @@ Style/RescueModifier:
|
||||||
Style/SafeNavigation:
|
Style/SafeNavigation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- lib/jekyll/document.rb
|
- lib/jekyll/document.rb
|
||||||
|
- lib/jekyll/page.rb
|
||||||
Style/SignalException:
|
Style/SignalException:
|
||||||
EnforcedStyle: only_raise
|
EnforcedStyle: only_raise
|
||||||
Style/SingleArgumentDig:
|
Style/SingleArgumentDig:
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -23,7 +23,7 @@ group :test do
|
||||||
gem "nokogiri", "~> 1.7"
|
gem "nokogiri", "~> 1.7"
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rspec-mocks"
|
gem "rspec-mocks"
|
||||||
gem "rubocop", "~> 1.38.0"
|
gem "rubocop", "~> 1.45.0"
|
||||||
gem "rubocop-minitest"
|
gem "rubocop-minitest"
|
||||||
gem "rubocop-performance"
|
gem "rubocop-performance"
|
||||||
gem "rubocop-rake"
|
gem "rubocop-rake"
|
||||||
|
|
|
@ -4,7 +4,9 @@ module Jekyll
|
||||||
class StaticFile
|
class StaticFile
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
attr_reader :relative_path, :extname, :name
|
attr_reader :relative_path, :extname,
|
||||||
|
:type, # Returns the type of the collection if present, nil otherwise.
|
||||||
|
:name
|
||||||
|
|
||||||
def_delegator :to_liquid, :to_json, :to_json
|
def_delegator :to_liquid, :to_json, :to_json
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ module Jekyll
|
||||||
@collection = collection
|
@collection = collection
|
||||||
@relative_path = File.join(*[@dir, @name].compact)
|
@relative_path = File.join(*[@dir, @name].compact)
|
||||||
@extname = File.extname(@name)
|
@extname = File.extname(@name)
|
||||||
|
@type = @collection&.label&.to_sym
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/ParameterLists
|
# rubocop: enable Metrics/ParameterLists
|
||||||
|
|
||||||
|
@ -171,11 +174,6 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the type of the collection if present, nil otherwise.
|
|
||||||
def type
|
|
||||||
@type ||= @collection.nil? ? nil : @collection.label.to_sym
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the front matter defaults defined for the file's URL and/or type
|
# Returns the front matter defaults defined for the file's URL and/or type
|
||||||
# as defined in _config.yml.
|
# as defined in _config.yml.
|
||||||
def defaults
|
def defaults
|
||||||
|
|
Loading…
Reference in New Issue