Sha256: 3174ef7b7d81292e6a71aaa3a87520350d015f69410fff24eab3a3c502db5623
Contents?: true
Size: 518 Bytes
Versions: 32
Compression:
Stored size: 518 Bytes
Contents
module JsDuck # Takes output of JsLiteralParser and converts it to string class JsLiteralBuilder # Converts literal object definition to string def to_s(lit) if lit[:type] == :string '"' + lit[:value] + '"' elsif lit[:type] == :array "[" + lit[:value].map {|v| to_s(v) }.join(", ") + "]" elsif lit[:type] == :object "{" + lit[:value].map {|v| to_s(v[:key]) + ": " + to_s(v[:value]) }.join(", ") + "}" else lit[:value] end end end end
Version data entries
32 entries across 32 versions & 1 rubygems