Module: TestBench::Output::CommentStyle

Defined in:
lib/test_bench/output/comment_style.rb

Constant Summary collapse

Error =
Class.new(RuntimeError)

Class Method Summary collapse

Class Method Details

.blockObject



48
49
50
# File 'lib/test_bench/output/comment_style.rb', line 48

def self.block
  :block
end

.comment_stylesObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/test_bench/output/comment_style.rb', line 25

def self.comment_styles
  {
    :detect => 'detect',
    :normal => 'normal',
    :heading => 'heading',
    :block => 'block',
    :line_number => 'line_number',
    :raw => 'raw'
  }
end

.detectObject



36
37
38
# File 'lib/test_bench/output/comment_style.rb', line 36

def self.detect
  :detect
end

.fetch(comment_disposition) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/test_bench/output/comment_style.rb', line 6

def self.fetch(comment_disposition)
  comment_style = get(comment_disposition)

  comment_style ||= normal

  comment_style
end

.get(comment_disposition) ⇒ Object



14
15
16
17
# File 'lib/test_bench/output/comment_style.rb', line 14

def self.get(comment_disposition)
  comment_style, _ = comment_styles.rassoc(comment_disposition)
  comment_style
end

.get_disposition(comment_style) ⇒ Object



19
20
21
22
23
# File 'lib/test_bench/output/comment_style.rb', line 19

def self.get_disposition(comment_style)
  comment_styles.fetch(comment_style) do
    raise Error, "Incorrect comment style: #{comment_style.inspect}"
  end
end

.headingObject



44
45
46
# File 'lib/test_bench/output/comment_style.rb', line 44

def self.heading
  :heading
end

.line_numberObject



52
53
54
# File 'lib/test_bench/output/comment_style.rb', line 52

def self.line_number
  :line_number
end

.normalObject



40
41
42
# File 'lib/test_bench/output/comment_style.rb', line 40

def self.normal
  :normal
end

.rawObject



56
57
58
# File 'lib/test_bench/output/comment_style.rb', line 56

def self.raw
  :raw
end