This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Correlations | |
# the dataset in question | |
attr_writer :dataset | |
# Count the number of instances an individual term appears | |
# | |
# Example: | |
# {"Ruby" => 3, "PHP" => 2, "C++" => 2} | |
attr_accessor :total_appearance_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
class Proc | |
def slow_callback(callable, *args) | |
self === Class.new do | |
method_name = callable.to_sym | |
define_method(method_name) { |&block| block.nil? ? true : block.call(*args) } | |
define_method("#{method_name}?") { true } | |
def method_missing(method_name, *args, &block) false; end | |
end.new |