Module: Abject::Encapsulation::ClassMethods
- Defined in:
- lib/abject/encapsulation.rb
Instance Method Summary collapse
-
#protects(name) ⇒ Object
Copying and pasting is so 1999.
Instance Method Details
#protects(name) ⇒ Object
Copying and pasting is so 1999. Lets use some ruby meta programming magic to dyanmically protect our methods with some ‘#` hashes at run time!
30 31 32 33 34 35 36 |
# 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 |