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.



141
142
143
144
145
146
147
148
149
150
151
# File 'lib/utils/irb.rb', line 141

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.



155
156
157
# File 'lib/utils/irb.rb', line 155

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



153
154
155
# File 'lib/utils/irb.rb', line 153

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



173
174
175
# File 'lib/utils/irb.rb', line 173

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

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



163
164
165
# File 'lib/utils/irb.rb', line 163

def ==(name)
  @name = name
end

#hashObject



169
170
171
# File 'lib/utils/irb.rb', line 169

def hash
  @name.hash
end