Class: Module
Instance Method Summary collapse
Instance Method Details
#alias_hooks_to(klass) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/util.rb', line 65 def alias_hooks_to(klass) class_eval do class << self attr_accessor :super_klass def super_klass=(klass) @super_klass = klass end undef hooks def hooks @super_klass.hooks end undef add_hook def add_hook(name, &blk) @super_klass.add_hook(name, &blk) end end end self.super_klass = klass end |
#requires_command(*args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/util.rb', line 42 def requires_command(*args) include RubyCommands args.each do |command| class_def command do ruby_command(command) end command do ruby_command(command) end end :meets_requirements? do begin args.each {|command| ruby_command(command.to_s) } true rescue nil end end end |