Module: Misfit

Extended by:
ActiveSupport::Concern
Defined in:
lib/misfit.rb,
lib/misfit/version.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VERSION =
'0.0.4'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



13
14
15
# File 'lib/misfit.rb', line 13

def data
  @data
end

Class Method Details

.exception_classObject



9
10
11
# File 'lib/misfit.rb', line 9

def self.exception_class
  StandardError
end

Instance Method Details

#initialize(*args) ⇒ Object

this is here solely because of the way rspec instantiates exception objects in stubs



74
75
76
# File 'lib/misfit.rb', line 74

def initialize *args
  super
end

#inspectObject



66
67
68
69
70
71
# File 'lib/misfit.rb', line 66

def inspect
  representation = super
  representation.sub!(/:/, " (#{misfits.map(&:name).join(', ')}):")
  representation.sub!(/>$/, ", #{data.inspect}>") if data
  representation
end

#misfitsObject



78
79
80
# File 'lib/misfit.rb', line 78

def misfits
  singleton_class.included_modules.select {|m| m.respond_to?(:misfit?) && m.misfit? }
end