Class: HMap::HMapBucketStr Abstract
- Inherits:
-
Object
- Object
- HMap::HMapBucketStr
- Defined in:
- lib/cocoapods-hmap-prebuilt/hmap_struct.rb
Overview
This class is abstract.
HMapBucketStr => HMapBucket.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#perfix ⇒ Object
readonly
Returns the value of attribute perfix.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #bucket ⇒ Object
- #bucket_to_string(headers, index) ⇒ Object
- #description ⇒ Object
-
#initialize(key, perfix, suffix) ⇒ HMapBucketStr
constructor
A new instance of HMapBucketStr.
-
#serialize ⇒ String
The serialized fields of the mafile.
- #to_h ⇒ Object
Constructor Details
#initialize(key, perfix, suffix) ⇒ HMapBucketStr
Returns a new instance of HMapBucketStr.
121 122 123 124 125 126 127 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 121 def initialize(key, perfix, suffix) @uuid = Utils.string_downcase_hash(key) @key = key @perfix = perfix @suffix = suffix @str_ins = {} end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
119 120 121 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 119 def key @key end |
#perfix ⇒ Object (readonly)
Returns the value of attribute perfix.
119 120 121 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 119 def perfix @perfix end |
#suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
119 120 121 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 119 def suffix @suffix end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
119 120 121 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 119 def uuid @uuid end |
Instance Method Details
#bucket ⇒ Object
141 142 143 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 141 def bucket HMapBucket.new(@str_ins[@key], @str_ins[@perfix], @str_ins[@suffix]) end |
#bucket_to_string(headers, index) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 129 def bucket_to_string(headers, index) bucket = [key, perfix, suffix] bucket.inject('') do |sum, arg| if headers[arg].nil? headers[arg] = sum.length + index sum += "#{Utils.safe_encode(arg, 'ASCII-8BIT')}\0" end @str_ins[arg] = headers[arg] sum end end |
#description ⇒ Object
150 151 152 153 154 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 150 def description <<-DESC Key #{@key} -> Prefix #{@perfix}, Suffix #{@suffix} DESC end |
#serialize ⇒ String
Returns the serialized fields of the mafile.
146 147 148 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 146 def serialize bucket.serialize end |
#to_h ⇒ Object
156 157 158 159 160 161 162 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_struct.rb', line 156 def to_h { 'key' => { 'index' => str_ins[@key], 'key' => @key }, 'perfix' => { 'index' => str_ins[@perfix], 'perfix' => @perfix }, 'suffix' => { 'index' => str_ins[@suffix], 'suffix' => @suffix } } end |