class GitCommander::Command::Loaders::Raw
@abstract Handles loading commands from raw strings
Attributes
content[R]
Public Instance Methods
command(name, &block)
click to toggle source
# 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 = "")
click to toggle source
# 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.message) parse_error.set_backtrace e.backtrace result.errors << parse_error result end
plugin(name, **options)
click to toggle source
# File lib/git_commander/command/loaders/raw.rb, line 36 def plugin(name, **options) plugin_result = GitCommander::Plugin::Loader.new(registry).load(name, **options) result.plugins |= plugin_result.plugins end