Sha256: 1c281f55ef60a08e7f05631b4ecb6aee7fa38684d2572dc3a3b8eef097a1a299
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# Holds in 2 "buckets" the details (class name + methods names) of the # methods that are candidate for privatization. # Those methods were marked via `private_please` in the code. # Instance methods and class methods are kept separate. module PrivatePlease module Storage class CandidatesStore def initialize @instance_methods = MethodsNamesBucket.new @class_methods = MethodsNamesBucket.new end #-------------------------------------------------------------------------- # QUERIES: #-------------------------------------------------------------------------- attr_reader :instance_methods, :class_methods def empty? instance_methods.empty? && class_methods.empty? end def stored?(candidate) bucket_for(candidate).get_methods_names(candidate.klass_name).include?(candidate.method_name) end #-------------------------------------------------------------------------- # COMMANDS: #-------------------------------------------------------------------------- def store(candidate) bucket_for(candidate).add_method_name(candidate.klass_name, candidate.method_name) end #-------------------------------------------------------------------------- private def bucket_for(candidate) candidate.instance_method? ? @instance_methods : @class_methods end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
private_please-0.0.4 | lib/private_please/storage/candidates_store.rb |
private_please-0.0.3 | lib/private_please/storage/candidates_store.rb |