Method: Mentor::Examples#initialize

Defined in:
lib/sections/examples.rb

#initialize(examples) ⇒ Examples



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sections/examples.rb', line 9

def initialize(examples)
  @lines =
    indent_lines([
      'For example:',
      '',
      examples
    ]).flatten

  examples.each do |example|
    @lines.map! do |line|
      line.sub(example, color_code(example))
    end
  end

  colorize_section
end