Exception: Policy::Follower::NameError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/policy/follower/name_error.rb

Overview

An exception to be risen when a policy name is not followed by a follower

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#followerClass (readonly)

The follower class that doesn’t follow given policy

Returns:

  • (Class)


27
28
29
# File 'lib/policy/follower/name_error.rb', line 27

def follower
  @follower
end

#nameString (readonly)

The name of the policy that is not followed by the follower

Returns:

  • (String)


33
34
35
# File 'lib/policy/follower/name_error.rb', line 33

def name
  @name
end

Class Method Details

.initialize(follower, name) ⇒ Policy::Follower::NameError

Constructs an exception for the follower class and the policy name

Parameters:

  • follower (Class)
  • name (#to_sym)

Returns:



18
19
20
21
# File 'lib/policy/follower/name_error.rb', line 18

def initialize(follower, name)
  @follower = follower
  @name = name.to_sym
end

Instance Method Details

#inspectString

The human-readable description for the exception

Returns:

  • (String)


45
46
47
# File 'lib/policy/follower/name_error.rb', line 45

def inspect
  "#<#{ self }: #{ message }>"
end

#messageString

The human-readable exception message

Returns:

  • (String)


38
39
40
# File 'lib/policy/follower/name_error.rb', line 38

def message
  "#{ follower.inspect } hasn't registered the policy \"#{ name }\""
end

#new(follower, name) ⇒ Policy::Follower::NameError

Constructs an exception for the follower class and the policy name

Parameters:

  • follower (Class)
  • name (#to_sym)

Returns:



18
19
20
21
# File 'lib/policy/follower/name_error.rb', line 18

def initialize(follower, name)
  @follower = follower
  @name = name.to_sym
end