Class: FQuery
- Inherits:
-
Object
- Object
- FQuery
- Defined in:
- lib/firebase/fquery.rb
Instance Method Summary collapse
- #end_at(priority, child: child) ⇒ 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
Instance Method Details
#end_at(priority, child: child) ⇒ Object
68 69 70 |
# File 'lib/firebase/fquery.rb', line 68 def end_at(priority) queryEndingAtPriority(priority) end |
#off(handle = nil) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/firebase/fquery.rb', line 51 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
60 61 62 |
# File 'lib/firebase/fquery.rb', line 60 def start_at(priority) queryStartingAtPriority(priority) end |