Sha256: 5f14167be3259b4cfbc130c32931145711a9152969d587240ad620533b63e0e2
Contents?: true
Size: 704 Bytes
Versions: 2
Compression:
Stored size: 704 Bytes
Contents
# frozen_string_literal: true module Whatup module CLI # Implements a `before` hook to set the correct instance variables # before any command methods. # # This is needed, since Thor creates another cli class instance when it is # called with `invoke`, and we need to reassign any variables to the new # cli instance. # # TODO: grab commands dynamically module InteractiveSetup Whatup::CLI::COMMANDS.each do |cmd| define_method cmd do |*args| cli = instance_variable_get(:@_initializer).last[:shell].base @server = cli.server @current_user = cli.current_user super *args end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whatup-0.2.5 | lib/whatup/cli/commands/interactive/setup.rb |
whatup-0.2.4 | lib/whatup/cli/commands/interactive/setup.rb |