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.



24
25
26
27
28
29
30
31
32
33
# File 'lib/cli/ui/widgets/base.rb', line 24

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



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

def argparse_pattern; end

.call(argstring) ⇒ Object



18
19
20
# File 'lib/cli/ui/widgets/base.rb', line 18

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

Instance Method Details

#renderObject



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

def render; end