File: list.rb

package info (click to toggle)
ruby-rjb 1.5.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 704 kB
  • sloc: ansic: 3,859; ruby: 2,604; java: 247; makefile: 35; sh: 3
file content (37 lines) | stat: -rw-r--r-- 644 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# encoding: utf-8
=begin
  Copyright(c) 2012 arton
=end

require 'rjb'

module Rjb
  JIterable = import('java.lang.Iterable')
  JIterator = import('java.util.Iterator')
  module Iterable
    def each
      it = iterator
      while it.has_next
        yield it.next
      end
    end
  end
  module Iterator
    def each
      while has_next
        yield self.next
      end
    end
  end
  class Rjb_JavaProxy
    def initialize_proxy
      if JIterable.isInstance(self)
        include Iterable
        include Enumerable
      elsif JIterator.isInstance(self)
        include Iterator
        include Enumerable
      end
    end
  end
end