Class: PactBroker::Api::Decorators::ErrorDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/api/decorators/error_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ ErrorDecorator

Returns a new instance of ErrorDecorator.

Parameters:

  • error (String)


10
11
12
# File 'lib/pact_broker/api/decorators/error_decorator.rb', line 10

def initialize(error)
  @error = error
end

Instance Method Details

#to_hash(*_args, **_kwargs) ⇒ Hash

Returns:

  • (Hash)


15
16
17
# File 'lib/pact_broker/api/decorators/error_decorator.rb', line 15

def to_hash(*_args, **_kwargs)
  { error: error }
end

#to_json(*args, **kwargs) ⇒ String

Returns JSON.

Returns:

  • (String)

    JSON



20
21
22
# File 'lib/pact_broker/api/decorators/error_decorator.rb', line 20

def to_json(*args, **kwargs)
  to_hash(*args, **kwargs).to_json
end