Skip to content

Commit

Permalink
[Truffle] Adding Kernel#Hash to kernel.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Apr 2, 2015
1 parent 4c2ccbd commit e3f06c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 0 additions & 13 deletions spec/truffle/tags/core/kernel/Hash_tags.txt

This file was deleted.

11 changes: 11 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/kernel.rb
Expand Up @@ -88,6 +88,17 @@ def FloatValue(obj)
end
private :FloatValue

def Hash(obj)
return {} if obj.nil? || obj == []

if hash = Rubinius::Type.check_convert_type(obj, Hash, :to_hash)
return hash
end

raise TypeError, "can't convert #{obj.class} into Hash"
end
module_function :Hash

def Integer(obj, base=nil)
if obj.kind_of? String
if obj.empty?
Expand Down

0 comments on commit e3f06c5

Please sign in to comment.