class CLI::UI::Widgets::Base

Public Class Methods

argparse_pattern() click to toggle source
# File lib/cli/ui/widgets/base.rb, line 21
def self.argparse_pattern
  const_get(:ARGPARSE_PATTERN)
end
call(argstring) click to toggle source
# File lib/cli/ui/widgets/base.rb, line 7
def self.call(argstring)
  new(argstring).render
end
new(argstring) click to toggle source
# File lib/cli/ui/widgets/base.rb, line 11
def initialize(argstring)
  pat = self.class.argparse_pattern
  unless (@match_data = pat.match(argstring))
    raise(Widgets::InvalidWidgetArguments.new(argstring, pat))
  end
  @match_data.names.each do |name|
    instance_variable_set(:"@#{name}", @match_data[name])
  end
end