cuke_modeler 3.27.0 → 3.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +579 -572
  3. data/LICENSE.txt +22 -22
  4. data/README.md +135 -135
  5. data/cuke_modeler.gemspec +59 -59
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +13 -13
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +13 -13
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +13 -13
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +13 -13
  10. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +13 -13
  11. data/lib/cuke_modeler/adapters/gherkin_15_adapter.rb +13 -13
  12. data/lib/cuke_modeler/adapters/gherkin_16_adapter.rb +13 -13
  13. data/lib/cuke_modeler/adapters/gherkin_17_adapter.rb +13 -13
  14. data/lib/cuke_modeler/adapters/gherkin_18_adapter.rb +27 -27
  15. data/lib/cuke_modeler/adapters/gherkin_19_adapter.rb +64 -64
  16. data/lib/cuke_modeler/adapters/gherkin_20_adapter.rb +359 -359
  17. data/lib/cuke_modeler/adapters/gherkin_21_adapter.rb +13 -13
  18. data/lib/cuke_modeler/adapters/gherkin_22_adapter.rb +13 -13
  19. data/lib/cuke_modeler/adapters/gherkin_23_adapter.rb +13 -13
  20. data/lib/cuke_modeler/adapters/gherkin_24_adapter.rb +13 -13
  21. data/lib/cuke_modeler/adapters/gherkin_25_adapter.rb +13 -13
  22. data/lib/cuke_modeler/adapters/gherkin_26_adapter.rb +13 -13
  23. data/lib/cuke_modeler/adapters/gherkin_27_adapter.rb +13 -13
  24. data/lib/cuke_modeler/adapters/gherkin_28_adapter.rb +13 -13
  25. data/lib/cuke_modeler/adapters/gherkin_29_adapter.rb +13 -13
  26. data/lib/cuke_modeler/adapters/gherkin_30_adapter.rb +13 -13
  27. data/lib/cuke_modeler/adapters/gherkin_31_adapter.rb +13 -13
  28. data/lib/cuke_modeler/adapters/gherkin_32_adapter.rb +13 -13
  29. data/lib/cuke_modeler/adapters/gherkin_33_adapter.rb +13 -13
  30. data/lib/cuke_modeler/adapters/gherkin_34_adapter.rb +13 -13
  31. data/lib/cuke_modeler/adapters/gherkin_35_adapter.rb +13 -13
  32. data/lib/cuke_modeler/adapters/gherkin_36_adapter.rb +13 -13
  33. data/lib/cuke_modeler/adapters/gherkin_37_adapter.rb +13 -13
  34. data/lib/cuke_modeler/adapters/gherkin_38_adapter.rb +13 -0
  35. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +375 -375
  36. data/lib/cuke_modeler/adapters/gherkin_base_adapter.rb +17 -17
  37. data/lib/cuke_modeler/containing.rb +105 -105
  38. data/lib/cuke_modeler/described.rb +71 -71
  39. data/lib/cuke_modeler/models/background.rb +122 -122
  40. data/lib/cuke_modeler/models/cell.rb +88 -88
  41. data/lib/cuke_modeler/models/comment.rb +82 -82
  42. data/lib/cuke_modeler/models/directory.rb +143 -143
  43. data/lib/cuke_modeler/models/doc_string.rb +104 -104
  44. data/lib/cuke_modeler/models/example.rb +274 -274
  45. data/lib/cuke_modeler/models/feature.rb +200 -200
  46. data/lib/cuke_modeler/models/feature_file.rb +116 -116
  47. data/lib/cuke_modeler/models/model.rb +87 -87
  48. data/lib/cuke_modeler/models/outline.rb +145 -145
  49. data/lib/cuke_modeler/models/row.rb +104 -104
  50. data/lib/cuke_modeler/models/rule.rb +162 -162
  51. data/lib/cuke_modeler/models/scenario.rb +128 -128
  52. data/lib/cuke_modeler/models/step.rb +178 -178
  53. data/lib/cuke_modeler/models/table.rb +117 -117
  54. data/lib/cuke_modeler/models/tag.rb +75 -75
  55. data/lib/cuke_modeler/named.rb +26 -26
  56. data/lib/cuke_modeler/nested.rb +61 -61
  57. data/lib/cuke_modeler/parsed.rb +24 -24
  58. data/lib/cuke_modeler/parsing.rb +208 -208
  59. data/lib/cuke_modeler/sourceable.rb +29 -29
  60. data/lib/cuke_modeler/stepped.rb +34 -34
  61. data/lib/cuke_modeler/taggable.rb +57 -57
  62. data/lib/cuke_modeler/version.rb +4 -4
  63. data/lib/cuke_modeler.rb +32 -32
  64. data/testing/cucumber/features/analysis/step_comparison.feature +25 -25
  65. data/testing/cucumber/features/analysis/test_comparison.feature +35 -35
  66. data/testing/cucumber/features/modeling/background_modeling.feature +105 -105
  67. data/testing/cucumber/features/modeling/background_output.feature +60 -60
  68. data/testing/cucumber/features/modeling/cell_modeling.feature +68 -68
  69. data/testing/cucumber/features/modeling/cell_output.feature +36 -36
  70. data/testing/cucumber/features/modeling/comment_modeling.feature +62 -62
  71. data/testing/cucumber/features/modeling/comment_output.feature +40 -40
  72. data/testing/cucumber/features/modeling/directory_modeling.feature +62 -62
  73. data/testing/cucumber/features/modeling/directory_output.feature +33 -33
  74. data/testing/cucumber/features/modeling/doc_string_modeling.feature +85 -85
  75. data/testing/cucumber/features/modeling/doc_string_output.feature +50 -50
  76. data/testing/cucumber/features/modeling/example_modeling.feature +155 -155
  77. data/testing/cucumber/features/modeling/example_output.feature +57 -57
  78. data/testing/cucumber/features/modeling/feature_file_modeling.feature +49 -49
  79. data/testing/cucumber/features/modeling/feature_file_output.feature +33 -33
  80. data/testing/cucumber/features/modeling/feature_modeling.feature +149 -149
  81. data/testing/cucumber/features/modeling/feature_output.feature +144 -144
  82. data/testing/cucumber/features/modeling/model_output.feature +61 -61
  83. data/testing/cucumber/features/modeling/model_structure.feature +42 -42
  84. data/testing/cucumber/features/modeling/outline_modeling.feature +175 -175
  85. data/testing/cucumber/features/modeling/outline_output.feature +87 -87
  86. data/testing/cucumber/features/modeling/row_modeling.feature +70 -70
  87. data/testing/cucumber/features/modeling/row_output.feature +40 -40
  88. data/testing/cucumber/features/modeling/rule_modeling.feature +171 -171
  89. data/testing/cucumber/features/modeling/rule_output.feature +136 -136
  90. data/testing/cucumber/features/modeling/scenario_modeling.feature +146 -146
  91. data/testing/cucumber/features/modeling/scenario_output.feature +63 -63
  92. data/testing/cucumber/features/modeling/step_modeling.feature +105 -105
  93. data/testing/cucumber/features/modeling/step_output.feature +47 -47
  94. data/testing/cucumber/features/modeling/table_modeling.feature +73 -73
  95. data/testing/cucumber/features/modeling/table_output.feature +42 -42
  96. data/testing/cucumber/features/modeling/tag_modeling.feature +62 -62
  97. data/testing/cucumber/features/modeling/tag_output.feature +40 -40
  98. metadata +6 -8
