Class: IRB::Statement::Command

Inherits:
IRB::Statement show all
Defined in:
lib/irb/statement.rb

Instance Attribute Summary

Attributes inherited from IRB::Statement

#code

Instance Method Summary collapse

Constructor Details

#initialize(code, command, arg, command_class) ⇒ Command

Returns a new instance of Command.



47
48
49
50
51
52
# File 'lib/irb/statement.rb', line 47

def initialize(code, command, arg, command_class)
  @code = code
  @command = command
  @arg = arg
  @command_class = command_class
end

Instance Method Details

#evaluable_codeObject



68
69
70
71
72
73
74
75
76
77
# File 'lib/irb/statement.rb', line 68

def evaluable_code
  # Hook command-specific transformation to return valid Ruby code
  if @command_class.respond_to?(:transform_args)
    arg = @command_class.transform_args(@arg)
  else
    arg = @arg
  end

  [@command, arg].compact.join(' ')
end

#is_assignment?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/irb/statement.rb', line 54

def is_assignment?
  false
end

#should_be_handled_by_debugger?Boolean

Returns:

  • (Boolean)


62
63
64
65
66
# File 'lib/irb/statement.rb', line 62

def should_be_handled_by_debugger?
  require_relative 'cmd/help'
  require_relative 'cmd/debug'
  IRB::ExtendCommand::DebugCommand > @command_class || IRB::ExtendCommand::Help == @command_class
end

#suppresses_echo?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/irb/statement.rb', line 58

def suppresses_echo?
  false
end