Class: Cute::TakTuk::StateStream Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Parses the output generated by the state template
Constant Summary collapse
- STATES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :error => { 3 => 'connection failed', 5 => 'connection lost', 7 => 'command failed', 9 => 'numbering update failed', 11 => 'pipe input failed', 14 => 'file reception failed', 16 => 'file send failed', 17 => 'invalid target', 18 => 'no target', 20 => 'invalid destination', 21 => 'destination not available anymore', }, :progress => { 0 => 'taktuk is ready', 1 => 'taktuk is numbered', 4 => 'connection initialized', 6 => 'command started', 10 => 'pipe input started', 13 => 'file reception started', }, :done => { 2 => 'taktuk terminated', 8 => 'command terminated', 12 => 'pipe input terminated', 15 => 'file reception terminated', 19 => 'message delivered', } }
Constants inherited from Stream
Cute::TakTuk::Stream::DOMAIN_REGEXP, Cute::TakTuk::Stream::HOSTNAME_REGEXP, Cute::TakTuk::Stream::IP_REGEXP, Cute::TakTuk::Stream::SEPARATOR, Cute::TakTuk::Stream::SEPESCAPED
Instance Attribute Summary
Attributes inherited from Stream
Class Method Summary collapse
-
.check?(type, state) ⇒ Boolean
private
type can be :error, :progress or :done.
- .errmsg(nb) ⇒ Object private
Instance Method Summary collapse
-
#initialize(template) ⇒ StateStream
constructor
private
A new instance of StateStream.
Methods inherited from Stream
Constructor Details
#initialize(template) ⇒ StateStream
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of StateStream.
231 232 233 |
# File 'lib/cute/taktuk.rb', line 231 def initialize(template) super(:state,template) end |
Class Method Details
.check?(type, state) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
type can be :error, :progress or :done
236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/cute/taktuk.rb', line 236 def self.check?(type,state) return nil unless STATES[type] state = state.strip begin nb = Integer(state) STATES[type].keys.include?(nb) rescue STATES[type].values.include?(state.downcase!) end end |
.errmsg(nb) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
248 249 250 251 252 |
# File 'lib/cute/taktuk.rb', line 248 def self.errmsg(nb) STATES.each_value do |typeval| return typeval[nb] if typeval[nb] end end |