Class: IRB::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/irb/command/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(irb_context) ⇒ Base

Returns a new instance of Base.



47
48
49
# File 'lib/irb/command/base.rb', line 47

def initialize(irb_context)
  @irb_context = irb_context
end

Instance Attribute Details

#irb_contextObject (readonly)

Returns the value of attribute irb_context.



51
52
53
# File 'lib/irb/command/base.rb', line 51

def irb_context
  @irb_context
end

Class Method Details

.category(category = nil) ⇒ Object



19
20
21
22
# File 'lib/irb/command/base.rb', line 19

def category(category = nil)
  @category = category if category
  @category || "No category"
end

.description(description = nil) ⇒ Object



24
25
26
27
# File 'lib/irb/command/base.rb', line 24

def description(description = nil)
  @description = description if description
  @description || "No description provided."
end

.execute(irb_context, arg) ⇒ Object



34
35
36
37
38
# File 'lib/irb/command/base.rb', line 34

def execute(irb_context, arg)
  new(irb_context).execute(arg)
rescue CommandArgumentError => e
  puts e.message
end

.help_message(help_message = nil) ⇒ Object



29
30
31
32
# File 'lib/irb/command/base.rb', line 29

def help_message(help_message = nil)
  @help_message = help_message if help_message
  @help_message
end

Instance Method Details

#execute(arg) ⇒ Object



53
54
55
# File 'lib/irb/command/base.rb', line 53

def execute(arg)
  #nop
end