Class: Rafflesia::SearchSegmentRoot

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/proteins/search_segment_root.rb

Constant Summary collapse

HASH_ATTRS =
{
  block_bytes: :block_bytes,
  block_count: :block_count,
  content_sha256: :content_sha_256,
  key_mode: :key_mode,
  kind: :kind,
  schema_version: :schema_version,
  segment_id: :segment_id,
  sparse_entries: :sparse_entries
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ SearchSegmentRoot

Returns a new instance of SearchSegmentRoot.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 29

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @block_bytes = hash[:block_bytes]
  @block_count = hash[:block_count]
  @content_sha_256 = hash[:content_sha256]
  @key_mode = hash[:key_mode]
  @kind = hash[:kind]
  @schema_version = hash[:schema_version]
  @segment_id = hash[:segment_id]
  @sparse_entries = (hash[:sparse_entries] || []).map { |item| item ? Rafflesia::SearchSegmentSparseEntry.new(item) : nil }
end

Instance Attribute Details

#block_bytesObject

Returns the value of attribute block_bytes.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def block_bytes
  @block_bytes
end

#block_countObject

Returns the value of attribute block_count.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def block_count
  @block_count
end

#content_sha_256Object

Returns the value of attribute content_sha_256.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def content_sha_256
  @content_sha_256
end

#key_modeObject

Returns the value of attribute key_mode.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def key_mode
  @key_mode
end

#kindObject

Returns the value of attribute kind.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def kind
  @kind
end

#schema_versionObject

Returns the value of attribute schema_version.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def schema_version
  @schema_version
end

#segment_idObject

Returns the value of attribute segment_id.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def segment_id
  @segment_id
end

#sparse_entriesObject

Returns the value of attribute sparse_entries.



19
20
21
# File 'lib/rafflesia/proteins/search_segment_root.rb', line 19

def sparse_entries
  @sparse_entries
end