Class: IRB::Command::Base

Inherits:
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.



49
50
51
# File 'lib/irb/command/base.rb', line 49

def initialize(irb_context)
  @irb_context = irb_context
end

Instance Attribute Details

#irb_contextObject (readonly)

Returns the value of attribute irb_context.



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

def irb_context
  @irb_context
end

Class Method Details

.category(category = nil) ⇒ Object



21
22
23
24
# File 'lib/irb/command/base.rb', line 21

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

.description(description = nil) ⇒ Object



26
27
28
29
# File 'lib/irb/command/base.rb', line 26

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

.execute(irb_context, arg) ⇒ Object



36
37
38
39
40
# File 'lib/irb/command/base.rb', line 36

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

.help_message(help_message = nil) ⇒ Object



31
32
33
34
# File 'lib/irb/command/base.rb', line 31

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

Instance Method Details

#execute(arg) ⇒ Object



55
56
57
# File 'lib/irb/command/base.rb', line 55

def execute(arg)
  #nop
end