Sha256: b1b853f625db38eca8f63257363f746bd7fc6609904d172f9b656ba69b910bb5

Contents?: true

Size: 447 Bytes

Versions: 29

Compression:

Stored size: 447 Bytes

Contents

module Hobo
  module Model
    module Scopes
      module ApplyScopes

        def apply_scopes(scopes)
          result = scoped
          scopes.each_pair do |scope, arg|
            if arg.is_a?(Array)
              result = result.send(scope, *arg) unless arg.first.blank?
            else
              result = result.send(scope, arg) unless arg.blank?
            end
          end
          result
        end

      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hobo-2.0.1 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre10 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre9 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre8 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.3.3 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre7 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre6 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre5 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre4 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.3.2 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.3.1 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre3 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre2 lib/hobo/model/scopes/apply_scopes.rb
hobo-2.0.0.pre1 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.4.0.pre8 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.4.0.pre7 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.4.0.pre6 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.4.0.pre5 lib/hobo/model/scopes/apply_scopes.rb
hobo-1.4.0.pre4 lib/hobo/model/scopes/apply_scopes.rb