module PleaseRun::Configurable

A mixin class that provides ‘attribute’ to a class. The main use for such attributes is to provide validation for mutators.

Example:

class Person
  include PleaseRun::Configurable

  attribute :greeting, "A simple greeting" do |greeting|
    # do any validation here.
    raise "Greeting must be a string!" unless greeting.is_a?(String)
  end
end

person = Person.new
person.greeting = 1234 # Fails!
person.greeting = "Hello, world!"

puts person.greeting
# "Hello, world!"