Class: GitCommander::Command::Loaders::Raw Abstract
- Defined in:
- lib/git_commander/command/loaders/raw.rb
Overview
This class is abstract.
Handles loading commands from raw strings
Defined Under Namespace
Classes: CommandParseError
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Attributes inherited from Loader
Instance Method Summary collapse
Methods inherited from Loader
Constructor Details
This class inherits a constructor from GitCommander::Loader
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'lib/git_commander/command/loaders/raw.rb', line 14 def content @content end |
Instance Method Details
#command(name, &block) ⇒ Object
30 31 32 33 34 |
# File 'lib/git_commander/command/loaders/raw.rb', line 30 def command(name, &block) result.commands << Configurator.new(registry).configure(name, &block) rescue Configurator::ConfigurationError => e result.errors << e end |
#load(content = "") ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/git_commander/command/loaders/raw.rb', line 16 def load(content = "") @content = content instance_eval @content result # In this case, since we're evaluating raw IO in the context of this # instance, we need to catch a wider range of exceptions. Otherwise, # syntax errors would blow this up. rescue Exception => e # rubocop:disable Lint/RescueException parse_error = CommandParseError.new(e.) parse_error.set_backtrace e.backtrace result.errors << parse_error result end |
#plugin(name, **options) ⇒ Object
36 37 38 39 |
# File 'lib/git_commander/command/loaders/raw.rb', line 36 def plugin(name, **) plugin_result = GitCommander::Plugin::Loader.new(registry).load(name, **) result.plugins |= plugin_result.plugins end |