Class: HMap::Command::Reader

Inherits:
HMap::Command show all
Defined in:
lib/hmap/command/hmap_reader.rb

Overview

hmap file reader cmd

Class Method Summary collapse

Instance Method Summary collapse

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).expand_path unless mapfile_path.nil?
end

Class Method Details

.optionsObject



32
33
34
35
36
# File 'lib/hmap/command/hmap_reader.rb', line 32

def self.options
  [
    ['--hmap-path=/hmap/dir/file', 'The path of the hmap file']
  ].concat(super)
end

Instance Method Details

#runObject



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