Sha256: a48ca3a8eb7aee1c736ef60ee7ab0fc70b3aacd21e3be2e28895dd7030a7270d

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

module Blaze

  class Configuration

    attr_accessor :account, :room_id, :token, :ssl

    def []=(option, value)
      send "#{option}=", value
    end

    def [](option)
      send option
    end

    def validate!
      %w(account room_id token).each do |option|
        if send(option).nil?
          fail MissingOption.new(option)
        end
      end
    end

    class MissingOption < RuntimeError

      def initialize(option)
        @option = option
      end

      def to_s
        "Please specify the #{@option} option"
      end

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blaze-0.0.1 lib/blaze/configuration.rb