lib/ably/modules/state_emitter.rb in ably-0.8.1 vs lib/ably/modules/state_emitter.rb in ably-0.8.2

- old
+ new

@@ -24,11 +24,11 @@ # connection.state = :connecting # emits :connecting event via EventEmitter, returns STATE.Connecting # connection.state?(:connected) # => false # connection.connecting? # => true # connection.state # => STATE.Connecting # connection.state = :invalid # raises an Exception as only a valid state can be defined - # connection.trigger :invalid # raises an Exception as only a valid state can be used for EventEmitter + # connection.emit :invalid # raises an Exception as only a valid state can be used for EventEmitter # connection.change_state :connected # emits :connected event via EventEmitter, returns STATE.Connected # connection.once_or_if(:connected) { puts 'block called once when state is connected or becomes connected' } # module StateEmitter # Current state {Ably::Modules::Enum} @@ -51,10 +51,10 @@ # @api private def state=(new_state, *args) if state != new_state logger.debug("#{self.class}: StateEmitter changed from #{state} => #{new_state}") if respond_to?(:logger, true) @state = STATE(new_state) - trigger @state, *args + emit @state, *args end end alias_method :change_state, :state= # If the current state matches the target_state argument the block is called immediately.