Sha256: 7d888cf128cdc8aa457c89e1fdf7c53dc47fe7fecdb33b814b7d5f26286edff6
Contents?: true
Size: 514 Bytes
Versions: 3
Compression:
Stored size: 514 Bytes
Contents
module Ruby2JS class Converter # (hash # (pair # (sym :name) # (str "value"))) handle :hash do |*pairs| pairs.map! do |node| left, right = node.children key = parse left key = $1 if key =~ /\A"([a-zA-Z_$][a-zA-Z_$0-9]*)"\Z/ "#{key}: #{parse right}" end if pairs.map {|item| item.length+2}.reduce(&:+).to_i < 70 "{#{ pairs.join(', ') }}" else "{#@nl#{ pairs.join(",#@ws") }#@nl}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby2js-1.1.4 | lib/ruby2js/converter/hash.rb |
ruby2js-1.1.3 | lib/ruby2js/converter/hash.rb |
ruby2js-1.1.2 | lib/ruby2js/converter/hash.rb |