Module: Expect4r::Router::Common::Modes

Included in:
Ios, Iox, J, V
Defined in:
lib/router/modes.rb

Instance Method Summary collapse

Instance Method Details

#_mode_?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/router/modes.rb', line 39

def _mode_?
  putline ' ', :no_trim=>true, :no_echo=>true unless @lp
  if exec? 
    :exec
  elsif config?
    :config
  elsif shell?
    :shell
  else
  end
end

#change_mode_to(mode) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/router/modes.rb', line 31

def change_mode_to(mode)
   unless connected?
  case mode
  when :exec    ;  to_exec
  when :config  ;  to_config
  when :shell   ;  to_shell
  end
end

#in?(mode = :none) ⇒ Boolean

Adds a in? mixin.

Examples:

>> iox.in?
=> *:exec*
>> iox.config
=> *:config*
>> iox.in?
=> *:config*
>> iox.shell
=> *:shell*
>> iox.in?
=> *:shell*

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
# File 'lib/router/modes.rb', line 21

def in?(mode=:none)
   unless connected?
  case mode
  when :exec    ; exec?
  when :config  ; config?
  when :shell   ; shell?
  else
    _mode_?
  end
end