Sha256: 70f3d8b79d324856d53e804840b5234ccf81e1e9d7ab1ced7ffcfab3fdeea174

Contents?: true

Size: 730 Bytes

Versions: 17

Compression:

Stored size: 730 Bytes

Contents

module Arel
  module JSONPredications
    
    def key(key)
      Arel::Attributes::Key.new(self, key)
    end
    alias :[]     :key
    alias :index  :key
    
    def has_key(key)
      Arel::Nodes::HasKey.new(self, key)
    end
    
    def has_keys(*keys)
      Arel::Nodes::HasKeys.new(self, keys)
    end
    
    def has_any_key(*keys)
      Arel::Nodes::HasAnyKey.new(self, keys)
    end
    
    def cast_as(type)
      Arel::Attributes::Cast.new(self, type)
    end
    
    def dig(*keys)
      keys = keys[0] if keys.size == 1 && keys.first.is_a?(Array)
      
      if keys.empty?
        self
      else
        keys.inject(self) { |node, key| Arel::Attributes::Key.new(node, key) }
      end
    end
    
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
arel-extensions-7.0.3 lib/arel/json_predications.rb
arel-extensions-7.0.2 lib/arel/json_predications.rb
arel-extensions-7.0.1 lib/arel/json_predications.rb
arel-extensions-7.0.0 lib/arel/json_predications.rb
arel-extensions-6.1.0 lib/arel/json_predications.rb
arel-extensions-6.1.0.rc2 lib/arel/json_predications.rb
arel-extensions-6.1.0.rc1 lib/arel/json_predications.rb
arel-extensions-6.0.0.9 lib/arel/json_predications.rb
arel-extensions-6.0.0.8 lib/arel/json_predications.rb
arel-extensions-6.0.0.6 lib/arel/json_predications.rb
arel-extensions-6.0.0.5 lib/arel/json_predications.rb
arel-extensions-6.0.0.4 lib/arel/json_predications.rb
arel-extensions-6.0.0.1 lib/arel/json_predications.rb
arel-extensions-6.0.0 lib/arel/json_predications.rb
arel-extensions-1.8.0 lib/arel/json_predications.rb
arel-extensions-1.7.0 lib/arel/json_predications.rb
arel-extensions-1.6.0 lib/arel/json_predications.rb