Sha256: 012d6f5de9b687c930a6640b5a4b4a68d915867b31b0ed23f3fdfe625f28c856

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

module RipperRubyParser
  module SexpHandlers
    module Hashes
      def process_hash exp
        _, elems = exp.shift 2
        s(:hash, *process(elems))
      end

      def process_assoclist_from_args exp
        _, elems = exp.shift 2
        make_hash_items elems
      end

      def process_assoc_new exp
        _, left, right = exp.shift 3
        s(process(left), process(right))
      end

      def process_bare_assoc_hash exp
        _, elems = exp.shift 2
        s(:hash, *make_hash_items(elems))
      end

      private

      def make_hash_items elems
        result = s()
        elems.each do |sub_exp|
          process(sub_exp).each do |elm|
            result << elm
          end
        end
        result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ripper_ruby_parser-1.1.1 lib/ripper_ruby_parser/sexp_handlers/hashes.rb
ripper_ruby_parser-1.1.0 lib/ripper_ruby_parser/sexp_handlers/hashes.rb