Sha256: 3fd150aa0e1abe25886f1402a1892d5a1076a9e2f64f3fbb8418d8b99c6edaa4

Contents?: true

Size: 944 Bytes

Versions: 9

Compression:

Stored size: 944 Bytes

Contents

module Konstructor

  # Base class for all Konstructor errors.
  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

9 entries across 9 versions & 1 rubygems

Version Path
konstructor-1.0.2 lib/konstructor/exceptions.rb
konstructor-1.0.1 lib/konstructor/exceptions.rb
konstructor-1.0.0 lib/konstructor/exceptions.rb
konstructor-0.4.7 lib/konstructor/exceptions.rb
konstructor-0.4.6 lib/konstructor/exceptions.rb
konstructor-0.4.5 lib/konstructor/exceptions.rb
konstructor-0.4.4 lib/konstructor/exceptions.rb
konstructor-0.4.3 lib/konstructor/exceptions.rb
konstructor-0.4.2 lib/konstructor/exceptions.rb