Class: Blackbeard::Group
Instance Attribute Summary
Attributes inherited from Storable
#id, #new_record
Instance Method Summary
collapse
Methods inherited from Storable
#==, all, all_keys, count, create, find, find_or_create, #initialize, #key, key_for, #master_key, master_key, new_from_key, new_from_keys, #new_record?, on_reload, on_reload_methods, on_save, on_save_methods, #reload, #save, set_master_key
included
included
included
#config, #db, #guest_method, included, #tz
Instance Method Details
#definition ⇒ Object
30
31
32
|
# File 'lib/blackbeard/group.rb', line 30
def definition
config.group_definitions[self.id.to_sym]
end
|
#metric_data(metric) ⇒ Object
#name ⇒ Object
9
10
11
|
# File 'lib/blackbeard/group.rb', line 9
def name
storable_attributes_hash['name'] || id
end
|
#segment_for(context) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/blackbeard/group.rb', line 13
def segment_for(context)
return nil unless definition
segment = definition.call(context.user, context.controller)
segment_id = case segment
when false
nil
when nil
nil
when true
self.id
else
segment.to_s
end
add_segment(segment_id) unless segment_id.nil?
segment_id
end
|