-
-
Save anonymous/8fcdf6b388f5081b0da5 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
class Spoko < Array | |
attr_reader :nowy | |
def initialize | |
@nowy = 1 | |
super | |
end | |
end | |
aa = Spoko.new | |
aa << "Miód" << "Lód" << "Rak" << "Parasol" | |
bb = Spoko.new | |
bb.push("a").push("b") | |
puts "element bb nowy=#{bb.nowy}" | |
aa += bb | |
#p aa.map { |i| i.reverse } | |
aa.delete_at(2) | |
puts "element 1 = #{aa[1]} wielkość=#{aa.size} nowy=#{aa.nowy}" | |
aa.each do |a| | |
puts " #{a} [#{a.class.name}] " | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment