Class: CLI::UI::Widgets::Base
- Inherits:
-
Object
- Object
- CLI::UI::Widgets::Base
- Defined in:
- lib/cli/ui/widgets/base.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argstring) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(argstring) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 |
# 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 |
Class Method Details
.argparse_pattern ⇒ Object
21 22 23 |
# File 'lib/cli/ui/widgets/base.rb', line 21 def self.argparse_pattern const_get(:ARGPARSE_PATTERN) end |
.call(argstring) ⇒ Object
7 8 9 |
# File 'lib/cli/ui/widgets/base.rb', line 7 def self.call(argstring) new(argstring).render end |