module Octo::Segmentation::ClassMethods
Extend
Public Instance Methods
all_segment_choices()
click to toggle source
Returns all possible segment choices. Segment
choices are the first
data point that is picked on top of which segment would be made. It could be one of the supported octo events (eg: app.init etc) or users
# File lib/octocore-mongo/segment.rb, line 253 def all_segment_choices valid_events << :users end
is_valid_segment(segment)
click to toggle source
Returns a boolean specifying if the segment is a valid choice or not @param [String] segment The string to be evaluated @return [Boolean] If the provided string exists in valid choices
# File lib/octocore-mongo/segment.rb, line 246 def is_valid_segment segment all_segment_choices.include?segment end
Private Instance Methods
merge_choices(c, opts={})
click to toggle source
Merges choices and returns the set with opts taken care of @param [Array] c The initial choices @param [Hash] opts Optional hash specifying anything to be exluded or
included
@option opts [Array<String>] :include Strings to be included in choices @option opts [Array<String>] :exclude Strings to be excluded in choices @return [Array<String>] Merged choices
# File lib/octocore-mongo/segment.rb, line 274 def merge_choices(c, opts={}) Set.new(c).merge( Set.new(opts.fetch(:include, [])) ).subtract( Set.new(opts.fetch(:exclude, [])) ) end
valid_events()
click to toggle source
Get all the valid events @return [Set<Symbol>] Valid events globally
# File lib/octocore-mongo/segment.rb, line 261 def valid_events Set.new(Octo.get_config(:allowed_events)) end