Module: TestBench::Output::Writer::Styling
- Defined in:
- lib/test_bench/output/writer.rb
Constant Summary collapse
- Error =
Class.new(RuntimeError)
Class Method Summary collapse
- .assure_styling(policy, console = nil) ⇒ Object
- .default ⇒ Object
- .default! ⇒ Object
- .detect ⇒ Object
- .off ⇒ Object
- .on ⇒ Object
- .styling?(policy, console) ⇒ Boolean
Class Method Details
.assure_styling(policy, console = nil) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/test_bench/output/writer.rb', line 177 def self.assure_styling(policy, console=nil) console ||= false case policy when on true when off false when detect console ? true : false else raise Error, "Unknown styling policy #{policy.inspect}" end end |
.default ⇒ Object
196 197 198 199 200 201 202 |
# File 'lib/test_bench/output/writer.rb', line 196 def self.default policy = ENV.fetch('TEST_BENCH_OUTPUT_STYLING') do return default! end policy.to_sym end |
.default! ⇒ Object
204 205 206 |
# File 'lib/test_bench/output/writer.rb', line 204 def self.default! :detect end |
.detect ⇒ Object
194 |
# File 'lib/test_bench/output/writer.rb', line 194 def self.detect = :detect |
.off ⇒ Object
193 |
# File 'lib/test_bench/output/writer.rb', line 193 def self.off = :off |
.on ⇒ Object
192 |
# File 'lib/test_bench/output/writer.rb', line 192 def self.on = :on |
.styling?(policy, console) ⇒ Boolean
173 174 175 |
# File 'lib/test_bench/output/writer.rb', line 173 def self.styling?(policy, console) assure_styling(policy, console) end |