Sha256: 031671656ce499e7ef2a5225502a22f71da8412583652230278a79fabb55b523

Contents?: true

Size: 273 Bytes

Versions: 2

Compression:

Stored size: 273 Bytes

Contents

# Example of using a dynamic type in a method definition
def foo(a:dynamic)
  puts "I got a #{a.getClass.getName} of size #{a.size}"
end

class SizeThing
  def initialize(size:int)
    @size = size
  end

  def size
    @size
  end
end

foo([1,2,3])
foo(SizeThing.new(12))

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mirah-0.0.4-java examples/dynamic.mirah
duby-0.0.3-java examples/dynamic.duby