Exception: Golem::ImpossibleEvent
- Inherits:
-
StandardError
- Object
- StandardError
- Golem::ImpossibleEvent
- Defined in:
- lib/golem.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
Instance Method Summary collapse
- #human_explanation ⇒ Object
- #human_reasons ⇒ Object
-
#initialize(message, event = nil, object = nil, reasons = nil) ⇒ ImpossibleEvent
constructor
A new instance of ImpossibleEvent.
Constructor Details
#initialize(message, event = nil, object = nil, reasons = nil) ⇒ ImpossibleEvent
Returns a new instance of ImpossibleEvent.
221 222 223 224 225 226 |
# File 'lib/golem.rb', line 221 def initialize(, event = nil, object = nil, reasons = nil) @event = event @object = object @reasons = reasons super() end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
220 221 222 |
# File 'lib/golem.rb', line 220 def event @event end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
220 221 222 |
# File 'lib/golem.rb', line 220 def object @object end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
220 221 222 |
# File 'lib/golem.rb', line 220 def reasons @reasons end |
Instance Method Details
#human_explanation ⇒ Object
228 229 230 231 232 |
# File 'lib/golem.rb', line 228 def human_explanation event = [@event] unless @event.is_a?(Array) object = [@object] unless @object.is_a?(Array) "'#{event.collect{|ev|ev.name.to_s.humanize.upcase}.join("/")}' for #{object.collect{|ob|ob.to_s}.join("/")} failed" end |
#human_reasons ⇒ Object
234 235 236 237 |
# File 'lib/golem.rb', line 234 def human_reasons reasons = [@reasons] unless @reasons.is_a?(Array) reasons end |