Class: Nukumber::Model::FeatureElement
- Inherits:
-
Object
- Object
- Nukumber::Model::FeatureElement
- Defined in:
- lib/nukumber/model/feature_element.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
-
#initialize(name, line, description, feature) ⇒ FeatureElement
constructor
A new instance of FeatureElement.
- #longsym ⇒ Object
- #shortsym ⇒ Object
- #step_args ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, line, description, feature) ⇒ FeatureElement
Returns a new instance of FeatureElement.
10 11 12 13 14 15 16 17 18 |
# File 'lib/nukumber/model/feature_element.rb', line 10 def initialize(name, line, description, feature) if name.length == 0 raise "Feature elements must be named (#{feature.file_path}:#{line})" elsif name[0, 1] !~ /[a-zA-Z]/ raise "Feature element names must begin with a letter (#{feature.file_path}:#{line})" end @name, @line, @description, @feature = name, line, description, feature @steps = [] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/nukumber/model/feature_element.rb', line 6 def description @description end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
7 8 9 |
# File 'lib/nukumber/model/feature_element.rb', line 7 def feature @feature end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/nukumber/model/feature_element.rb', line 6 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/nukumber/model/feature_element.rb', line 6 def name @name end |
#steps ⇒ Object
Returns the value of attribute steps.
8 9 10 |
# File 'lib/nukumber/model/feature_element.rb', line 8 def steps @steps end |
Instance Method Details
#longsym ⇒ Object
24 25 26 |
# File 'lib/nukumber/model/feature_element.rb', line 24 def longsym (@feature.name.nukesym.to_s + LONGSYM_DELIM + name.nukesym.to_s).to_sym end |
#shortsym ⇒ Object
20 21 22 |
# File 'lib/nukumber/model/feature_element.rb', line 20 def shortsym name.nukesym end |
#step_args ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/nukumber/model/feature_element.rb', line 32 def step_args step_args = [] @steps.each do |s| step_args << s.args.all_row_hashes unless s.args.empty? end while step_args.is_a? Array and step_args.size == 1 step_args = step_args.first end step_args end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/nukumber/model/feature_element.rb', line 28 def to_s "#{keyword} \"#{name}\"" end |