Sha256: 7e9519b6b24c4f2efac5b8c2ed27e9942a23b6d9f68d262a8dd4536c8f519494
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 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 def classes_names (instance_methods.classes_names + class_methods .classes_names).uniq 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
private_please-0.0.5 | lib/private_please/storage/candidates_store.rb |