class CanCanExplainer::Explanation

Public Class Methods

new() click to toggle source
# File lib/cancan_explainer/explanation.rb, line 3
def initialize
  @conditions_matched = []
end

Public Instance Methods

add_condition_match(source_location, action, subject, extra_args) click to toggle source
# File lib/cancan_explainer/explanation.rb, line 7
def add_condition_match(source_location, action, subject, extra_args)
  @conditions_matched.push(
    {
      source_location: source_location,
      action: action,
      subject: subject,
      extra_args: extra_args
    }
  )
end
to_s() click to toggle source
# File lib/cancan_explainer/explanation.rb, line 18
def to_s
  @conditions_matched.map { |e|
    format(
      "%s %s %s %s",
      e[:action],
      e[:subject],
      e[:extra_args],
      e[:source_location]
    )
  }.join("\n")
end