Sha256: 57521f5ca34fff7a9a98def90b5a08977f40167ee5610d21132b351ef8092925
Contents?: true
Size: 543 Bytes
Versions: 1
Compression:
Stored size: 543 Bytes
Contents
require "thor" module Carrasco class CommandBuilder def from_config(config) klass = Class.new(Thor) config['commands'].each do |method, options| command = Command.new(method, options) inject_command_into_class(command, klass) end klass end def inject_command_into_class(command, klass) klass.desc(command.help, command.description) klass.class_eval do define_method(command.command_name) do system(command.command) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carrasco-0.1.4 | lib/carrasco/command_builder.rb |