Class: Pundit::ExpectedAttributeValues::UnexpectedValue

Inherits:
NotAuthorizedError
  • Object
show all
Defined in:
lib/pundit/expected_attribute_values/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, value:, expected:) ⇒ UnexpectedValue

Returns a new instance of UnexpectedValue.



8
9
10
11
12
13
14
15
16
# File 'lib/pundit/expected_attribute_values/errors.rb', line 8

def initialize(attribute:, value:, expected:)
  @attribute = attribute
  @value = value
  @expected = expected
  super(
    "Value #{value.inspect} is not expected for #{attribute}; " \
    "expected: #{expected.inspect}"
  )
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



6
7
8
# File 'lib/pundit/expected_attribute_values/errors.rb', line 6

def attribute
  @attribute
end

#expectedObject (readonly)

Returns the value of attribute expected.



6
7
8
# File 'lib/pundit/expected_attribute_values/errors.rb', line 6

def expected
  @expected
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/pundit/expected_attribute_values/errors.rb', line 6

def value
  @value
end