Sha256: bb8bea1768a1ab65ba90fb4c4c99dc9c65a7d76bee89663e2b77e39b0f94633f

Contents?: true

Size: 560 Bytes

Versions: 26

Compression:

Stored size: 560 Bytes

Contents

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

26 entries across 26 versions & 1 rubygems

Version Path
ruby2js-2.1.24 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.23 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.22 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.21 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.20 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.19 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.18 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.17 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.16 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.15 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.14 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.13 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.12 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.11 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.10 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.9 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.8 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.7 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.6 lib/ruby2js/filter/angular-resource.rb
ruby2js-2.1.5 lib/ruby2js/filter/angular-resource.rb