module Abject::Encapsulation::ClassMethods
Public Instance Methods
protects(name)
click to toggle source
Copying and pasting is so 1999. Lets use some ruby meta programming magic to dyanmically protect our methods with some ‘#` hashes at run time!
# File lib/abject/encapsulation.rb, line 30 def protects(name) location = self.instance_method(name).source_location define_method name do |*args| eval parse_method(location).gsub(/^/m, "#") end end