Class: Aio::Module::Cmd::Cisco::ShowClock
- Inherits:
-
Aio::Module::Cmd::Cisco
- Object
- Aio::Module::Cmd
- Aio::Module::Cmd::Cisco
- Aio::Module::Cmd::Cisco::ShowClock
- Includes:
- Aio::Module
- Defined in:
- lib/modules/cmd/cisco/show_clock.rb
Instance Attribute Summary
Attributes inherited from Aio::Module::Cmd
#cmd_info, #context, #device_info, #ext_info, #useful, #warning_klass
Instance Method Summary collapse
-
#initialize ⇒ ShowClock
constructor
A new instance of ShowClock.
- #parse ⇒ Object
Methods inherited from Aio::Module::Cmd
#author, #benchmark, #clear_useful, #cmd_full, #cmd_short, #description, #division, #key_stand, #license, #platform, #ranking, #set_defaults, #type
Methods included from Ui::Verbose
#clear_line, #print_error, #print_good, #progress_bar
Constructor Details
#initialize ⇒ ShowClock
Returns a new instance of ShowClock.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/modules/cmd/cisco/show_clock.rb', line 8 def initialize super({ :cmd_full => "show clock", :cmd_short => "sh clo", :author => "Elin", :description => "This is Cisco Command# show clock", :ranking => Ranking_1, :platform => "all", }) end |
Instance Method Details
#parse ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/modules/cmd/cisco/show_clock.rb', line 19 def parse context = self.context.dup clock = {} useful[:clock] = clock context.readline_match_block(/(?<time>.*)\.\d+ (?<zone>[^\s]+) (?<week>[^\s]+) (?<month>[^\s]+) (?<day>[^\s]+) (?<year>[^\s]+)/) do |block| block.update(clock, :time) block.update(clock, :zone) block.update(clock, :week) block.update(clock, :year) block.update(clock, :month, Aio::Base::Toolkit::Date.month_to_i(block[:month])) block.update(clock, :day) end end |