Top Level Namespace
Defined Under Namespace
Modules: Crystalize
Classes: Anything
Instance Method Summary
collapse
Instance Method Details
#Array(arg) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/crystalize/ruby/ruby_core_extensions.rb', line 24
def Array(arg)
if arg == Anything
Array
else
arg.respond_to?(:to_a) ? arg.to_a : [arg]
end
end
|
#Hash(*args) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/crystalize/ruby/ruby_core_extensions.rb', line 3
def Hash(*args)
if args.all?{|arg| arg == Anything}
Hash
else
if args
if args.first == nil
Hash.new
elsif args.first == []
Hash.new
elsif args.first.instance_of?(Array) && args.first != []
raise TypeError
else
args.first
end
else
Hash.new
end
end
end
|