Class: Cucumber::Core::Gherkin::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/gherkin/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, body, language = 'en') ⇒ Document

Returns a new instance of Document.



9
10
11
12
13
# File 'lib/cucumber/core/gherkin/document.rb', line 9

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

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/cucumber/core/gherkin/document.rb', line 7

def body
  @body
end

#languageObject (readonly)

Returns the value of attribute language.



7
8
9
# File 'lib/cucumber/core/gherkin/document.rb', line 7

def language
  @language
end

#uriObject (readonly)

Returns the value of attribute uri.



7
8
9
# File 'lib/cucumber/core/gherkin/document.rb', line 7

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/cucumber/core/gherkin/document.rb', line 15

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

#to_envelopeObject



23
24
25
26
27
28
29
30
31
# File 'lib/cucumber/core/gherkin/document.rb', line 23

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

#to_sObject



19
20
21
# File 'lib/cucumber/core/gherkin/document.rb', line 19

def to_s
  body
end