Skip to content

Instantly share code, notes, and snippets.

@CalmBit
Last active December 17, 2015 08:19
Show Gist options
  • Save CalmBit/5579598 to your computer and use it in GitHub Desktop.
Save CalmBit/5579598 to your computer and use it in GitHub Desktop.
Array Replacement
class Klass
def initialize(str)
@str = str
end
def str
@str
end
end
def setA()
arraybig = [["a","b","c"],["d","e","f"]]
arraybig.each do |x|
x.length.times do |y|
@temp = x[y]
x[y] = Klass.new(@temp)
end
end
print arraybig
end
setA()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment