Created
September 25, 2022 12:45
-
-
Save okabe-yuya/d2c83981b4d0a18e2c5ffede93c5a106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringArray | |
attr_reader :s_array | |
def initialize | |
@s_array = '' | |
end | |
def push(v) | |
@s_array += "#{v}SPLIT" | |
self | |
end | |
def each(&block) | |
block.call | |
end | |
end | |
data = [ [], StringArray.new ].each { |d| 5.times { |n| d.push(n+1) } } | |
p data | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment