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.



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

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



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

def argparse_pattern; end

.call(argstring) ⇒ Object



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

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

Instance Method Details

#renderObject



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

def render; end