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-1.14.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.14.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.13.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.13.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.12.2 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.12.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.12.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.11.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.11.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.10.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.9.3 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.9.2 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.9.1 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.9.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.8.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.7.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.6.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.5.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.4.0 lib/ruby2js/filter/angular-resource.rb
ruby2js-1.3.0 lib/ruby2js/filter/angular-resource.rb