Class: FQuery
- Inherits:
-
Object
- Object
- FQuery
- Defined in:
- lib/firebase/fquery.rb
Class Method Summary collapse
Instance Method Summary collapse
- #end_at(priority, child: child) ⇒ Object
- #equal_to(priority, child: child) ⇒ Object
- #limit(limit) ⇒ Object
- #off(handle = nil) ⇒ Object
- #on(event_type, options = {}, &and_then) ⇒ Object
- #once(event_type, options = {}, &and_then) ⇒ Object
- #start_at(priority, child: child) ⇒ Object
Class Method Details
Instance Method Details
#end_at(priority, child: child) ⇒ Object
79 80 81 |
# File 'lib/firebase/fquery.rb', line 79 def end_at(priority) queryEndingAtPriority(priority) end |
#equal_to(priority, child: child) ⇒ Object
71 72 73 |
# File 'lib/firebase/fquery.rb', line 71 def equal_to(priority) queryEqualToPriority(priority) end |
#limit(limit) ⇒ Object
87 88 89 |
# File 'lib/firebase/fquery.rb', line 87 def limit(limit) queryLimitedToNumberOfChildren(limit) end |
#off(handle = nil) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/firebase/fquery.rb', line 54 def off(handle=nil) if handle removeObserverWithHandle(handle) else removeAllObservers end return self end |
#on(event_type, options = {}, &and_then) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/firebase/fquery.rb', line 3 def on(event_type, ={}, &and_then) and_then = and_then || [:completion] raise "event handler is required" unless and_then raise "event handler must accept one or two arguments" unless and_then.arity == 1 || and_then.arity == 2 event_type = Firebase.convert_event_type(event_type) disconnect_block = [:disconnect] raise ":disconnect handler must not accept any arguments" if disconnect_block && disconnect_block.arity > 0 if and_then.arity == 1 if disconnect_block return observeEventType(event_type, withBlock:and_then, withCancelBlock:disconnect_block) else return observeEventType(event_type, withBlock:and_then) end else if disconnect_block return observeEventType(event_type, andPreviousSiblingNameWithBlock:and_then, withCancelBlock:disconnect_block) else return observeEventType(event_type, andPreviousSiblingNameWithBlock:and_then) end end end |
#once(event_type, options = {}, &and_then) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/firebase/fquery.rb', line 27 def once(event_type, ={}, &and_then) and_then = and_then || [:completion] raise "event handler is required" unless and_then raise "event handler must accept one or two arguments" unless and_then.arity == 1 || and_then.arity == 2 event_type = Firebase.convert_event_type(event_type) disconnect_block = [:disconnect] raise ":disconnect handler must not accept any arguments" if disconnect_block && disconnect_block.arity > 0 if and_then.arity == 1 if disconnect_block return observeSingleEventOfType(event_type, withBlock:and_then, withCancelBlock:disconnect_block) else return observeSingleEventOfType(event_type, withBlock:and_then) end else if disconnect_block return observeSingleEventOfType(event_type, andPreviousSiblingNameWithBlock:and_then, withCancelBlock:disconnect_block) else return observeSingleEventOfType(event_type, andPreviousSiblingNameWithBlock:and_then) end end end |
#start_at(priority, child: child) ⇒ Object
63 64 65 |
# File 'lib/firebase/fquery.rb', line 63 def start_at(priority) queryStartingAtPriority(priority) end |