cucumber-messages 24.0.1 → 25.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/cucumber/messages/attachment.rb +126 -0
  4. data/lib/cucumber/messages/attachment_content_encoding.rb +11 -0
  5. data/lib/cucumber/messages/background.rb +64 -0
  6. data/lib/cucumber/messages/ci.rb +62 -0
  7. data/lib/cucumber/messages/comment.rb +50 -0
  8. data/lib/cucumber/messages/data_table.rb +41 -0
  9. data/lib/cucumber/messages/doc_string.rb +51 -0
  10. data/lib/cucumber/messages/duration.rb +50 -0
  11. data/lib/cucumber/messages/envelope.rb +124 -0
  12. data/lib/cucumber/messages/examples.rb +74 -0
  13. data/lib/cucumber/messages/exception.rb +57 -0
  14. data/lib/cucumber/messages/feature.rb +87 -0
  15. data/lib/cucumber/messages/feature_child.rb +49 -0
  16. data/lib/cucumber/messages/gherkin_document.rb +62 -0
  17. data/lib/cucumber/messages/git.rb +54 -0
  18. data/lib/cucumber/messages/group.rb +46 -0
  19. data/lib/cucumber/messages/helpers/id_generator/incrementing.rb +20 -0
  20. data/lib/cucumber/messages/helpers/id_generator/uuid.rb +17 -0
  21. data/lib/cucumber/messages/helpers/id_generator.rb +4 -0
  22. data/lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb +30 -0
  23. data/lib/cucumber/messages/helpers/time_conversion.rb +31 -0
  24. data/lib/cucumber/messages/hook.rb +51 -0
  25. data/lib/cucumber/messages/java_method.rb +46 -0
  26. data/lib/cucumber/messages/java_stack_trace_element.rb +46 -0
  27. data/lib/cucumber/messages/location.rb +44 -0
  28. data/lib/cucumber/messages/message.rb +92 -4
  29. data/lib/cucumber/messages/meta.rb +81 -0
  30. data/lib/cucumber/messages/parameter_type.rb +64 -0
  31. data/lib/cucumber/messages/parse_error.rb +41 -0
  32. data/lib/cucumber/messages/pickle.rb +107 -0
  33. data/lib/cucumber/messages/pickle_doc_string.rb +41 -0
  34. data/lib/cucumber/messages/pickle_step.rb +71 -0
  35. data/lib/cucumber/messages/pickle_step_argument.rb +43 -0
  36. data/lib/cucumber/messages/pickle_step_type.rb +13 -0
  37. data/lib/cucumber/messages/pickle_table.rb +36 -0
  38. data/lib/cucumber/messages/pickle_table_cell.rb +36 -0
  39. data/lib/cucumber/messages/pickle_table_row.rb +36 -0
  40. data/lib/cucumber/messages/pickle_tag.rb +47 -0
  41. data/lib/cucumber/messages/product.rb +49 -0
  42. data/lib/cucumber/messages/rule.rb +72 -0
  43. data/lib/cucumber/messages/rule_child.rb +44 -0
  44. data/lib/cucumber/messages/scenario.rb +74 -0
  45. data/lib/cucumber/messages/source.rb +63 -0
  46. data/lib/cucumber/messages/source_media_type.rb +11 -0
  47. data/lib/cucumber/messages/source_reference.rb +55 -0
  48. data/lib/cucumber/messages/step.rb +80 -0
  49. data/lib/cucumber/messages/step_definition.rb +46 -0
  50. data/lib/cucumber/messages/step_definition_pattern.rb +41 -0
  51. data/lib/cucumber/messages/step_definition_pattern_type.rb +11 -0
  52. data/lib/cucumber/messages/step_keyword_type.rb +14 -0
  53. data/lib/cucumber/messages/step_match_argument.rb +54 -0
  54. data/lib/cucumber/messages/step_match_arguments_list.rb +36 -0
  55. data/lib/cucumber/messages/table_cell.rb +49 -0
  56. data/lib/cucumber/messages/table_row.rb +54 -0
  57. data/lib/cucumber/messages/tag.rb +58 -0
  58. data/lib/cucumber/messages/test_case.rb +54 -0
  59. data/lib/cucumber/messages/test_case_finished.rb +46 -0
  60. data/lib/cucumber/messages/test_case_started.rb +69 -0
  61. data/lib/cucumber/messages/test_run_finished.rb +63 -0
  62. data/lib/cucumber/messages/test_run_started.rb +36 -0
  63. data/lib/cucumber/messages/test_step.rb +74 -0
  64. data/lib/cucumber/messages/test_step_finished.rb +51 -0
  65. data/lib/cucumber/messages/test_step_result.rb +57 -0
  66. data/lib/cucumber/messages/test_step_result_status.rb +16 -0
  67. data/lib/cucumber/messages/test_step_started.rb +46 -0
  68. data/lib/cucumber/messages/timestamp.rb +52 -0
  69. data/lib/cucumber/messages/undefined_parameter_type.rb +41 -0
  70. data/lib/cucumber/messages.rb +9 -5
  71. metadata +110 -30
  72. data/lib/cucumber/messages/id_generator.rb +0 -24
  73. data/lib/cucumber/messages/message/deserialization.rb +0 -37
  74. data/lib/cucumber/messages/message/serialization.rb +0 -70
  75. data/lib/cucumber/messages/message/utils.rb +0 -45
  76. data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +0 -21
  77. data/lib/cucumber/messages/time_conversion.rb +0 -33
  78. data/lib/cucumber/messages.deserializers.rb +0 -1208
  79. data/lib/cucumber/messages.dtos.rb +0 -1782
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Exception message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # A simplified representation of an exception
11
+ ##
12
+ class Exception < Message
13
+ ##
14
+ # The type of the exception that caused this result. E.g. "Error" or "org.opentest4j.AssertionFailedError"
15
+ ##
16
+ attr_reader :type
17
+
18
+ ##
19
+ # The message of exception that caused this result. E.g. expected: "a" but was: "b"
20
+ ##
21
+ attr_reader :message
22
+
23
+ ##
24
+ # The stringified stack trace of the exception that caused this result
25
+ ##
26
+ attr_reader :stack_trace
27
+
28
+ def initialize(
29
+ type: '',
30
+ message: nil,
31
+ stack_trace: nil
32
+ )
33
+ @type = type
34
+ @message = message
35
+ @stack_trace = stack_trace
36
+ super()
37
+ end
38
+
39
+ ##
40
+ # Returns a new Exception from the given hash.
41
+ # If the hash keys are camelCased, they are properly assigned to the
42
+ # corresponding snake_cased attributes.
43
+ #
44
+ # Cucumber::Messages::Exception.from_h(some_hash) # => #<Cucumber::Messages::Exception:0x... ...>
45
+ ##
46
+ def self.from_h(hash)
47
+ return nil if hash.nil?
48
+
49
+ new(
50
+ type: hash[:type],
51
+ message: hash[:message],
52
+ stack_trace: hash[:stackTrace]
53
+ )
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Feature message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class Feature < Message
11
+ ##
12
+ # The location of the `Feature` keyword
13
+ ##
14
+ attr_reader :location
15
+
16
+ ##
17
+ # All the tags placed above the `Feature` keyword
18
+ ##
19
+ attr_reader :tags
20
+
21
+ ##
22
+ # The [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document
23
+ ##
24
+ attr_reader :language
25
+
26
+ ##
27
+ # The text of the `Feature` keyword (in the language specified by `language`)
28
+ ##
29
+ attr_reader :keyword
30
+
31
+ ##
32
+ # The name of the feature (the text following the `keyword`)
33
+ ##
34
+ attr_reader :name
35
+
36
+ ##
37
+ # The line(s) underneath the line with the `keyword` that are used as description
38
+ ##
39
+ attr_reader :description
40
+
41
+ ##
42
+ # Zero or more children
43
+ ##
44
+ attr_reader :children
45
+
46
+ def initialize(
47
+ location: Location.new,
48
+ tags: [],
49
+ language: '',
50
+ keyword: '',
51
+ name: '',
52
+ description: '',
53
+ children: []
54
+ )
55
+ @location = location
56
+ @tags = tags
57
+ @language = language
58
+ @keyword = keyword
59
+ @name = name
60
+ @description = description
61
+ @children = children
62
+ super()
63
+ end
64
+
65
+ ##
66
+ # Returns a new Feature from the given hash.
67
+ # If the hash keys are camelCased, they are properly assigned to the
68
+ # corresponding snake_cased attributes.
69
+ #
70
+ # Cucumber::Messages::Feature.from_h(some_hash) # => #<Cucumber::Messages::Feature:0x... ...>
71
+ ##
72
+ def self.from_h(hash)
73
+ return nil if hash.nil?
74
+
75
+ new(
76
+ location: Location.from_h(hash[:location]),
77
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
78
+ language: hash[:language],
79
+ keyword: hash[:keyword],
80
+ name: hash[:name],
81
+ description: hash[:description],
82
+ children: hash[:children]&.map { |item| FeatureChild.from_h(item) }
83
+ )
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the FeatureChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # A child node of a `Feature` node
12
+ ##
13
+ class FeatureChild < Message
14
+ attr_reader :rule
15
+
16
+ attr_reader :background
17
+
18
+ attr_reader :scenario
19
+
20
+ def initialize(
21
+ rule: nil,
22
+ background: nil,
23
+ scenario: nil
24
+ )
25
+ @rule = rule
26
+ @background = background
27
+ @scenario = scenario
28
+ super()
29
+ end
30
+
31
+ ##
32
+ # Returns a new FeatureChild from the given hash.
33
+ # If the hash keys are camelCased, they are properly assigned to the
34
+ # corresponding snake_cased attributes.
35
+ #
36
+ # Cucumber::Messages::FeatureChild.from_h(some_hash) # => #<Cucumber::Messages::FeatureChild:0x... ...>
37
+ ##
38
+ def self.from_h(hash)
39
+ return nil if hash.nil?
40
+
41
+ new(
42
+ rule: Rule.from_h(hash[:rule]),
43
+ background: Background.from_h(hash[:background]),
44
+ scenario: Scenario.from_h(hash[:scenario])
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the GherkinDocument message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document.
12
+ # Cucumber implementations should *not* depend on `GherkinDocument` or any of its
13
+ # children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead.
14
+ #
15
+ # The only consumers of `GherkinDocument` should only be formatters that produce
16
+ # "rich" output, resembling the original Gherkin document.
17
+ ##
18
+ class GherkinDocument < Message
19
+ ##
20
+ # *
21
+ # The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
22
+ # of the source, typically a file path relative to the root directory
23
+ ##
24
+ attr_reader :uri
25
+
26
+ attr_reader :feature
27
+
28
+ ##
29
+ # All the comments in the Gherkin document
30
+ ##
31
+ attr_reader :comments
32
+
33
+ def initialize(
34
+ uri: nil,
35
+ feature: nil,
36
+ comments: []
37
+ )
38
+ @uri = uri
39
+ @feature = feature
40
+ @comments = comments
41
+ super()
42
+ end
43
+
44
+ ##
45
+ # Returns a new GherkinDocument from the given hash.
46
+ # If the hash keys are camelCased, they are properly assigned to the
47
+ # corresponding snake_cased attributes.
48
+ #
49
+ # Cucumber::Messages::GherkinDocument.from_h(some_hash) # => #<Cucumber::Messages::GherkinDocument:0x... ...>
50
+ ##
51
+ def self.from_h(hash)
52
+ return nil if hash.nil?
53
+
54
+ new(
55
+ uri: hash[:uri],
56
+ feature: Feature.from_h(hash[:feature]),
57
+ comments: hash[:comments]&.map { |item| Comment.from_h(item) }
58
+ )
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Git message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # Information about Git, provided by the Build/CI server as environment
11
+ # variables.
12
+ ##
13
+ class Git < Message
14
+ attr_reader :remote
15
+
16
+ attr_reader :revision
17
+
18
+ attr_reader :branch
19
+
20
+ attr_reader :tag
21
+
22
+ def initialize(
23
+ remote: '',
24
+ revision: '',
25
+ branch: nil,
26
+ tag: nil
27
+ )
28
+ @remote = remote
29
+ @revision = revision
30
+ @branch = branch
31
+ @tag = tag
32
+ super()
33
+ end
34
+
35
+ ##
36
+ # Returns a new Git from the given hash.
37
+ # If the hash keys are camelCased, they are properly assigned to the
38
+ # corresponding snake_cased attributes.
39
+ #
40
+ # Cucumber::Messages::Git.from_h(some_hash) # => #<Cucumber::Messages::Git:0x... ...>
41
+ ##
42
+ def self.from_h(hash)
43
+ return nil if hash.nil?
44
+
45
+ new(
46
+ remote: hash[:remote],
47
+ revision: hash[:revision],
48
+ branch: hash[:branch],
49
+ tag: hash[:tag]
50
+ )
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Group message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class Group < Message
11
+ attr_reader :children
12
+
13
+ attr_reader :start
14
+
15
+ attr_reader :value
16
+
17
+ def initialize(
18
+ children: [],
19
+ start: nil,
20
+ value: nil
21
+ )
22
+ @children = children
23
+ @start = start
24
+ @value = value
25
+ super()
26
+ end
27
+
28
+ ##
29
+ # Returns a new Group from the given hash.
30
+ # If the hash keys are camelCased, they are properly assigned to the
31
+ # corresponding snake_cased attributes.
32
+ #
33
+ # Cucumber::Messages::Group.from_h(some_hash) # => #<Cucumber::Messages::Group:0x... ...>
34
+ ##
35
+ def self.from_h(hash)
36
+ return nil if hash.nil?
37
+
38
+ new(
39
+ children: hash[:children]&.map { |item| Group.from_h(item) },
40
+ start: hash[:start],
41
+ value: hash[:value]
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Messages
5
+ module Helpers
6
+ module IdGenerator
7
+ class Incrementing
8
+ def initialize
9
+ @index = -1
10
+ end
11
+
12
+ def new_id
13
+ @index += 1
14
+ @index.to_s
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+
5
+ module Cucumber
6
+ module Messages
7
+ module Helpers
8
+ module IdGenerator
9
+ class UUID
10
+ def new_id
11
+ SecureRandom.uuid
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'id_generator/uuid'
4
+ require_relative 'id_generator/incrementing'
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/messages'
4
+
5
+ module Cucumber
6
+ module Messages
7
+ module Helpers
8
+ class NdjsonToMessageEnumerator < Enumerator
9
+ def initialize(io)
10
+ super() do |yielder|
11
+ io.each_line do |line|
12
+ next if line.strip.empty?
13
+
14
+ message = extract_message(line)
15
+ yielder.yield(message)
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def extract_message(json_line)
23
+ Envelope.from_json(json_line)
24
+ rescue StandardError
25
+ raise "Not JSON: #{json_line.strip}"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Messages
5
+ module Helpers
6
+ module TimeConversion
7
+ NANOSECONDS_PER_SECOND = 1_000_000_000
8
+
9
+ def time_to_timestamp(time)
10
+ { 'seconds' => time.to_i, 'nanos' => time.nsec }
11
+ end
12
+
13
+ def timestamp_to_time(timestamp)
14
+ Time.at(timestamp['seconds'] + (timestamp['nanos'].to_f / NANOSECONDS_PER_SECOND))
15
+ end
16
+
17
+ def seconds_to_duration(seconds_float)
18
+ seconds, second_modulus = seconds_float.divmod(1)
19
+ nanos = second_modulus * NANOSECONDS_PER_SECOND
20
+ { 'seconds' => seconds, 'nanos' => nanos.to_i }
21
+ end
22
+
23
+ def duration_to_seconds(duration)
24
+ seconds_part = duration['seconds']
25
+ nanos_part = duration['nanos'].to_f / NANOSECONDS_PER_SECOND
26
+ seconds_part + nanos_part
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Hook message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class Hook < Message
11
+ attr_reader :id
12
+
13
+ attr_reader :name
14
+
15
+ attr_reader :source_reference
16
+
17
+ attr_reader :tag_expression
18
+
19
+ def initialize(
20
+ id: '',
21
+ name: nil,
22
+ source_reference: SourceReference.new,
23
+ tag_expression: nil
24
+ )
25
+ @id = id
26
+ @name = name
27
+ @source_reference = source_reference
28
+ @tag_expression = tag_expression
29
+ super()
30
+ end
31
+
32
+ ##
33
+ # Returns a new Hook from the given hash.
34
+ # If the hash keys are camelCased, they are properly assigned to the
35
+ # corresponding snake_cased attributes.
36
+ #
37
+ # Cucumber::Messages::Hook.from_h(some_hash) # => #<Cucumber::Messages::Hook:0x... ...>
38
+ ##
39
+ def self.from_h(hash)
40
+ return nil if hash.nil?
41
+
42
+ new(
43
+ id: hash[:id],
44
+ name: hash[:name],
45
+ source_reference: SourceReference.from_h(hash[:sourceReference]),
46
+ tag_expression: hash[:tagExpression]
47
+ )
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the JavaMethod message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class JavaMethod < Message
11
+ attr_reader :class_name
12
+
13
+ attr_reader :method_name
14
+
15
+ attr_reader :method_parameter_types
16
+
17
+ def initialize(
18
+ class_name: '',
19
+ method_name: '',
20
+ method_parameter_types: []
21
+ )
22
+ @class_name = class_name
23
+ @method_name = method_name
24
+ @method_parameter_types = method_parameter_types
25
+ super()
26
+ end
27
+
28
+ ##
29
+ # Returns a new JavaMethod from the given hash.
30
+ # If the hash keys are camelCased, they are properly assigned to the
31
+ # corresponding snake_cased attributes.
32
+ #
33
+ # Cucumber::Messages::JavaMethod.from_h(some_hash) # => #<Cucumber::Messages::JavaMethod:0x... ...>
34
+ ##
35
+ def self.from_h(hash)
36
+ return nil if hash.nil?
37
+
38
+ new(
39
+ class_name: hash[:className],
40
+ method_name: hash[:methodName],
41
+ method_parameter_types: hash[:methodParameterTypes]
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the JavaStackTraceElement message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class JavaStackTraceElement < Message
11
+ attr_reader :class_name
12
+
13
+ attr_reader :file_name
14
+
15
+ attr_reader :method_name
16
+
17
+ def initialize(
18
+ class_name: '',
19
+ file_name: '',
20
+ method_name: ''
21
+ )
22
+ @class_name = class_name
23
+ @file_name = file_name
24
+ @method_name = method_name
25
+ super()
26
+ end
27
+
28
+ ##
29
+ # Returns a new JavaStackTraceElement from the given hash.
30
+ # If the hash keys are camelCased, they are properly assigned to the
31
+ # corresponding snake_cased attributes.
32
+ #
33
+ # Cucumber::Messages::JavaStackTraceElement.from_h(some_hash) # => #<Cucumber::Messages::JavaStackTraceElement:0x... ...>
34
+ ##
35
+ def self.from_h(hash)
36
+ return nil if hash.nil?
37
+
38
+ new(
39
+ class_name: hash[:className],
40
+ file_name: hash[:fileName],
41
+ method_name: hash[:methodName]
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Location message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # Points to a line and a column in a text file
12
+ ##
13
+ class Location < Message
14
+ attr_reader :line
15
+
16
+ attr_reader :column
17
+
18
+ def initialize(
19
+ line: 0,
20
+ column: nil
21
+ )
22
+ @line = line
23
+ @column = column
24
+ super()
25
+ end
26
+
27
+ ##
28
+ # Returns a new Location from the given hash.
29
+ # If the hash keys are camelCased, they are properly assigned to the
30
+ # corresponding snake_cased attributes.
31
+ #
32
+ # Cucumber::Messages::Location.from_h(some_hash) # => #<Cucumber::Messages::Location:0x... ...>
33
+ ##
34
+ def self.from_h(hash)
35
+ return nil if hash.nil?
36
+
37
+ new(
38
+ line: hash[:line],
39
+ column: hash[:column]
40
+ )
41
+ end
42
+ end
43
+ end
44
+ end