Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.

## [Unreleased]
### Added
- Added `#to_envelope` for `Cucumber::Core::Gherkin::Document` ([#329](https://github.com/cucumber/cucumber-ruby-core/pull/329))

### Changed
- Refactored the internal base `Event` class to reduce complexity and make it more flexible for future use (No user facing changes)

Expand Down
18 changes: 14 additions & 4 deletions lib/cucumber/core/gherkin/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@ class Document
attr_reader :uri, :body, :language

def initialize(uri, body, language = nil)
@uri = uri
@body = body
@uri = uri
@body = body
@language = language || 'en'
end

def ==(other)
to_s == other.to_s
end

def to_s
body
end

def ==(other)
to_s == other.to_s
def to_envelope
Cucumber::Messages::Envelope.new(
source: Cucumber::Messages::Source.new(
uri: uri,
data: body,
media_type: 'text/x.cucumber.gherkin+plain'
)
)
end
end
end
Expand Down
Loading