Class: CLI::UI::Widgets::Base Abstract
- Inherits:
-
Object
- Object
- CLI::UI::Widgets::Base
- Defined in:
- lib/cli/ui/widgets/base.rb
Overview
This class is abstract.
Direct Known Subclasses
Class Method Summary collapse
-
.argparse_pattern ⇒ Object
abstract
: -> Regexp.
-
.call(argstring) ⇒ Object
: (String argstring) -> String.
Instance Method Summary collapse
-
#initialize(argstring) ⇒ Base
constructor
: (String argstring) -> void.
-
#render ⇒ Object
abstract
: -> String.
Constructor Details
#initialize(argstring) ⇒ Base
: (String argstring) -> void
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cli/ui/widgets/base.rb', line 19 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_pattern ⇒ Object
This method is abstract.
: -> Regexp
33 34 35 |
# File 'lib/cli/ui/widgets/base.rb', line 33 def argparse_pattern raise(NotImplementedError) end |
.call(argstring) ⇒ Object
: (String argstring) -> String
13 14 15 |
# File 'lib/cli/ui/widgets/base.rb', line 13 def call(argstring) new(argstring).render end |
Instance Method Details
#render ⇒ Object
This method is abstract.
: -> String
40 41 42 |
# File 'lib/cli/ui/widgets/base.rb', line 40 def render raise(NotImplementedError) end |