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 included from Contracts::Core

common, extended, included

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

#description ⇒ Object



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

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

#members ⇒ Object



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

def members
  return @members if @members

  Entitlements.logger.debug "Calculating members from #{filename}"
  result = members_from_rules(rules)
  @members = result unless result == :calculating
  result
end

#modifiers ⇒ Object



59
60
61
# File 'lib/entitlements/data/groups/calculated/text.rb', line 59

def modifiers
  parse_with_prefix("modifier_")
end