saturnflyer/surrounded

View on GitHub
lib/surrounded/context/seclusion.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module Surrounded
  module Context
    module Seclusion
      # Set a named constant and make it private
      def private_const_set(name, const)
        unless role_const_defined?(name)
          const = const_set(name, const)
          private_constant name.to_sym
        end
        const
      end

      # Create attr_reader for the named methods and make them private
      def private_attr_reader(*method_names)
        attr_reader(*method_names)
        private(*method_names)
      end
    end
  end
end