Module: Gap::HashChain::Package

Defined in:
lib/gap50/cache/hashchain.rb

Constant Summary collapse

PACKAGES =
{}

Class Method Summary collapse

Class Method Details

.[](a) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gap50/cache/hashchain.rb', line 18

def self.[](a)
    if !PACKAGES.include?(a)
        raise ArgumentError, "Not exists #{a}"
    else
        PACKAGES[a]
    end
end

.call(hnode) ⇒ Object



26
27
28
# File 'lib/gap50/cache/hashchain.rb', line 26

def self.call(hnode)
    self[hnode.getone(:package)]
end

.register(a, b) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/gap50/cache/hashchain.rb', line 7

def self.register(a, b)
    if PACKAGES.include?(a) && PACKAGES[a] != b
        raise ArgumentError, "Already exists #{a}"
    else
        PACKAGES[a] = b 
    end
end

.unregister(a) ⇒ Object



14
15
16
# File 'lib/gap50/cache/hashchain.rb', line 14

def self.unregister(a)
    PACKAGES.delete(a)
end