Module: Marso::StoryPublish

Includes:
TextHelper
Included in:
Story
Defined in:
lib/marso/domain/story/story_publish.rb

Instance Method Summary collapse

Methods included from TextHelper

#indented_colorized_text

Instance Method Details

#colorized_textObject



8
9
10
# File 'lib/marso/domain/story/story_publish.rb', line 8

def colorized_text
  self.text.colorize(self.color_theme)
end

#indented_colorized_details(include_mode = :none) ⇒ Object

include_mode => Symbol that defines what should be included in the

              feature's description. Possible values are:
:none - (Default) Only display the feature's description
:with_scenarios - Display the feature description as well as all its
                  scenarios' description


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/marso/domain/story/story_publish.rb', line 17

def indented_colorized_details(include_mode=:none)

  get_scenario_ctxs_text_a = lambda { |s|
    s.scenario_contexts.map { |scn| scn.indented_colorized_text }
  }

  get_indented_colored_text = lambda { |s|
    case include_mode
    when :none
      s.indented_colorized_text
    when :with_scenarios
      [s.indented_colorized_text]
        .concat(get_scenario_ctxs_text_a.call(s)) # add scenarios' text under each feat
        .join("\n")
    else
      raise ArgumentError, ":#{include_mode} is not a valid argument. " +
      "Please choose one of the following:\n" +
      "- #{[:none, :with_scenarios].join('\n- ')}"
    end
  }

  return get_indented_colored_text.call(self)
end