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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/test_bench/output/writer.rb', line 165 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
184 185 186 187 188 189 190 |
# File 'lib/test_bench/output/writer.rb', line 184 def self.default policy = ENV.fetch('TEST_BENCH_OUTPUT_STYLING') do return default! end policy.to_sym end |
.default! ⇒ Object
192 193 194 |
# File 'lib/test_bench/output/writer.rb', line 192 def self.default! :detect end |
.detect ⇒ Object
182 |
# File 'lib/test_bench/output/writer.rb', line 182 def self.detect = :detect |
.off ⇒ Object
181 |
# File 'lib/test_bench/output/writer.rb', line 181 def self.off = :off |
.on ⇒ Object
180 |
# File 'lib/test_bench/output/writer.rb', line 180 def self.on = :on |
.styling?(policy, console) ⇒ Boolean
161 162 163 |
# File 'lib/test_bench/output/writer.rb', line 161 def self.styling?(policy, console) assure_styling(policy, console) end |