Class: Rupert::RPM::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/rupert/rpm/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries = [], store = nil) ⇒ Index

Initializes a new signature index, given the header’s entries and the store containing actual data.

Parameters:

  • entries (Array) (defaults to: [])

    a list of Entry, or optionally a single Entry not included in any array

  • store (IO) (defaults to: nil)

    raw store containing data pointed by entries



16
17
18
19
# File 'lib/rupert/rpm/index.rb', line 16

def initialize(entries=[], store=nil)
  @entries = index list_of entries
  @store = store
end

Instance Attribute Details

#store=(value) ⇒ Object (writeonly)

Sets the attribute store

Parameters:

  • value

    the value to set the attribute store to.



6
7
8
# File 'lib/rupert/rpm/index.rb', line 6

def store=(value)
  @store = value
end

Instance Method Details

#add(entry) ⇒ Object

Adds an entry to the index.

Parameters:



34
35
36
# File 'lib/rupert/rpm/index.rb', line 34

def add(entry)
  @entries[entry.tag] = entry
end

#get(tag) ⇒ Object

Retrieves data pointed by given tag.

Parameters:

  • tag (Fixnum)

    data type

Returns:

  • (Object)

    data associated to given tag, with variable format depending on how it’s stored (see Entry#resolve)



27
28
29
# File 'lib/rupert/rpm/index.rb', line 27

def get(tag)
  @entries[tag].resolve(@store)
end