Sha256: 8a077928c2bb8d0c4946fc1d0fd18fdf48aaab5fd6363a7f2b8ba96804c5471e
Contents?: true
Size: 714 Bytes
Versions: 1
Compression:
Stored size: 714 Bytes
Contents
require "thor/core_ext/hash_with_indifferent_access" module Carrasco class CommandBuilder def from_config(config) config = Thor::CoreExt::HashWithIndifferentAccess.new(config) klass = Class.new(Thor) build_commands(config[:commands] || [], klass) build_grups(config[:groups] || [], klass) klass end private def build_commands(commands, klass) commands.each do |method, options| command = Command.new(method, options) command.inject_into_class(klass) end end def build_grups(groups, klass) groups.each do |group_name, options| Group.new(group_name, options).inject_into_class(klass) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carrasco-0.1.6 | lib/carrasco/command_builder.rb |