Exception: OsCtld::ResourceLocked

Inherits:
StandardError
  • Object
show all
Defined in:
lib/osctld/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, holder) ⇒ ResourceLocked

Returns a new instance of ResourceLocked.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/osctld/exceptions.rb', line 98

def initialize(resource, holder)
  @resource = resource
  @holder = holder

  resource_ident = ['resource', resource.class.name]
  holder_ident = holder.class.name

  if resource.respond_to?(:manipulation_resource)
    resource_ident = resource.manipulation_resource
  end

  if holder.respond_to?(:manipulation_holder)
    holder_ident = holder.manipulation_holder
  end

  super("#{resource_ident[0]} #{resource_ident[1]} is held by #{holder_ident}")
end

Instance Attribute Details

#holderObject (readonly)

Returns the value of attribute holder.



96
97
98
# File 'lib/osctld/exceptions.rb', line 96

def holder
  @holder
end

#resourceObject (readonly)

Returns the value of attribute resource.



96
97
98
# File 'lib/osctld/exceptions.rb', line 96

def resource
  @resource
end