Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'thor/group'
- module SampleMod
- def self.included(base)
- [:one, :two, :three].each do |method_name|
- base.class_eval do
- define_method method_name do
- puts "inside #{method_name}"
- end
- desc method_name
- end
- end
- end
- end
- class A < Thor::Group
- include SampleMod
- desc "sample"
- define_method :sample do
- puts "inside sample"
- end
- desc "sample_two"
- define_method :sample_two do
- puts "inside sample_two"
- end
- end
Add Comment
Please, Sign In to add comment