Class: Debouncer::Group

Inherits:
Object
  • Object
show all
Includes:
Inspection
Defined in:
lib/debouncer/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspection

#inspect

Constructor Details

#initialize(debouncer, id) ⇒ Group

Returns a new instance of Group.



7
8
9
10
# File 'lib/debouncer/group.rb', line 7

def initialize(debouncer, id)
  @debouncer = debouncer
  @id        = id
end

Instance Attribute Details

#debouncerObject (readonly)

Returns the value of attribute debouncer.



5
6
7
# File 'lib/debouncer/group.rb', line 5

def debouncer
  @debouncer
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/debouncer/group.rb', line 5

def id
  @id
end

Instance Method Details

#call(*args, &block) ⇒ Object



12
13
14
15
# File 'lib/debouncer/group.rb', line 12

def call(*args, &block)
  @debouncer.call_with_id @id, *args, &block
  self
end

#flushObject



21
22
23
24
# File 'lib/debouncer/group.rb', line 21

def flush
  @debouncer.flush @id
  self
end

#flush!Object



26
27
28
29
# File 'lib/debouncer/group.rb', line 26

def flush!
  @debouncer.flush! @id
  self
end

#inspect_paramsObject



41
42
43
# File 'lib/debouncer/group.rb', line 41

def inspect_params
  {delay: @debouncer.delay, scheduled: @debouncer.runs_at(@id) || 'idle'}
end

#joinObject



31
32
33
34
# File 'lib/debouncer/group.rb', line 31

def join
  @debouncer.join @id
  self
end

#killObject



36
37
38
39
# File 'lib/debouncer/group.rb', line 36

def kill
  @debouncer.kill @id
  self
end

#to_procObject



17
18
19
# File 'lib/debouncer/group.rb', line 17

def to_proc
  method(:call).to_proc
end