Sha256: 59968e2bb90dca4544f31766e820744efed203c04b7a7ee8d1353b3ca236f108

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

module Konstructor

  class Error < StandardError
  end

  # Raised if reserved names <code>new</code> or <code>initialize</code>
  # are used in declaration.
  class ReservedNameError < Error
    def initialize(name)
      super "Custom constructor can't have name '#{name}', "
            "it is reserved for default constructor."
    end
  end

  # Raised if declaring inherited method as constructor.
  class DeclaringInheritedError < Error
    def initialize(name)
      super "You are declaring an inherited method '#{name}' as konstructor, "
            "this is not allowed."
    end
  end

  # Raised if <code>konstructor</code> is used inside module.
  class IncludingInModuleError < Error
    def initialize(base)
      super "Konstructor can't be included in module '#{base.name}' directly, " +
            "please, use ActiveSupport::Concern or standard included hook."
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
konstructor-0.4.1 lib/konstructor/exceptions.rb