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.
115 116 117 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 115 def initialize(value) @value = zip(value) end |
Instance Method Details
#<=>(other) ⇒ Object
119 120 121 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 119 def <=>(other) to_s <=> other.to_s if self.class.equal?(other.class) end |
#eql?(other) ⇒ Boolean Also known as: ==
136 137 138 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 136 def eql?(other) (self <=> other) == 0 end |
#hash ⇒ Object
132 133 134 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 132 def hash to_s.hash end |
#inspect ⇒ Object
127 128 129 130 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 127 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
123 124 125 |
# File 'lib/nuggets/hash/zip_mixin.rb', line 123 def to_s unzip(@value) end |