lib/nanoc/extra/file_proxy.rb in nanoc-3.7.3 vs lib/nanoc/extra/file_proxy.rb in nanoc-3.7.4

- old
+ new

@@ -14,23 +14,23 @@ end def freeze end - def respond_to?(meth, include_all = false) + def respond_to?(meth, _include_all = false) file_instance_methods.include?(meth.to_sym) end def method_missing(sym, *args, &block) - if !@@deprecation_warning_shown + unless @@deprecation_warning_shown $stderr.puts 'WARNING: The :file attribute is deprecated and will be removed in a future version of nanoc. Instead of using this :file attribute, consider manually creating a File object when it’s needed, using the :content_filename, :meta_filename or :filename attributes.' @@deprecation_warning_shown = true end File.open(@path, 'r') { |io| io.__send__(sym, *args, &block) } end - private + private def file_instance_methods @@file_instance_methods ||= Set.new(File.instance_methods.map { |m| m.to_sym }) end