Class: Ree::PackagesStore

Inherits:
Object show all
Defined in:
lib/ree/core/packages_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ree_version = Ree::VERSION) ⇒ PackagesStore

Returns a new instance of PackagesStore.



6
7
8
9
# File 'lib/ree/core/packages_store.rb', line 6

def initialize(ree_version = Ree::VERSION)
  @ree_version = ree_version
  @store = {}
end

Instance Attribute Details

#ree_versionObject (readonly)

Returns the value of attribute ree_version.



4
5
6
# File 'lib/ree/core/packages_store.rb', line 4

def ree_version
  @ree_version
end

Instance Method Details

#add_package(package) ⇒ Object

Parameters:



26
27
28
29
30
31
# File 'lib/ree/core/packages_store.rb', line 26

def add_package(package)
  existing = get(package.name)
  return existing if existing

  @store[package.name] = package
end

#get(name) ⇒ Ree::Package

Parameters:

  • name (Symbol)

Returns:



21
22
23
# File 'lib/ree/core/packages_store.rb', line 21

def get(name)
  @store[name]
end

#packagesObject



15
16
17
# File 'lib/ree/core/packages_store.rb', line 15

def packages
  @store.values
end

#set_ree_version(val) ⇒ Object



11
12
13
# File 'lib/ree/core/packages_store.rb', line 11

def set_ree_version(val)
  @ree_version = val; self
end