I have an array s
of Tile
s with an instance variable @type
:
class Tile
Types = ["l", "w", "r"]
def initialize(type)
@type = type
end
end
s = []
20.times { s << Tile.new(Tile::Types.sample)}
How do I get each Tile
's @type
? How do I return only the objects with a particular @type
?