Skip to content

Commit a05fc29

Browse files
Merge pull request #412 from Earlopain/drop-ostruct
Drop dependency on `ostruct`
2 parents 081f706 + 07ee1a3 commit a05fc29

File tree

11 files changed

+12
-12
lines changed

11 files changed

+12
-12
lines changed

hutch.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Gem::Specification.new do |gem|
1111
gem.add_runtime_dependency 'carrot-top', '~> 0.0.7'
1212
gem.add_runtime_dependency 'multi_json', '~> 1.15'
1313
gem.add_runtime_dependency 'activesupport', '>= 4.2'
14-
gem.add_runtime_dependency 'ostruct', '~> 0.6'
1514

1615
gem.name = 'hutch'
1716
gem.summary = 'Opinionated asynchronous inter-service communication using RabbitMQ'

lib/hutch/broker.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'active_support/core_ext/object/blank'
22

33
require 'carrot-top'
4-
require 'ostruct'
54
require 'hutch/logging'
65
require 'hutch/exceptions'
76
require 'hutch/publisher'
@@ -269,8 +268,11 @@ def using_publisher_confirmations?
269268

270269
private
271270

271+
Config = Struct.new(:host, :port, :username, :password, :ssl, :protocol, :sanitized_uri)
272+
private_constant :Config
273+
272274
def api_config
273-
@api_config ||= OpenStruct.new.tap do |config|
275+
@api_config ||= Config.new.tap do |config|
274276
config.host = @config[:mq_api_host]
275277
config.port = @config[:mq_api_port]
276278
config.username = @config[:mq_username]

spec/hutch/error_handlers/airbrake_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
it "logs the error to Airbrake" do
1616
message_id = "1"
17-
properties = OpenStruct.new(message_id: message_id)
17+
properties = Struct.new(:message_id).new(message_id)
1818
payload = "{}"
1919
consumer = double
2020
ex = error

spec/hutch/error_handlers/bugsnag_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
it "logs the error to Bugsnag" do
2525
message_id = "1"
26-
properties = OpenStruct.new(message_id: message_id)
26+
properties = Struct.new(:message_id).new(message_id)
2727
payload = "{}"
2828
consumer = double
2929
ex = error

spec/hutch/error_handlers/honeybadger_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
it "logs the error to Honeybadger" do
1616
message_id = "1"
17-
properties = OpenStruct.new(message_id: message_id)
17+
properties = Struct.new(:message_id).new(message_id)
1818
payload = "{}"
1919
consumer = double
2020
ex = error

spec/hutch/error_handlers/logger_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
let(:error_handler) { Hutch::ErrorHandlers::Logger.new }
55

66
describe '#handle' do
7-
let(:properties) { OpenStruct.new(message_id: "1") }
7+
let(:properties) { Struct.new(:message_id).new("1") }
88
let(:payload) { "{}" }
99
let(:error) { double(message: "Stuff went wrong", class: "RuntimeError",
1010
backtrace: ["line 1", "line 2"]) }

spec/hutch/error_handlers/rollbar_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
it "logs the error to Rollbar" do
1616
message_id = "1"
17-
properties = OpenStruct.new(message_id: message_id)
17+
properties = Struct.new(:message_id).new(message_id)
1818
payload = "{}"
1919
consumer = double
2020
ex = error

spec/hutch/error_handlers/sentry_raven_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
let(:error_handler) { Hutch::ErrorHandlers::SentryRaven.new }
55

66
describe '#handle' do
7-
let(:properties) { OpenStruct.new(message_id: "1") }
7+
let(:properties) { Struct.new(:message_id).new("1") }
88
let(:payload) { "{}" }
99
let(:error) do
1010
begin

spec/hutch/error_handlers/sentry_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
end
1313

1414
describe '#handle' do
15-
let(:properties) { OpenStruct.new(message_id: "1") }
15+
let(:properties) { Struct.new(:message_id).new("1") }
1616
let(:payload) { "{}" }
1717
let(:error) do
1818
begin

spec/hutch/tracers/datadog_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize
1616
end
1717

1818
def class
19-
OpenStruct.new(name: 'ClassName')
19+
Struct.new(:name).new('ClassName')
2020
end
2121

2222
def process(message)

0 commit comments

Comments
 (0)