Class: Vedeu::Groups
- Inherits:
-
Object
- Object
- Vedeu::Groups
- Defined in:
- lib/vedeu/support/groups.rb
Instance Method Summary collapse
- #add(group, name, delay = 0.0) ⇒ Groups|FalseClass
- #all ⇒ Set
- #find(name) ⇒ Set
- #in_memory ⇒ Hash private private
- #initialize ⇒ Groups constructor
-
#register_group_refresh_event(group, delay = 0.0) ⇒ Object
private
private
[].
- #reset ⇒ Hash
- #storage ⇒ Hash private private
Constructor Details
#initialize ⇒ Groups
5 |
# File 'lib/vedeu/support/groups.rb', line 5 def initialize; end |
Instance Method Details
#add(group, name, delay = 0.0) ⇒ Groups|FalseClass
24 25 26 27 28 29 30 31 32 |
# File 'lib/vedeu/support/groups.rb', line 24 def add(group, name, delay = 0.0) return false if group.empty? storage[group] << name register_group_refresh_event(group, delay) self end |
#all ⇒ Set
8 9 10 |
# File 'lib/vedeu/support/groups.rb', line 8 def all @_storage end |
#find(name) ⇒ Set
14 15 16 17 18 |
# File 'lib/vedeu/support/groups.rb', line 14 def find(name) storage.fetch(name) do fail GroupNotFound, 'Cannot find interface group with this name.' end end |
#in_memory ⇒ Hash (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 |
# File 'lib/vedeu/support/groups.rb', line 57 def in_memory Hash.new { |hash, key| hash[key] = Set.new } end |
#register_group_refresh_event(group, delay = 0.0) ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns [].
43 44 45 46 47 |
# File 'lib/vedeu/support/groups.rb', line 43 def register_group_refresh_event(group, delay = 0.0) Vedeu.event("_refresh_group_#{group}_".to_sym, { delay: delay }) do Buffers.refresh_group(group) end end |
#reset ⇒ Hash
35 36 37 |
# File 'lib/vedeu/support/groups.rb', line 35 def reset @_storage = in_memory end |
#storage ⇒ Hash (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'lib/vedeu/support/groups.rb', line 51 def storage @_storage ||= in_memory end |