Sha256: 4fd919496780be9ccd22256587e85ccce12c6ef5a776f53c7cc35feed2865618
Contents?: true
Size: 526 Bytes
Versions: 1
Compression:
Stored size: 526 Bytes
Contents
module Ruby2JS class Converter # (case # (send nil :a) # (when # (int 1) # (...)) # (...)) handle :case do |expr, *whens, other| whens.map! do |node| *values, code = node.children cases = values.map {|value| "case #{ parse value }:#@ws"}.join "#{ cases }#{ parse code }#{@sep}break#@sep" end other = "#{@nl}default:#@ws#{ parse other }#@nl" if other "switch (#{ parse expr }) {#@nl#{whens.join(@nl)}#{other}}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby2js-1.1.0 | lib/ruby2js/converter/case.rb |