Class: Nuggets::Hash::ZipMixin::ZipVal
- Includes:
- Comparable
- Defined in:
- lib/nuggets/hash/zip_mixin.rb
Direct Known Subclasses
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(value) ⇒ ZipVal
constructor
A new instance of ZipVal.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ ZipVal
Returns a new instance of ZipVal.
116 117 118 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 116 def initialize(value) @value = zip(value) end |
Instance Method Details
#<=>(other) ⇒ Object
120 121 122 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 120 def <=>(other) to_s <=> other.to_s if self.class.equal?(other.class) end |
#eql?(other) ⇒ Boolean Also known as: ==
137 138 139 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 137 def eql?(other) (self <=> other) == 0 end |
#hash ⇒ Object
133 134 135 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 133 def hash to_s.hash end |
#inspect ⇒ Object
128 129 130 131 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 128 def inspect !((s = to_s).length > 64 || s.include?($/)) ? to_s : '#<%s:0x%x length=%p>' % [self.class, object_id, @value.length] end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 124 def to_s unzip(@value) end |