Class: Module

Inherits:
Object show all
Defined in:
lib/rextra/cutting.rb

Overview


Instance Method Summary collapse

Instance Method Details

#act_on_methods(*meths) ⇒ Object



17
18
19
20
21
# File 'lib/rextra/cutting.rb', line 17

def act_on_methods *meths
  (meths.empty? ? instance_methods : meths).each do |meth|
    yield meth unless %w{__id__ __send__}.include? meth
  end
end

#empty_methods(*meths) ⇒ Object



27
28
29
30
31
# File 'lib/rextra/cutting.rb', line 27

def empty_methods *meths
  act_on_methods *meths do |meth|
    class_def meth do nil end
  end
end

#undef_methods(*meths) ⇒ Object



22
23
24
25
26
# File 'lib/rextra/cutting.rb', line 22

def undef_methods *meths
  act_on_methods *meths do |meth|
    undef_method meth
  end
end