Skip to content

Instantly share code, notes, and snippets.

@rivant
Created November 17, 2015 14:49
Show Gist options
  • Save rivant/16418ddbdd78d755de9e to your computer and use it in GitHub Desktop.
Save rivant/16418ddbdd78d755de9e to your computer and use it in GitHub Desktop.
New:
class BaseNotifier
def initialize(attributes={})
@client_ip, @ec2_instance_id, @environment, @hl7_message,
@hl7_response, @queue_response, @stats, @title = %i(
client_ip ec2_instance_id environment hl7_message
hl7_response queue_response stats title
).map do |key|
attributes.fetch(key, '')
end
@pass = attributes.fetch(:pass, false)
end
Original:
class BaseNotifier
def initialize(data)
@client_ip = data.fetch(:client_ip, '')
@ec2_instance_id = data.fetch(:ec2_instance_id, '')
@environment = data.fetch(:environment, '')
@hl7_message = data.fetch(:hl7_message, '')
@hl7_response = data.fetch(:hl7_response, '')
@pass = data.fetch(:pass, false)
@queue_response = data.fetch(:queue_response, '')
@stats = data.fetch(:stats, '')
@title = data.fetch(:title, '')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment