Exception: StatePattern::InvalidTransitionException

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/state_pattern/invalid_transition_exception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_module, to_module, event) ⇒ InvalidTransitionException

Returns a new instance of InvalidTransitionException.



4
5
6
7
8
# File 'lib/state_pattern/invalid_transition_exception.rb', line 4

def initialize(from_module, to_module, event)
  @from_module = from_module
  @to_module = to_module
  @event = event
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'lib/state_pattern/invalid_transition_exception.rb', line 3

def event
  @event
end

#from_moduleObject (readonly)

Returns the value of attribute from_module.



3
4
5
# File 'lib/state_pattern/invalid_transition_exception.rb', line 3

def from_module
  @from_module
end

#to_moduleObject (readonly)

Returns the value of attribute to_module.



3
4
5
# File 'lib/state_pattern/invalid_transition_exception.rb', line 3

def to_module
  @to_module
end

Instance Method Details

#messageObject



10
11
12
# File 'lib/state_pattern/invalid_transition_exception.rb', line 10

def message
  "Event #@event cannot transition from #@from_module to #@to_module"
end