Module: Excom::Plugins::Args::ClassMethods
- Defined in:
- lib/excom/plugins/args.rb
Instance Method Summary collapse
- #arg_methods ⇒ Object
- #args(*argz) ⇒ Object
- #args_list ⇒ Object
- #inherited(command_class) ⇒ Object
- #opts(*optz) ⇒ Object
- #opts_list ⇒ Object
Instance Method Details
#arg_methods ⇒ Object
77 78 79 |
# File 'lib/excom/plugins/args.rb', line 77 def arg_methods const_get(:ArgMethods) end |
#args(*argz) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/excom/plugins/args.rb', line 81 def args(*argz) args_list.concat(argz) argz.each_with_index do |name, i| arg_methods.send(:define_method, name){ @args[i] } end end |
#args_list ⇒ Object
97 98 99 |
# File 'lib/excom/plugins/args.rb', line 97 def args_list @args_list ||= [] end |
#inherited(command_class) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/excom/plugins/args.rb', line 70 def inherited(command_class) command_class.const_set(:ArgMethods, Module.new) command_class.send(:include, command_class::ArgMethods) command_class.args_list.replace args_list.dup command_class.opts_list.replace opts_list.dup end |
#opts(*optz) ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/excom/plugins/args.rb', line 89 def opts(*optz) opts_list.concat(optz) optz.each do |name| arg_methods.send(:define_method, name){ @opts[name] } end end |
#opts_list ⇒ Object
101 102 103 |
# File 'lib/excom/plugins/args.rb', line 101 def opts_list @opts_list ||= [] end |