Sha256: 756aef7e74d61bd77faee6dcb2120a9ef4e4f0f52d498b3a40964031d9164021

Contents?: true

Size: 647 Bytes

Versions: 44

Compression:

Stored size: 647 Bytes

Contents

module Ruby2JS
  class Converter

    # (dstr
    #   (str 'a')
    #   (...))

    # (dsym
    #   (str 'a')
    #   (...))

    handle :dstr, :dsym do |*children|
      children.each_with_index do |child, index|
        put ' + ' unless index == 0

        if child.type == :begin and child.children.length == 1
          child = child.children.first
        end

        if child.type == :send
          op_index = operator_index child.children[1]
          if op_index >= operator_index(:+)
            group child
          else
            parse child
          end
        else
          parse child
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ruby2js-2.1.24 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.23 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.22 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.21 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.20 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.19 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.18 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.17 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.16 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.15 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.14 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.13 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.12 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.11 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.10 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.9 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.8 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.7 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.6 lib/ruby2js/converter/dstr.rb
ruby2js-2.1.5 lib/ruby2js/converter/dstr.rb