Class: Marso::Story
- Includes:
- StoryLoad, StoryPublish
- Defined in:
- lib/marso/domain/story/story.rb
Instance Attribute Summary collapse
-
#color_theme ⇒ Object
readonly
Returns the value of attribute color_theme.
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#feature_id ⇒ Object
readonly
Returns the value of attribute feature_id.
-
#fname ⇒ Object
readonly
Returns the value of attribute fname.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rootpath ⇒ Object
readonly
Returns the value of attribute rootpath.
-
#scenario_contexts ⇒ Object
readonly
Returns the value of attribute scenario_contexts.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#tree_position ⇒ Object
readonly
Returns the value of attribute tree_position.
Instance Method Summary collapse
-
#initialize(description, ctx = {}) ⇒ Story
constructor
description (optional): Hash defined as follow :id => Arbitrary number or string.
Methods included from StoryPublish
#colorized_text, #indented_colorized_details
Methods included from TextHelper
#colorized_text, #indented_colorized_text
Methods included from StoryLoad
Constructor Details
#initialize(description, ctx = {}) ⇒ Story
description (optional): Hash defined as follow
:id => Arbitrary number or string. Default is randomly generated
(hex string (length 6))
:name => Story's name
:in_order_to => String that describes the fundamental story's business
value
:as_a => String that describes the user(s)
:i => String that describes the feature that could deliver the story's
business value(e.g. I want ... or I should ...)
:scenario_contexts => Array of all the scenario contexts that are part
of that story
:rootpath => Path to the folder that contain this current feature's file
as well as its associated 'scenarios' and 'stories' folder
:status => Can only be set if :scenario_contexts is empty. Otherwise, it
will be overidden by the status of :scenario_contexts
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/marso/domain/story/story.rb', line 30 def initialize(description, ctx={}) validate_arguments(description, ctx) @description = description.clone @ctx = ctx.clone @description[:scenario_contexts] = [] if description[:scenario_contexts].nil? @description[:id] = SecureRandom.hex(3) if description[:id].nil? @description[:rootpath] = File.dirname(caller[0]) if description[:rootpath].nil? @name = @description[:name] @fname = @description[:name].downcase.gsub(' ', '_') @rootpath = @description[:rootpath] @id = @description[:id] @scenario_contexts = @description[:scenario_contexts] if @scenario_contexts.empty? && !@description[:status].nil? @status = @description[:status] else @status = @scenario_contexts.status end @feature_id = ctx[:feature_id] @tree_position = @feature_id.nil? ? 0 : 1 @header = get_header(@id, @status, @ctx, @description) @color_theme = get_color_theme(@status) @text = get_text(@header, @description) end |
Instance Attribute Details
#color_theme ⇒ Object (readonly)
Returns the value of attribute color_theme.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def color_theme @color_theme end |
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def ctx @ctx end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def description @description end |
#feature_id ⇒ Object (readonly)
Returns the value of attribute feature_id.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def feature_id @feature_id end |
#fname ⇒ Object (readonly)
Returns the value of attribute fname.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def fname @fname end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def header @header end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def name @name end |
#rootpath ⇒ Object (readonly)
Returns the value of attribute rootpath.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def rootpath @rootpath end |
#scenario_contexts ⇒ Object (readonly)
Returns the value of attribute scenario_contexts.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def scenario_contexts @scenario_contexts end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def status @status end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def text @text end |
#tree_position ⇒ Object (readonly)
Returns the value of attribute tree_position.
12 13 14 |
# File 'lib/marso/domain/story/story.rb', line 12 def tree_position @tree_position end |