Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.2
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Java Integration
    • Labels:
      None
    • Number of attachments :
      0

      Description

      It would be useful if the object referenced by $CLASSPATH would accept arrays (or array-iod objects) via the "<<" operator. A typical use case would be:

      $CLASSPATH << Dir.glob('some/directory/*.jar')

        Activity

        Hide
        Steve Byrne added a comment -

        Something like this might work:

        @JRubyMethod(name =

        {"append", "<<"}

        , required = 1)
        public IRubyObject append(IRubyObject obj) {
        if (obj instanceof RubyArray) {
        for (Object elt : (RubyArray)obj)

        { append(IRubyObject(elt)); }

        return this;
        }
        String ss = obj.convertToString().toString();
        try {

        Show
        Steve Byrne added a comment - Something like this might work: @JRubyMethod(name = {"append", "<<"} , required = 1) public IRubyObject append(IRubyObject obj) { if (obj instanceof RubyArray) { for (Object elt : (RubyArray)obj) { append(IRubyObject(elt)); } return this; } String ss = obj.convertToString().toString(); try {
        Hide
        Hiro Asari added a comment -

        Fixed on master (ad456b0). We allow not just arrays, but any object which responds to #to_a.

        Show
        Hiro Asari added a comment - Fixed on master (ad456b0). We allow not just arrays, but any object which responds to #to_a .

          People

          • Assignee:
            Hiro Asari
            Reporter:
            Steve Byrne
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: