Class: Polar::Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/polar/groups.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance_object = false) ⇒ Groups

Returns a new instance of Groups.



22
23
24
25
26
27
28
29
30
31
# File 'lib/polar/groups.rb', line 22

def initialize(instance_object = false)
  @defined_groups_store ||= []
  @subject_store ||= []
  unless instance_object
    @defined_groups_store = self.class.instance.defined_groups_store.clone
    @subject_store = self.class.instance.subject_store.clone
  end

  self
end

Instance Attribute Details

#defined_groups_storeObject

Returns the value of attribute defined_groups_store.



19
20
21
# File 'lib/polar/groups.rb', line 19

def defined_groups_store
  @defined_groups_store
end

#subject_storeObject

Returns the value of attribute subject_store.



20
21
22
# File 'lib/polar/groups.rb', line 20

def subject_store
  @subject_store
end

Class Method Details

.define(&block) ⇒ Object



37
38
39
# File 'lib/polar/groups.rb', line 37

def self.define(&block)
  self
end

.defined_storeObject



45
46
47
# File 'lib/polar/groups.rb', line 45

def self.defined_store
  @defined_groups_store ||= {}
end

.instanceObject



33
34
35
# File 'lib/polar/groups.rb', line 33

def self.instance
  @__instance__ ||= new(true)
end

.method_missing(method) {|GroupHash.new(method)| ... } ⇒ Object

Yields:



41
42
43
# File 'lib/polar/groups.rb', line 41

def self.method_missing(method, &block)
  yield GroupHash.new(method) if block_given?
end

Instance Method Details

#fill_subject_from_external_store(subject_id, storage) ⇒ Object



49
50
51
52
53
# File 'lib/polar/groups.rb', line 49

def fill_subject_from_external_store(subject_id, storage)
  storage.get_for_subject(subject_id).each do |group|
    self.subject_store << group.group_name.to_sym
  end
end