Sha256: 4c389f749a809f5cbe51f0024e738416280a350751097dfb855af6bfb146aedd
Contents?: true
Size: 974 Bytes
Versions: 37
Compression:
Stored size: 974 Bytes
Contents
module Ruby2JS class Converter # (defs (self) :foo # (args) # (...) # NOTE: defp is only produced by filters handle :defs, :defp do |target, method, args, body| parse transform_defs(target, method, args, body) end def transform_defs(target, method, args, body) if not @ast.is_method? or @ast.type == :defp node = s(:prop, target, method.to_s => {enumerable: s(:true), configurable: s(:true), get: s(:block, s(:send, nil, :proc), args, s(:autoreturn, body))}) elsif method =~ /=$/ node = s(:prop, target, method.to_s.sub('=', '') => {enumerable: s(:true), configurable: s(:true), set: s(:block, s(:send, nil, :proc), args, body)}) else node = s(:send, target, "#{method}=", s(:block, s(:send, nil, :proc), args, body)) end @comments[node] = @comments[@ast] if @comments[@ast] node end end end
Version data entries
37 entries across 37 versions & 1 rubygems