Class: Tapout::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/tapout/config.rb

Overview

Configuration.

TODO: Rename the ANSI options with a _color suffix,

or something to that effect.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Initialize new Config instance.



28
29
30
# File 'lib/tapout/config.rb', line 28

def initialize
  initialize_defaults
end

Instance Attribute Details

#errorObject

ANSI err



114
115
116
# File 'lib/tapout/config.rb', line 114

def error
  @error
end

#failObject

ANSI fail



107
108
109
# File 'lib/tapout/config.rb', line 107

def fail
  @fail
end

#highlightObject

ANSI highlight



93
94
95
# File 'lib/tapout/config.rb', line 93

def highlight
  @highlight
end

#linesObject

Returns the value of attribute lines.



75
76
77
# File 'lib/tapout/config.rb', line 75

def lines
  @lines
end

#omitObject

ANSI omit



128
129
130
# File 'lib/tapout/config.rb', line 128

def omit
  @omit
end

#passObject

ANSI pass



100
101
102
# File 'lib/tapout/config.rb', line 100

def pass
  @pass
end

#todoObject

ANSI todo



121
122
123
# File 'lib/tapout/config.rb', line 121

def todo
  @todo
end

#traceObject

Returns the value of attribute trace.



62
63
64
# File 'lib/tapout/config.rb', line 62

def trace
  @trace
end

Instance Method Details

#initialize_defaultsObject

Initialize defaults.

  • Default trace depth is 12.

  • Default snippet size is 3 (which means 7 total).



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tapout/config.rb', line 37

def initialize_defaults
  @trace     = 12
  @lines     = 3
  @minimal   = false

  @highlight = [:bold]
  @fadelight = [:dark]

  @pass  = [:green]
  @fail  = [:red]
  @error = [:red]
  @todo  = [:yellow]
  @omit  = [:yellow]
end

#minimal=(boolean) ⇒ Object



88
89
90
# File 'lib/tapout/config.rb', line 88

def minimal=(boolean)
  @minimal = boolean ? true : false
end

#minimal?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/tapout/config.rb', line 83

def minimal?
  @minimal
end

#trace_depthObject

Alias for #trace.



70
71
72
# File 'lib/tapout/config.rb', line 70

def trace_depth
  @trace
end

#update(settings, &block) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/tapout/config.rb', line 53

def update(settings, &block)
  settings.each do |k,v|
    __send__("#{k}=", v)
  end if settings
  block.call(self) if block
  self
end