lib/arstotzka/fetcher.rb in arstotzka-1.2.1 vs lib/arstotzka/fetcher.rb in arstotzka-1.2.2

- old
+ new

@@ -91,12 +91,26 @@ # @private attr_reader :instance, :options delegate :instance, :after, :flatten, to: :options delegate :wrap, to: :wrapper + # @private + # + # Retrieves the hash to be crawled from the instance + # + # @return [Hash] + # rubocop:disable Metrics/AbcSize def hash - @hash ||= instance.send(:eval, options.json.to_s) + @hash ||= case options.json.to_s + when /^@@.*/ + instance.class.class_variable_get(options.json) + when /^@.*/ + then instance.instance_variable_get(options.json) + else + instance.send(options.json.to_s) + end end + # rubocop:enable Metrics/AbcSize # @private # # Returns an instance of Aristotzka::Craler #