Class: S7::S7Cli::SaveCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/s7/s7cli/command.rb

Overview

現在の状態を保存するコマンドを表現する。

Instance Attribute Summary

Attributes inherited from Command

#config, #options, #world

Instance Method Summary collapse

Methods inherited from Command

#aliases, create_instance, #description, #help, #name, #option_parser, split_name_and_argv, #usage

Methods included from GetText

#N_, #_, bindtextdomain, included

Constructor Details

#initialize(*args) ⇒ SaveCommand

Returns a new instance of SaveCommand.



152
153
154
155
# File 'lib/s7/s7cli/command.rb', line 152

def initialize(*args)
  super
  @options.push(BoolOption.new("f", "force", _("Force.")))
end

Instance Method Details

#run(argv) ⇒ Object



157
158
159
160
161
162
# File 'lib/s7/s7cli/command.rb', line 157

def run(argv)
  option_parser.parse!(argv)
  world.save(config["force"])
  puts(_("Saved."))
  return true
end