Class: Himari::RuleProcessor::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/himari/rule_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allowedObject

Returns the value of attribute allowed

Returns:

  • (Object)

    the current value of allowed



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def allowed
  @allowed
end

#decisionObject

Returns the value of attribute decision

Returns:

  • (Object)

    the current value of decision



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def decision
  @decision
end

#decision_logObject

Returns the value of attribute decision_log

Returns:

  • (Object)

    the current value of decision_log



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def decision_log
  @decision_log
end

#explicit_denyObject

Returns the value of attribute explicit_deny

Returns:

  • (Object)

    the current value of explicit_deny



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def explicit_deny
  @explicit_deny
end

#rule_nameObject

Returns the value of attribute rule_name

Returns:

  • (Object)

    the current value of rule_name



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def rule_name
  @rule_name
end

#suggestionObject

Returns the value of attribute suggestion

Returns:

  • (Object)

    the current value of suggestion



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def suggestion
  @suggestion
end

#user_facing_messageObject

Returns the value of attribute user_facing_message

Returns:

  • (Object)

    the current value of user_facing_message



5
6
7
# File 'lib/himari/rule_processor.rb', line 5

def user_facing_message
  @user_facing_message
end

Instance Method Details

#as_logObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/himari/rule_processor.rb', line 6

def as_log
  {
    rule_name: rule_name,
    allowed: allowed,
    explicit_deny: explicit_deny,
    decision: decision&.as_log,
    decision_log: decision_log.map(&:to_h),
  }.tap do |x|
    x[:suggestion] = suggestion if suggestion
  end
end