class Ru::Iterator
Public Class Methods
new(array)
click to toggle source
# File lib/ru/iterator.rb, line 15 def initialize(array) @array = array end
redefined_methods()
click to toggle source
# File lib/ru/iterator.rb, line 4 def redefined_methods @redefined_methods ||= begin preserved_methods = %{initialize method_missing respond_to? to_a} [].public_methods.select do |method| method = method.to_s method =~ /^[a-z]/ && !preserved_methods.include?(method) end end end
Public Instance Methods
to_a()
click to toggle source
# File lib/ru/iterator.rb, line 19 def to_a Ru::Array.new(@array) end
to_stdout()
click to toggle source
# File lib/ru/iterator.rb, line 23 def to_stdout to_a.join("\n") end
Private Instance Methods
map_method(method, *args, &block)
click to toggle source
# File lib/ru/iterator.rb, line 33 def map_method(method, *args, &block) @array.map! { |item| item.send(method, *args, &block) } self end
method_missing(method, *args, &block)
click to toggle source
# File lib/ru/iterator.rb, line 29 def method_missing(method, *args, &block) map_method(method, *args, &block) end