Module: XSemVer::DSL::InstanceMethods

Defined in:
lib/dsl.rb

Instance Method Summary collapse

Instance Method Details

#run_command(command) ⇒ Object

Calls an instance method defined via the ::command class method. Raises CommandError if the command does not exist.



20
21
22
23
24
25
26
27
# File 'lib/dsl.rb', line 20

def run_command(command)
  method_name = "#{self.class.command_prefix}#{command}"
  if self.class.method_defined?(method_name)
    send method_name
  else
    raise CommandError, "invalid command #{command}"
  end
end