Skip to content

Commit

Permalink
* lib/matrix.rb: Deprecate elements_to_{f/i/r}
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
marcandre committed Apr 11, 2010
1 parent e0cfb13 commit 3f64c83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Mon Apr 12 03:45:25 2010 Marc-Andre Lafortune <[email protected]>

* lib/matrix.rb: Deprecate elements_to_{f/i/r}

Mon Apr 12 03:30:29 2010 Marc-Andre Lafortune <[email protected]>

* lib/matrix.rb: Handle coercion errors by raising TypeErrors
Expand Down
9 changes: 6 additions & 3 deletions lib/matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1009,15 +1009,18 @@ def to_a
end

def elements_to_f
collect{|e| e.to_f}
warn "#{caller(1)[0]}: warning: Matrix#elements_to_f is deprecated"
map(&:to_f)
end

def elements_to_i
collect{|e| e.to_i}
warn "#{caller(1)[0]}: warning: Matrix#elements_to_i is deprecated"
map(&:to_i)
end

def elements_to_r
collect{|e| e.to_r}
warn "#{caller(1)[0]}: warning: Matrix#elements_to_r is deprecated"
map(&:to_r)
end

#--
Expand Down

0 comments on commit 3f64c83

Please sign in to comment.