Class: Utils::IRB::Shell::WrapperBase

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/utils/irb.rb

Direct Known Subclasses

ConstantWrapper, MethodWrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ WrapperBase

Returns a new instance of WrapperBase.



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/utils/irb.rb', line 99

def initialize(name)
  @name =
    case
    when name.respond_to?(:to_str)
      name.to_str
    when name.respond_to?(:to_sym)
      name.to_sym.to_s
    else
      name.to_s
    end
end

Instance Attribute Details

#descriptionObject (readonly) Also known as: to_str, inspect, to_s

Returns the value of attribute description.



113
114
115
# File 'lib/utils/irb.rb', line 113

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



111
112
113
# File 'lib/utils/irb.rb', line 111

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



131
132
133
# File 'lib/utils/irb.rb', line 131

def <=>(other)
  @name <=> other.name
end

#==(name) ⇒ Object Also known as: eql?



121
122
123
# File 'lib/utils/irb.rb', line 121

def ==(name)
  @name = name
end

#hashObject



127
128
129
# File 'lib/utils/irb.rb', line 127

def hash
  @name.hash
end