Class: HMap::Command::Reader
- Inherits:
-
HMap::Command
- Object
- CLAide::Command
- HMap::Command
- HMap::Command::Reader
- Defined in:
- lib/hmap/command/hmap_reader.rb
Overview
hmap file reader cmd
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Reader
constructor
A new instance of Reader.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Reader
Returns a new instance of Reader.
20 21 22 23 24 |
# File 'lib/hmap/command/hmap_reader.rb', line 20 def initialize(argv) super mapfile_path = argv.option('hmap-path') @mapfile_path = Pathname.new(mapfile_path). unless mapfile_path.nil? end |
Class Method Details
.options ⇒ Object
32 33 34 35 36 |
# File 'lib/hmap/command/hmap_reader.rb', line 32 def self. [ ['--hmap-path=/hmap/dir/file', 'The path of the hmap file'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 |
# File 'lib/hmap/command/hmap_reader.rb', line 38 def run puts "\n[hmap-reader] start..............\n".yellow HMap::MapFileReader.new(@mapfile_path) puts "\n[hmap-reader] finish..............\n".yellow end |
#validate! ⇒ Object
26 27 28 29 30 |
# File 'lib/hmap/command/hmap_reader.rb', line 26 def validate! super # banner! if help? raise '[ERROR]: --hmap-path no set'.red unless File.exist?(@mapfile_path) end |