Class: Entitlements::Data::Groups::Calculated::Text

Inherits:
Base
  • Object
show all
Includes:
Contracts::Core
Defined in:
lib/entitlements.rb,
lib/entitlements/data/groups/calculated/text.rb

Constant Summary collapse

C =
::Contracts
SEMICOLON_PREDICATES =
%w[expiration]

Constants inherited from Base

Base::ALIAS_METHODS, Base::MAX_MODIFIER_ITERATIONS, Base::MODIFIERS

Instance Attribute Summary

Attributes inherited from Base

#filename, #filters, #metadata

Instance Method Summary collapse

Methods inherited from Base

#fatal_message, #filtered_members, #initialize, #modified_filtered_members, #modified_members

Constructor Details

This class inherits a constructor from Entitlements::Data::Groups::Calculated::Base

Instance Method Details

#descriptionObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/entitlements/data/groups/calculated/text.rb', line 36

def description
  return "" unless parsed_data.key?("description")

  if parsed_data["description"]["!="].any?
    fatal_message("The description cannot use '!=' operator in #{filename}!")
  end

  unless parsed_data["description"]["="].size == 1
    fatal_message("The description key is duplicated in #{filename}!")
  end

  parsed_data["description"]["="].first.fetch(:key)
end

#membersObject



23
24
25
26
27
28
# File 'lib/entitlements/data/groups/calculated/text.rb', line 23

def members
  @members ||= begin
    Entitlements.logger.debug "Calculating members from #{filename}"
    members_from_rules(rules)
  end
end

#modifiersObject



57
58
59
# File 'lib/entitlements/data/groups/calculated/text.rb', line 57

def modifiers
  parse_with_prefix("modifier_")
end