Sha256: f01ba3594fdf0ec7a3787ce60658da2267c1880508b3e322e793482554f110a2

Contents?: true

Size: 706 Bytes

Versions: 17

Compression:

Stored size: 706 Bytes

Contents

require 'hashie'

module Raven

  INTERFACES = {}

  class Interface < Hashie::Dash
    def initialize(attributes={}, &block)
      @check_required = false
      super(attributes)
      block.call(self) if block
      @check_required = true
      assert_required_properties_set!
    end

    def assert_required_properties_set!
      super if @check_required
    end

    def self.name(value=nil)
      @interface_name = value if value
      @interface_name
    end
  end

  def self.register_interface(mapping)
    mapping.each_pair do |key, klass|
      INTERFACES[key.to_s] = klass
      INTERFACES[klass.name] = klass
    end
  end

  def self.find_interface(name)
    INTERFACES[name.to_s]
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sentry-raven-0.6.1 lib/raven/interfaces.rb
sentry-raven-0.7.1 lib/raven/interfaces.rb
sentry-raven-0.6.0 lib/raven/interfaces.rb
sentry-raven-0.5.0 lib/raven/interfaces.rb
sentry-raven-0.4.8 lib/raven/interfaces.rb
sentry-raven-0.4.7 lib/raven/interfaces.rb
sentry-raven-0.4.6 lib/raven/interfaces.rb
sentry-raven-0.4.5 lib/raven/interfaces.rb
sentry-raven-0.4.4 lib/raven/interfaces.rb
sentry-raven-0.4.3 lib/raven/interfaces.rb
sentry-raven-0.4.2 lib/raven/interfaces.rb
sentry-raven-0.4.1 lib/raven/interfaces.rb
sentry-raven-0.4.0 lib/raven/interfaces.rb
sentry-raven-0.3.1 lib/raven/interfaces.rb
sentry-raven-0.3 lib/raven/interfaces.rb
sentry-raven-0.2 lib/raven/interfaces.rb
sentry-raven-0.1 lib/raven/interfaces.rb