Module: EverydayThorUtil::SubCommandHelperHelpers
- Included in:
- SubCommandHelpers
- Defined in:
- lib/everyday_thor_util/plugin-helper.rb
Instance Method Summary collapse
- #add_helper(parent_class, v) ⇒ Object
- #print_info(obj, meth, &eval_block) ⇒ Object
- #register_print_info_helper(global, helper_symbol, method_name, parent) ⇒ Object
Instance Method Details
#add_helper(parent_class, v) ⇒ Object
140 141 142 |
# File 'lib/everyday_thor_util/plugin-helper.rb', line 140 def add_helper(parent_class, v) parent_class.no_commands { parent_class.create_method v[:options][:name].to_sym, &v[:block] } if v[:block] end |
#print_info(obj, meth, &eval_block) ⇒ Object
150 151 152 153 154 |
# File 'lib/everyday_thor_util/plugin-helper.rb', line 150 def print_info(obj, meth, &eval_block) EverydayThorUtil::CommonHelpers.print_base_debug(meth, obj) meth_obj = obj.method(meth) meth_obj.parameters.each { |p| puts "#{p[1].to_s}: #{eval_block.call(p[1].to_s)}" } if eval_block end |
#register_print_info_helper(global, helper_symbol, method_name, parent) ⇒ Object
144 145 146 147 148 |
# File 'lib/everyday_thor_util/plugin-helper.rb', line 144 def register_print_info_helper(global, helper_symbol, method_name, parent) register(helper_symbol, name: (method_name || 'print_info'), global: global, parent: parent) { |meth, &eval_block| EverydayThorUtil::SubCommandHelpers.print_info(self, meth, &eval_block) } end |