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.
182 183 184 185 186 187 |
# File 'lib/golem.rb', line 182 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.
181 182 183 |
# File 'lib/golem.rb', line 181 def event @event end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
181 182 183 |
# File 'lib/golem.rb', line 181 def object @object end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
181 182 183 |
# File 'lib/golem.rb', line 181 def reasons @reasons end |
Instance Method Details
#human_explanation ⇒ Object
189 190 191 192 193 |
# File 'lib/golem.rb', line 189 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
195 196 197 198 |
# File 'lib/golem.rb', line 195 def human_reasons reasons = [@reasons] unless @reasons.is_a?(Array) reasons end |