Class: CLI::UI::Widgets::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/cli/ui/widgets/base.rb

Direct Known Subclasses

Status

Class Method Summary collapse

Instance Method Summary collapse

Methods included from T::Sig

sig

Methods included from T::Helpers

abstract!, final!, interface!, mixes_in_class_methods, sealed!

Constructor Details

#initialize(argstring) ⇒ Base

Returns a new instance of Base.


18
19
20
21
22
23
24
25
26
27
# File 'lib/cli/ui/widgets/base.rb', line 18

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

Class Method Details

.argparse_patternObject


30
# File 'lib/cli/ui/widgets/base.rb', line 30

def self.argparse_pattern; end

.call(argstring) ⇒ Object


13
14
15
# File 'lib/cli/ui/widgets/base.rb', line 13

def self.call(argstring)
  new(argstring).render
end

Instance Method Details

#renderObject


33
# File 'lib/cli/ui/widgets/base.rb', line 33

def render; end