Sha256: d96191379d72d32bf288914d03505ddc3b4354a07d4a69a24ac93a785d4a2d12

Contents?: true

Size: 585 Bytes

Versions: 45

Compression:

Stored size: 585 Bytes

Contents

require 'parser/current'
require 'ruby2js/filter/angularrb'

module Ruby2JS
  module Filter
    module AngularResource
      include SEXP

      # input: 
      #   $resource.new(args)
      #
      # output: 
      #   $resource(args)

      def on_send(node)
        return super unless @ngApp and node.children[1] == :new
        return super unless node.children[0] == s(:gvar, :$resource)
        node = super(node)
        @ngAppUses << :ngResource
        node.updated nil, [nil, :$resource, *node.children[2..-1]]
      end
    end

    DEFAULTS.push AngularResource
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
ruby2js-2.0.17 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.16 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.15 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.14 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.13 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.12 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.11 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.10 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.9 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.8 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.7 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.6 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.5 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.4 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.3 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.2 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.0.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.15.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.15.0 lib/ruby2js/filter/angular-resource.rb