Class: UState::Client::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/ustate/client/query.rb

Instance Method Summary collapse

Constructor Details

#initializeQuery

Little query builder



4
5
6
# File 'lib/ustate/client/query.rb', line 4

def initialize
  @predicate = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(field) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
# File 'lib/ustate/client/query.rb', line 8

def method_missing(field)
  field = field.to_sym
  beefcake_field = UState::Query.fields.find { |f|
    f.name == field
  }
  raise ArgumentError, "no such field #{field.inspect}" unless beefcake_field
  beefcake_field.type::Proxy
end