Module: DSLKit::FromModule
Instance Method Summary collapse
Methods included from ParameterizedModule
Instance Method Details
#parameterize(opts = {}) ⇒ Object
621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/dslkit/polite.rb', line 621 def parameterize(opts = {}) modul = opts[:module] or raise ArgumentError, 'option :module is required' import_methods = Array(opts[:methods]) result = modul.dup remove_methods = modul.instance_methods.map(&:to_sym) - import_methods.map(&:to_sym) remove_methods.each do |m| begin result.__send__ :remove_method, m rescue NameError end end result end |