Use attr_reader for a couple methods

attr_reader methods are faster than normal methods.
This commit is contained in:
Jeremy Evans 2022-08-27 11:15:24 -07:00 committed by Magnus Holm
parent e605a964e8
commit 56e78dac1e
2 changed files with 4 additions and 6 deletions

View File

@ -8,9 +8,9 @@ module Tilt
@default_mapping = Mapping.new
# @return [Tilt::Mapping] the main mapping object
def self.default_mapping
@default_mapping
class << self
# @return [Tilt::Mapping] the main mapping object
attr_reader :default_mapping
end
# @private

View File

@ -155,9 +155,7 @@ module Tilt
# default_encoding-option if present. You may override this method
# in your template class if you have a better hint of the data's
# encoding.
def default_encoding
@default_encoding
end
attr_reader :default_encoding
# Do whatever preparation is necessary to setup the underlying template
# engine. Called immediately after template data is loaded. Instance