title: What is the simplest way to store and retrieve my error values with Ruby?
body: <p>In my gem I have errors messages that I keep repeating like this:</p>
  
  <pre><code>def validate_configuration!
     fail(ArgumentError, "You must specify a valid access_key") if access_key.nil? || access_key.empty?
     fail(ArgumentError, "You must specify a valid access_token") if access_token.nil? || access_token.empty? 
     fail(ArgumentError, "You must specify a valid environment") if environment.nil? || environment.empty?
  end
  </code></pre>
  
  <p>and then in my tests I repeat the same:</p>
  
  <pre><code>it "is required and cannot be a blank string" do
     expect { create_client(access_key: nil) }.to  raise_error(ArgumentError, "You must specify a valid access_key")
     expect { create_client(access_key: '') }.to raise_error(ArgumentError, "You must specify a valid access_key")
  end
  </code></pre>
  
  <p>I would like to store all of these messages in a separate file in some kind of object(this is the confusing part) and then access them like so:</p>
  
  <pre><code>messages.nil_error_for(:access_key)
  messages.empty_error_for(:access_key)
  </code></pre>
  
  <p>Even better I would like to skip the messages variable altogether if possible.</p>
  
  <p>Should I use a Struct, a Module? What idiomatic data structure in ruby is ideal for this scenario?</p>