Class: Mentor::Examples
- Inherits:
-
Object
- Object
- Mentor::Examples
- Defined in:
- lib/sections/examples.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Instance Method Summary collapse
-
#initialize(examples) ⇒ Examples
constructor
A new instance of Examples.
Methods included from OutputHelper
#a_an, #and_sentence, #culprit_line, #home_to_tilde, #indent_lines, #lines_from_file, #or_sentence, #pluralize, #pluralize_words, #terminal_width, #valid_var_name
Methods included from Colorize
Constructor Details
#initialize(examples) ⇒ Examples
Returns a new instance of 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 |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
7 8 9 |
# File 'lib/sections/examples.rb', line 7 def lines @lines end |