class I18nJSON::CLI::Command

Attributes

argv[R]
ui[R]

Public Class Methods

command(&block) click to toggle source
# File lib/i18n-json/cli/command.rb, line 24
def self.command(&block)
  define_method(:command, &block)
end
command_name(name) click to toggle source
# File lib/i18n-json/cli/command.rb, line 8
def self.command_name(name)
  define_method(:name) { name }
end
description(description) click to toggle source
# File lib/i18n-json/cli/command.rb, line 12
def self.description(description)
  define_method(:description) { description }
end
new(argv:, ui:) click to toggle source
# File lib/i18n-json/cli/command.rb, line 28
def initialize(argv:, ui:)
  @argv = argv.dup
  @ui = ui
end
parse(&block) click to toggle source
# File lib/i18n-json/cli/command.rb, line 16
def self.parse(&block)
  define_method(:parse) do
    OptionParser
      .new {|opts| instance_exec(opts, &block) }
      .parse!(argv)
  end
end

Public Instance Methods

call() click to toggle source
# File lib/i18n-json/cli/command.rb, line 33
def call
  parse
  command
end
options() click to toggle source
# File lib/i18n-json/cli/command.rb, line 38
def options
  @options ||= {}
end