tatara

Add Type to Ruby!

This project is maintained by S-H-GAMELINKS

Tatara::FloatStringMap

About

Tatara::FloatStringMap is Map class like static type programming lang.

Tatara::FloatStringMap used by Float key, and String value. But, you can use Integer for key.

@f = Tatara::FloatStringMap.new
@f[0.5] = "42"
# => Key: 0.5, Value: "42"
@f[10] = "8"
# => Key: 10.0, Value: "8"

But, can not set Integer & Float for value.

@f = Tatara::FloatStringMap.new
@f[0.5] = 42
# => Error!

Methods

Tatara::FloatStringMap#new

Create new Tatara::FloatStringMap instance.

@f = Tatara::FloatStringMap.new

Tatara::FloatStringMap#[]

Access by key.

@f = Tatara::FloatStringMap.new
@f[0.5] = "42"
puts @i[0.5]
# => "42"

Tatara::FloatStringMap#[]=

Set value by key.

@f = Tatara::FloatStringMap.new
@f[0.5] = "42"
# => Set value is "42"

Tatara::FloatStringMap#insert

Set key & value.

@s = Tatara::FloatFloatMap.new
@s.insert(0.5, "42")
# => Set value is "42".