look up the content methods for drops in a smarter way

This commit is contained in:
Parker Moore 2016-05-17 16:58:06 -07:00 committed by Pat Hawks
parent 3896f6d5d8
commit c0910f2bc5
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
module Jekyll module Jekyll
module Drops module Drops
class Drop < Liquid::Drop class Drop < Liquid::Drop
NON_CONTENT_METHODS = [:[], :[]=, :inspect, :to_h, :fallback_data, :to_s].freeze NON_CONTENT_METHODS = [:fallback_data].freeze
# Get or set whether the drop class is mutable. # Get or set whether the drop class is mutable.
# Mutability determines whether or not pre-defined fields may be # Mutability determines whether or not pre-defined fields may be
@ -86,7 +86,7 @@ module Jekyll
# Returns an Array of strings which represent method-specific keys. # Returns an Array of strings which represent method-specific keys.
def content_methods def content_methods
@content_methods ||= ( @content_methods ||= (
self.class.instance_methods(false) - NON_CONTENT_METHODS self.class.instance_methods - Jekyll::Drops::Drop.instance_methods - NON_CONTENT_METHODS
).map(&:to_s).reject do |method| ).map(&:to_s).reject do |method|
method.end_with?("=") method.end_with?("=")
end end