@@ -1,208 +1,208 @@
1
- # rubocop:disable Metrics/ModuleLength -- Just not going to worry about this
2
-
3
- # Have to at least load some version of the gem before which version of the gem has been loaded can
4
- # be determined and the rest of the needed files can be loaded.
5
- require 'gherkin'
6
-
7
-
8
- # The *cucumber-gherkin* has different grammar rules across major versions. Parsing will be done with
9
- # an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
10
- gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
11
- gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
12
- supported_gherkin_versions = (9..37)
13
-
14
- raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
15
-
16
- require "cuke_modeler/adapters/gherkin_#{gherkin_major_version}_adapter"
17
-
18
-
19
- module CukeModeler
20
-
21
- # A module providing source text parsing functionality.
22
- module Parsing
23
-
24
- class << self
25
-
26
- # The dialect that will be used to parse snippets of Gherkin text
27
- attr_writer :dialect
28
-
29
-
30
- # The dialect that will be used to parse snippets of Gherkin text
31
- #
32
- # @example
33
- # Parsing.dialect
34
- #
35
- # @return [String] The current dialect. Defaults to 'en'.
36
- def dialect
37
- @dialect || 'en'
38
- end
39
-
40
- # The dialects currently known by the cucumber-gherkin gem. See *Gherkin::DIALECTS*.
41
- #
42
- # @example
43
- # Parsing.dialects
44
- #
45
- # @return [Hash] The dialect data
46
- def dialects
47
- Gherkin::DIALECTS
48
- end
49
-
50
- # Parses the Cucumber feature given in *source_text* and returns a Hash representation of
51
- # its logical structure. This is a standardized AST that should remain consistent across
52
- # different versions of `cucumber-gherkin`
53
- #
54
- # @example
55
- # Parsing.parse_text('Feature: Some feature')
56
- # Parsing.parse_text('Feature: Some feature', 'my.feature')
57
- #
58
- # @param source_text [String] The Gherkin text to parse
59
- # @param filename [String] The file name associated with the parsed text. Used for error messages.
60
- # @raise [ArgumentError] If *source_text* is not a String
61
- # @raise [ArgumentError] If *source_text* does not parse cleanly
62
- # @return [Hash] An AST of the text
63
- def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
64
- unless source_text.is_a?(String)
65
- raise(ArgumentError, "Text to parse must be a String but got #{source_text.class}")
66
- end
67
-
68
- begin
69
- parsed_result = parsing_method(source_text.encode('UTF-8'), filename)
70
- rescue => e
71
- raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
72
- end
73
-
74
- adapter_class.new.adapt(parsed_result)
75
- end
76
-
77
-
78
- private
79
-
80
-
81
- gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
82
- gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
83
-
84
- # Previous versions of the gem had more variation between their parsing methods and so it was more
85
- # understandable to have different methods instead of a single method with lots of conditional statements
86
- # inside of it, so I'm leaving this here in case it changes again
87
- # rubocop:disable Lint/DuplicateMethods
88
- case gherkin_major_version
89
- when 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37
90
- # The method to use for parsing Gherkin text
91
- def parsing_method(source_text, filename)
92
- messages = Gherkin.from_source(filename,
93
- source_text,
94
- { include_gherkin_document: true })
95
- .to_a
96
-
97
- error_message = messages.find(&:parse_error)
98
- gherkin_ast_message = messages.find(&:gherkin_document)
99
-
100
- raise error_message.parse_error.message if error_message
101
-
102
- gherkin_ast_message.gherkin_document
103
- end
104
- when 19
105
- # The method to use for parsing Gherkin text
106
- def parsing_method(source_text, filename)
107
- messages = Gherkin.from_source(filename,
108
- source_text,
109
- { include_gherkin_document: true })
110
- .to_a.map(&:to_hash)
111
-
112
- error_message = messages.find { |message| message[:parseError] }
113
- gherkin_ast_message = messages.find { |message| message[:gherkinDocument] }
114
-
115
- raise error_message[:parseError][:message] if error_message
116
-
117
- gherkin_ast_message[:gherkinDocument]
118
- end
119
- when 13, 14, 15, 16, 17, 18
120
- # The method to use for parsing Gherkin text
121
- def parsing_method(source_text, filename)
122
- messages = Gherkin.from_source(filename,
123
- source_text,
124
- { include_gherkin_document: true })
125
- .to_a.map(&:to_hash)
126
-
127
- error_message = messages.find { |message| message[:parse_error] }
128
- gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
129
-
130
- raise error_message[:parse_error][:message] if error_message
131
-
132
- gherkin_ast_message[:gherkin_document]
133
- end
134
- when 12
135
- # The method to use for parsing Gherkin text
136
- def parsing_method(source_text, filename)
137
- messages = Gherkin.from_source(filename,
138
- source_text,
139
- { include_gherkin_document: true })
140
- .to_a.map(&:to_hash)
141
-
142
- potential_error_message = messages.find { |message| message[:attachment] }
143
- gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
144
-
145
- if potential_error_message && potential_error_message[:attachment][:body] =~ /expected.*got/
146
- raise potential_error_message[:attachment][:body]
147
- end
148
-
149
- gherkin_ast_message[:gherkin_document]
150
- end
151
- when 9, 10, 11
152
- # The method to use for parsing Gherkin text
153
- def parsing_method(source_text, filename)
154
- messages = Gherkin.from_source(filename,
155
- source_text,
156
- { include_gherkin_document: true })
157
- .to_a.map(&:to_hash)
158
-
159
- potential_error_message = messages.find { |message| message[:attachment] }
160
- gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
161
-
162
- if potential_error_message && potential_error_message[:attachment][:text] =~ /expected.*got/
163
- raise potential_error_message[:attachment][:text]
164
- end
165
-
166
- gherkin_ast_message[:gherkin_document]
167
- end
168
- end
169
- # rubocop:enable Lint/DuplicateMethods
170
-
171
- # The adapter to use when converting an AST to a standard internal shape
172
- define_method('adapter_class') do
173
- CukeModeler.const_get("Gherkin#{gherkin_major_version}Adapter")
174
- end
175
-
176
- end
177
-
178
-
179
- private
180
-
181
-
182
- def dialect_feature_keyword
183
- get_word(Parsing.dialects[Parsing.dialect]['feature'])
184
- end
185
-
186
- def dialect_scenario_keyword
187
- get_word(Parsing.dialects[Parsing.dialect]['scenario'])
188
- end
189
-
190
- def dialect_outline_keyword
191
- get_word(Parsing.dialects[Parsing.dialect]['scenarioOutline'] ||
192
- Parsing.dialects[Parsing.dialect]['scenario_outline'])
193
- end
194
-
195
- def dialect_step_keyword
196
- get_word(Parsing.dialects[Parsing.dialect]['given'])
197
- end
198
-
199
- def get_word(word_set)
200
- word_set = word_set.split('|') unless word_set.is_a?(Array)
201
-
202
- word_set.first
203
- end
204
-
205
- end
206
- end
207
-
208
- # rubocop:enable Metrics/ModuleLength
1
+ # rubocop:disable Metrics/ModuleLength -- Just not going to worry about this
2
+
3
+ # Have to at least load some version of the gem before which version of the gem has been loaded can
4
+ # be determined and the rest of the needed files can be loaded.
5
+ require 'gherkin'
6
+
7
+
8
+ # The *cucumber-gherkin* has different grammar rules across major versions. Parsing will be done with
9
+ # an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
10
+ gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
11
+ gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
12
+ supported_gherkin_versions = (9..38)
13
+
14
+ raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
15
+
16
+ require "cuke_modeler/adapters/gherkin_#{gherkin_major_version}_adapter"
17
+
18
+
19
+ module CukeModeler
20
+
21
+ # A module providing source text parsing functionality.
22
+ module Parsing
23
+
24
+ class << self
25
+
26
+ # The dialect that will be used to parse snippets of Gherkin text
27
+ attr_writer :dialect
28
+
29
+
30
+ # The dialect that will be used to parse snippets of Gherkin text
31
+ #
32
+ # @example
33
+ # Parsing.dialect
34
+ #
35
+ # @return [String] The current dialect. Defaults to 'en'.
36
+ def dialect
37
+ @dialect || 'en'
38
+ end
39
+
40
+ # The dialects currently known by the cucumber-gherkin gem. See *Gherkin::DIALECTS*.
41
+ #
42
+ # @example
43
+ # Parsing.dialects
44
+ #
45
+ # @return [Hash] The dialect data
46
+ def dialects
47
+ Gherkin::DIALECTS
48
+ end
49
+
50
+ # Parses the Cucumber feature given in *source_text* and returns a Hash representation of
51
+ # its logical structure. This is a standardized AST that should remain consistent across
52
+ # different versions of `cucumber-gherkin`
53
+ #
54
+ # @example
55
+ # Parsing.parse_text('Feature: Some feature')
56
+ # Parsing.parse_text('Feature: Some feature', 'my.feature')
57
+ #
58
+ # @param source_text [String] The Gherkin text to parse
59
+ # @param filename [String] The file name associated with the parsed text. Used for error messages.
60
+ # @raise [ArgumentError] If *source_text* is not a String
61
+ # @raise [ArgumentError] If *source_text* does not parse cleanly
62
+ # @return [Hash] An AST of the text
63
+ def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
64
+ unless source_text.is_a?(String)
65
+ raise(ArgumentError, "Text to parse must be a String but got #{source_text.class}")
66
+ end
67
+
68
+ begin
69
+ parsed_result = parsing_method(source_text.encode('UTF-8'), filename)
70
+ rescue => e
71
+ raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
72
+ end
73
+
74
+ adapter_class.new.adapt(parsed_result)
75
+ end
76
+
77
+
78
+ private
79
+
80
+
81
+ gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
82
+ gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
83
+
84
+ # Previous versions of the gem had more variation between their parsing methods and so it was more
85
+ # understandable to have different methods instead of a single method with lots of conditional statements
86
+ # inside of it, so I'm leaving this here in case it changes again
87
+ # rubocop:disable Lint/DuplicateMethods
88
+ case gherkin_major_version
89
+ when 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38
90
+ # The method to use for parsing Gherkin text
91
+ def parsing_method(source_text, filename)
92
+ messages = Gherkin.from_source(filename,
93
+ source_text,
94
+ { include_gherkin_document: true })
95
+ .to_a
96
+
97
+ error_message = messages.find(&:parse_error)
98
+ gherkin_ast_message = messages.find(&:gherkin_document)
99
+
100
+ raise error_message.parse_error.message if error_message
101
+
102
+ gherkin_ast_message.gherkin_document
103
+ end
104
+ when 19
105
+ # The method to use for parsing Gherkin text
106
+ def parsing_method(source_text, filename)
107
+ messages = Gherkin.from_source(filename,
108
+ source_text,
109
+ { include_gherkin_document: true })
110
+ .to_a.map(&:to_hash)
111
+
112
+ error_message = messages.find { |message| message[:parseError] }
113
+ gherkin_ast_message = messages.find { |message| message[:gherkinDocument] }
114
+
115
+ raise error_message[:parseError][:message] if error_message
116
+
117
+ gherkin_ast_message[:gherkinDocument]
118
+ end
119
+ when 13, 14, 15, 16, 17, 18
120
+ # The method to use for parsing Gherkin text
121
+ def parsing_method(source_text, filename)
122
+ messages = Gherkin.from_source(filename,
123
+ source_text,
124
+ { include_gherkin_document: true })
125
+ .to_a.map(&:to_hash)
126
+
127
+ error_message = messages.find { |message| message[:parse_error] }
128
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
129
+
130
+ raise error_message[:parse_error][:message] if error_message
131
+
132
+ gherkin_ast_message[:gherkin_document]
133
+ end
134
+ when 12
135
+ # The method to use for parsing Gherkin text
136
+ def parsing_method(source_text, filename)
137
+ messages = Gherkin.from_source(filename,
138
+ source_text,
139
+ { include_gherkin_document: true })
140
+ .to_a.map(&:to_hash)
141
+
142
+ potential_error_message = messages.find { |message| message[:attachment] }
143
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
144
+
145
+ if potential_error_message && potential_error_message[:attachment][:body] =~ /expected.*got/
146
+ raise potential_error_message[:attachment][:body]
147
+ end
148
+
149
+ gherkin_ast_message[:gherkin_document]
150
+ end
151
+ when 9, 10, 11
152
+ # The method to use for parsing Gherkin text
153
+ def parsing_method(source_text, filename)
154
+ messages = Gherkin.from_source(filename,
155
+ source_text,
156
+ { include_gherkin_document: true })
157
+ .to_a.map(&:to_hash)
158
+
159
+ potential_error_message = messages.find { |message| message[:attachment] }
160
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
161
+
162
+ if potential_error_message && potential_error_message[:attachment][:text] =~ /expected.*got/
163
+ raise potential_error_message[:attachment][:text]
164
+ end
165
+
166
+ gherkin_ast_message[:gherkin_document]
167
+ end
168
+ end
169
+ # rubocop:enable Lint/DuplicateMethods
170
+
171
+ # The adapter to use when converting an AST to a standard internal shape
172
+ define_method('adapter_class') do
173
+ CukeModeler.const_get("Gherkin#{gherkin_major_version}Adapter")
174
+ end
175
+
176
+ end
177
+
178
+
179
+ private
180
+
181
+
182
+ def dialect_feature_keyword
183
+ get_word(Parsing.dialects[Parsing.dialect]['feature'])
184
+ end
185
+
186
+ def dialect_scenario_keyword
187
+ get_word(Parsing.dialects[Parsing.dialect]['scenario'])
188
+ end
189
+
190
+ def dialect_outline_keyword
191
+ get_word(Parsing.dialects[Parsing.dialect]['scenarioOutline'] ||
192
+ Parsing.dialects[Parsing.dialect]['scenario_outline'])
193
+ end
194
+
195
+ def dialect_step_keyword
196
+ get_word(Parsing.dialects[Parsing.dialect]['given'])
197
+ end
198
+
199
+ def get_word(word_set)
200
+ word_set = word_set.split('|') unless word_set.is_a?(Array)
201
+
202
+ word_set.first
203
+ end
204
+
205
+ end
206
+ end
207
+
208
+ # rubocop:enable Metrics/ModuleLength
@@ -1,29 +1,29 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that know from which line of
6
- # source code they originate. Internal helper class.
7
- module Sourceable
8
-
9
- # @api
10
- #
11
- # The line number where the element began in the source code
12
- attr_accessor :source_line
13
-
14
- # @api
15
- #
16
- # The column number where the element began in the source code
17
- attr_accessor :source_column
18
-
19
-
20
- private
21
-
22
-
23
- def populate_source_location(parsed_model_data)
24
- @source_line = parsed_model_data['line']
25
- @source_column = parsed_model_data['column']
26
- end
27
-
28
- end
29
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that know from which line of
6
+ # source code they originate. Internal helper class.
7
+ module Sourceable
8
+
9
+ # @api
10
+ #
11
+ # The line number where the element began in the source code
12
+ attr_accessor :source_line
13
+
14
+ # @api
15
+ #
16
+ # The column number where the element began in the source code
17
+ attr_accessor :source_column
18
+
19
+
20
+ private
21
+
22
+
23
+ def populate_source_location(parsed_model_data)
24
+ @source_line = parsed_model_data['line']
25
+ @source_column = parsed_model_data['column']
26
+ end
27
+
28
+ end
29
+ end
@@ -1,34 +1,34 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that represent an element that has steps. Internal helper class.
6
- module Stepped
7
-
8
- # @api
9
- #
10
- # The step models contained by this model
11
- attr_accessor :steps
12
-
13
-
14
- private
15
-
16
-
17
- def steps_output_string
18
- steps.collect { |step| indented_step_text(step) }.join("\n")
19
- end
20
-
21
- def indented_step_text(step)
22
- step.to_s.split("\n").collect { |line| " #{line}" }.join("\n")
23
- end
24
-
25
- def populate_steps(parsed_model_data)
26
- return unless parsed_model_data['steps']
27
-
28
- parsed_model_data['steps'].each do |step_data|
29
- @steps << build_child_model(Step, step_data)
30
- end
31
- end
32
-
33
- end
34
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that represent an element that has steps. Internal helper class.
6
+ module Stepped
7
+
8
+ # @api
9
+ #
10
+ # The step models contained by this model
11
+ attr_accessor :steps
12
+
13
+
14
+ private
15
+
16
+
17
+ def steps_output_string
18
+ steps.collect { |step| indented_step_text(step) }.join("\n")
19
+ end
20
+
21
+ def indented_step_text(step)
22
+ step.to_s.split("\n").collect { |line| " #{line}" }.join("\n")
23
+ end
24
+
25
+ def populate_steps(parsed_model_data)
26
+ return unless parsed_model_data['steps']
27
+
28
+ parsed_model_data['steps'].each do |step_data|
29
+ @steps << build_child_model(Step, step_data)
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -1,57 +1,57 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that represent an element that can be
6
- # tagged. Internal helper class.
7
- module Taggable
8
-
9
- # @api
10
- #
11
- # The models for tags which are directly assigned to the element
12
- attr_accessor :tags
13
-
14
-
15
- # @api
16
- #
17
- # Returns the models for tags which are indirectly assigned to the element (i.e. they
18
- # have been inherited from a parent element).
19
- #
20
- # @example
21
- # model.applied_tags
22
- #
23
- # @return [Array<Tag>] Applied tag models
24
- def applied_tags
25
- parent_model.respond_to?(:all_tags) ? parent_model.all_tags : []
26
- end
27
-
28
- # @api
29
- #
30
- # Returns models for all of the tags which are applicable to the element.
31
- #
32
- # @example
33
- # model.all_tags
34
- #
35
- # @return [Array<Tag>] All tag models
36
- def all_tags
37
- applied_tags + @tags
38
- end
39
-
40
-
41
- private
42
-
43
-
44
- def tag_output_string
45
- tags.map(&:name).join(' ')
46
- end
47
-
48
- def populate_tags(parsed_model_data)
49
- return unless parsed_model_data['tags']
50
-
51
- parsed_model_data['tags'].each do |tag|
52
- @tags << build_child_model(Tag, tag)
53
- end
54
- end
55
-
56
- end
57
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that represent an element that can be
6
+ # tagged. Internal helper class.
7
+ module Taggable
8
+
9
+ # @api
10
+ #
11
+ # The models for tags which are directly assigned to the element
12
+ attr_accessor :tags
13
+
14
+
15
+ # @api
16
+ #
17
+ # Returns the models for tags which are indirectly assigned to the element (i.e. they
18
+ # have been inherited from a parent element).
19
+ #
20
+ # @example
21
+ # model.applied_tags
22
+ #
23
+ # @return [Array<Tag>] Applied tag models
24
+ def applied_tags
25
+ parent_model.respond_to?(:all_tags) ? parent_model.all_tags : []
26
+ end
27
+
28
+ # @api
29
+ #
30
+ # Returns models for all of the tags which are applicable to the element.
31
+ #
32
+ # @example
33
+ # model.all_tags
34
+ #
35
+ # @return [Array<Tag>] All tag models
36
+ def all_tags
37
+ applied_tags + @tags
38
+ end
39
+
40
+
41
+ private
42
+
43
+
44
+ def tag_output_string
45
+ tags.map(&:name).join(' ')
46
+ end
47
+
48
+ def populate_tags(parsed_model_data)
49
+ return unless parsed_model_data['tags']
50
+
51
+ parsed_model_data['tags'].each do |tag|
52
+ @tags << build_child_model(Tag, tag)
53
+ end
54
+ end
55
+
56
+ end
57
+ end
@@ -1,4 +1,4 @@
1
- module CukeModeler
2
- # The gem version
3
- VERSION = '3.27.0'.freeze
4
- end
1
+ module CukeModeler
2
+ # The gem version
3
+ VERSION = '3.28.0'.freeze
4
+ end