class Mobi::Mtld::Da::Device::PostWalkRules

Copyright
Author

Constants

KEY_MATCHER_PROP_IDS_IN_USE
KEY_OPERATOR
KEY_PROPERTY_MATCHER

Constants to make keys more readable

KEY_PROPERTY_VALUE
KEY_RULE_ARR
KEY_RULE_GROUPS
KEY_RULE_PROP_IDS_IN_USE
KEY_RULE_SET
KEY_RULE_SET_COUNT

Attributes

branch[RW]
tree_provider[RW]

Public Class Methods

new(tree_provider, type) click to toggle source
# File ../../device_api/trunk/ruby/src/lib/post_walk_rules.rb, line 38
    def initialize tree_provider, type

            # Initialize two of the public instance variables
            @tree_provider = tree_provider
            @branch = tree_provider.tree[type] # main branch
            
            # Initialize the private instance variables
            @prop_matcher_ids_in_use = []
            @rule_prop_ids_in_use = []

            # loop over all rule groups
            rg = @branch[KEY_RULE_GROUPS]
max_rg = rg.size - 1

for i in 0..max_rg

  group = rg[i]

                    # We want to keep a list of all the properties that are used because when
                    # a user calls DeviceApi.properties we need to fetch additional properties
  # other than the property they want to optimize the User-Agent string
  # rules.
                    init_get_matcher_propery_ids group, @prop_matcher_ids_in_use

                    sets = init_rule_sets group

                    # Also keep a list of all the property IDs that can be output
                    @rule_prop_ids_in_use = init_get_rule_property_ids(sets,
    @rule_prop_ids_in_use)

            end

    end

Protected Instance Methods

init_get_matcher_propery_ids(group, prop_ids) click to toggle source

Find all the properties that are used for matching. This is needed in case the Mobi::Mtld::Da::Device::DeviceApi#properties function is called as we need these properties for the rules to work correctly.

group

The rule group that can contain a property matcher.

prop_ids

The list of found property IDs.

return

An updated set of property IDs.

# File ../../device_api/trunk/ruby/src/lib/post_walk_rules.rb, line 81
  def init_get_matcher_propery_ids group, prop_ids
          raise PostWalkRulesException,
"This is an abstract method that has not been implemented."
  end
init_rule_sets(group) click to toggle source

Prepare the rule set

group

The current parent group.

return

A list of all rule sets.

# File ../../device_api/trunk/ruby/src/lib/post_walk_rules.rb, line 89
  def init_rule_sets(group)
          raise PostWalkRulesException,
"This is an abstract method that has not been implemented."
  end