Skip to content

Instantly share code, notes, and snippets.

@baccigalupi
Created September 10, 2009 17:14
Show Gist options
  • Save baccigalupi/184661 to your computer and use it in GitHub Desktop.
Save baccigalupi/184661 to your computer and use it in GitHub Desktop.
# Possible AQUA query syntax ...
# INSTANCE VARIABLES
# checks to see if a value exists, works for hashes and for arrays
@instance.has_value( value ) # value is a value or array of values
#checks to see if a value exists at a certain location
@instance.has_value( value, :at => 0 ) # if integer, assumed to be an integer
@instance.has_value( value, :at => :first ) # could be either an array or a hash key
@instance.has_value( value, :at => :some_key ) # a hash key
# INTRINSIC VALUES
has_value(value, :at => ...) # same as above for array and hash like objects
# COMPARITIVE OPERATORS
=, ~=, >, >=, <, <=
# JOINING CONDITIONS
via and, && ... the usual bitwise
# POSSIBLE USES
# a descendant of an array or hash
Klass.retrieve( fields ) where
has_value( string ) = 'something'
end
# a descendant of array
Klass.retrieve( fields ) where
has_value( string, :at => 0 ) = 'something'
end
# a descendant of hash
Klass.retrieve( fields ) where
has_value( string, :at => :my_key ) ~= /\Asome/i
end
# instance variables
Klass.retrieve( fields ) where
@obj = my_object # aquatic or non-aquatic
end
Klass.retrieve( fields ) where
@obj <= Time.now and @published = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment