Skip to content

Commit

Permalink
Avoid rededinition warnings [#61]
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Aug 13, 2012
1 parent 422aeee commit 6d4aa32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 6
:patch: 2
:patch: 3
:build:
4 changes: 2 additions & 2 deletions backports.gemspec
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = "backports"
s.version = "2.6.2"
s.version = "2.6.3"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marc-Andr\u{e9} Lafortune"]
s.date = "2012-07-20"
s.date = "2012-08-13"
s.description = " Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.\n"
s.email = "github@marc-andre.ca"
s.extra_rdoc_files = [
Expand Down
12 changes: 5 additions & 7 deletions lib/backports/1.9.2/stdlib/matrix.rb
Expand Up @@ -18,10 +18,8 @@ module ExceptionForMatrix # :nodoc:
def_e2message(TypeError, "wrong argument type %s (expected %s)")
def_e2message(ArgumentError, "Wrong # of arguments(%d for %d)")

def_exception("ErrDimensionMismatch", "\#{self.name} dimension mismatch")
def_exception("ErrNotRegular", "Not Regular Matrix")
def_exception("ErrOperationNotDefined", "Operation(%s) can\\'t be defined: %s op %s")
def_exception("ErrOperationNotImplemented", "Sorry, Operation(%s) not implemented: %s op %s")
def_exception("ErrOperationNotDefined", "Operation(%s) can\\'t be defined: %s op %s") unless const_defined?(:ErrOperationNotDefined, false)
def_exception("ErrOperationNotImplemented", "Sorry, Operation(%s) not implemented: %s op %s") unless const_defined?(:ErrOperationNotImplemented, false)
end

#
Expand Down Expand Up @@ -513,7 +511,7 @@ def each_with_index(which = :all) # :yield: e, row, column
self
end

SELECTORS = {:all => true, :diagonal => true, :off_diagonal => true, :lower => true, :strict_lower => true, :strict_upper => true, :upper => true}.freeze
SELECTORS = {:all => true, :diagonal => true, :off_diagonal => true, :lower => true, :strict_lower => true, :strict_upper => true, :upper => true}.freeze unless const_defined?(:SELECTORS)
#
# :call-seq:
# index(value, selector = :all) -> [row, column]
Expand Down Expand Up @@ -610,12 +608,12 @@ def empty?
column_size == 0 || row_size == 0
end


#
# Returns +true+ is this is an hermitian matrix.
# Raises an error if matrix is not square.
#

def hermitian?
Matrix.Raise ErrDimensionMismatch unless square?
each_with_index(:strict_upper).all? do |e, row, col|
Expand Down

0 comments on commit 6d4aa32

Please sign in to comment.