Skip to content

Instantly share code, notes, and snippets.

@hjanuschka
Created December 1, 2016 13:38
Show Gist options
  • Save hjanuschka/e1154dde7691376da34963a4bad7caf6 to your computer and use it in GitHub Desktop.
Save hjanuschka/e1154dde7691376da34963a4bad7caf6 to your computer and use it in GitHub Desktop.
module Fastlane
class Globals
def self.captured_output
unless @captured_output
@captured_output = ""
end
@captured_output
end
def self.verbose(flag)
@verbose = flag
end
def self.verbose?
return @verbose
end
end
end
module Ext
class Mine
def initialize(state)
puts "Current: "
puts Fastlane::Globals.verbose?.inspect
Fastlane::Globals.verbose(state)
end
def output
puts Fastlane::Globals.verbose?.inspect
end
def append(str)
Fastlane::Globals.captured_output << str
end
end
end
a = Ext::Mine.new(true)
b = Ext::Mine.new(false)
a.output
a.append("Demo a\n")
b.append("Demo b\n")
Fastlane::Globals.verbose(false)
a.output
puts Fastlane::Globals.captured_output.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment