Class: Ru::Iterator
- Inherits:
-
Object
show all
- Defined in:
- lib/ru/iterator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(array) ⇒ Iterator
15
16
17
|
# File 'lib/ru/iterator.rb', line 15
def initialize(array)
@array = array
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
29
30
31
|
# File 'lib/ru/iterator.rb', line 29
def method_missing(method, *args, &block)
map_method(method, *args, &block)
end
|
Class Method Details
.redefined_methods ⇒ Object
4
5
6
7
8
9
10
11
12
|
# 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
|
Instance Method Details
#to_a ⇒ Object
19
20
21
|
# File 'lib/ru/iterator.rb', line 19
def to_a
Ru::Array.new(@array)
end
|
#to_dotsch_output ⇒ Object
23
24
25
|
# File 'lib/ru/iterator.rb', line 23
def to_dotsch_output
to_a.join("\n")
end
|