Exception: Exceptions::Base

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

Direct Known Subclasses

Model, Resource, Simple, UnauthorizedApplication

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Base

starts a new instance with an object

Parameters:

  • object (Object)


6
7
8
# File 'lib/exceptions/base.rb', line 6

def initialize object
	self.object = object
end

Instance Attribute Details

#objectObject

Returns the value of attribute object.



2
3
4
# File 'lib/exceptions/base.rb', line 2

def object
  @object
end

#typeObject

Returns the value of attribute type.



2
3
4
# File 'lib/exceptions/base.rb', line 2

def type
  @type
end

Class Method Details

.build(object) ⇒ Exceptions::Base

standard error for Models

Parameters:

  • object (ActiveRecord::Base)

Returns:



13
14
15
16
# File 'lib/exceptions/base.rb', line 13

def self.build object
	exception = new object
	return exception
end

Instance Method Details

#model?Boolean

return if is as model error

Returns:

  • (Boolean)


26
27
28
# File 'lib/exceptions/base.rb', line 26

def model?
	self.class.name.demodulize.tableize.singularize == "model"
end

#simple?Boolean

return if is as simple error

Returns:

  • (Boolean)


20
21
22
# File 'lib/exceptions/base.rb', line 20

def simple?
	self.class.name.demodulize.tableize.singularize == "simple"
end