Class: Ree::Package
Instance Attribute Summary collapse
-
#default_links ⇒ Object
readonly
Returns the value of attribute default_links.
-
#entry_rpath ⇒ Object
readonly
Returns the value of attribute entry_rpath.
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#module ⇒ Object
readonly
Returns the value of attribute module.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#preload ⇒ Object
readonly
Returns the value of attribute preload.
-
#schema_rpath ⇒ Object
readonly
Returns the value of attribute schema_rpath.
-
#schema_version ⇒ Object
readonly
Returns the value of attribute schema_version.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #deps ⇒ Object
- #dir ⇒ Object
- #entry_loaded? ⇒ Boolean
- #env_vars ⇒ Object
- #gem? ⇒ Boolean
- #get_dep(name) ⇒ Object
- #get_env_var(name) ⇒ Object
- #get_object(name) ⇒ Nilor[Ree::Object]
-
#initialize(schema_version, name, entry_rpath, schema_rpath, gem_name = nil) ⇒ Package
constructor
A new instance of Package.
- #loaded? ⇒ Boolean
- #objects ⇒ Object
- #preloaded? ⇒ Boolean
- #remove_object(name) ⇒ nil
- #reset ⇒ Object
- #schema_loaded? ⇒ Boolean
- #set_default_links(&block) ⇒ Object
- #set_dep(dep) ⇒ Object
- #set_deps(list) ⇒ Object
- #set_entry_loaded ⇒ Object
- #set_entry_rpath(val) ⇒ Object
- #set_env_var(var) ⇒ Object
- #set_env_vars(list) ⇒ Object
- #set_loaded ⇒ Object
- #set_module(mod) ⇒ Object
-
#set_object(object) ⇒ Nilor[Ree::Object]
Previous object version.
- #set_preload(val) ⇒ Object
- #set_preloaded(val) ⇒ Object
- #set_schema_loaded ⇒ Object
- #set_schema_rpath(val) ⇒ Object
- #set_schema_version(val) ⇒ Object
- #set_tags(list) ⇒ Object
Constructor Details
#initialize(schema_version, name, entry_rpath, schema_rpath, gem_name = nil) ⇒ Package
Returns a new instance of Package.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ree/core/package.rb', line 9 def initialize(schema_version, name, entry_rpath, schema_rpath, gem_name = nil) @schema_version = schema_version @name = name @schema_rpath = schema_rpath @entry_rpath = entry_rpath @objects_store = {} @deps_store = {} @env_vars_store = {} @entry_loaded = false @schema_loaded = false @loaded = false @tags = [] @preload = {} @preloaded = false @gem_name = gem_name end |
Instance Attribute Details
#default_links ⇒ Object (readonly)
Returns the value of attribute default_links.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def default_links @default_links end |
#entry_rpath ⇒ Object (readonly)
Returns the value of attribute entry_rpath.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def entry_rpath @entry_rpath end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def gem_name @gem_name end |
#module ⇒ Object (readonly)
Returns the value of attribute module.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def module @module end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def name @name end |
#preload ⇒ Object (readonly)
Returns the value of attribute preload.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def preload @preload end |
#schema_rpath ⇒ Object (readonly)
Returns the value of attribute schema_rpath.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def schema_rpath @schema_rpath end |
#schema_version ⇒ Object (readonly)
Returns the value of attribute schema_version.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def schema_version @schema_version end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
6 7 8 |
# File 'lib/ree/core/package.rb', line 6 def @tags end |
Instance Method Details
#deps ⇒ Object
116 117 118 |
# File 'lib/ree/core/package.rb', line 116 def deps @deps_store.values end |
#dir ⇒ Object
96 97 98 |
# File 'lib/ree/core/package.rb', line 96 def dir @dir ||= @schema_rpath ? Pathname.new(@schema_rpath).dirname.to_s : nil end |
#entry_loaded? ⇒ Boolean
88 89 90 |
# File 'lib/ree/core/package.rb', line 88 def entry_loaded? @entry_loaded end |
#env_vars ⇒ Object
139 140 141 |
# File 'lib/ree/core/package.rb', line 139 def env_vars @env_vars_store.values end |
#gem? ⇒ Boolean
100 101 102 |
# File 'lib/ree/core/package.rb', line 100 def gem? !!@gem_name end |
#get_dep(name) ⇒ Object
128 129 130 |
# File 'lib/ree/core/package.rb', line 128 def get_dep(name) @deps_store[name] end |
#get_env_var(name) ⇒ Object
151 152 153 |
# File 'lib/ree/core/package.rb', line 151 def get_env_var(name) @env_vars_store[name] end |
#get_object(name) ⇒ Nilor[Ree::Object]
180 181 182 |
# File 'lib/ree/core/package.rb', line 180 def get_object(name) @objects_store[name] end |
#loaded? ⇒ Boolean
72 73 74 |
# File 'lib/ree/core/package.rb', line 72 def loaded? @loaded end |
#objects ⇒ Object
184 185 186 |
# File 'lib/ree/core/package.rb', line 184 def objects @objects_store.values.flatten end |
#preloaded? ⇒ Boolean
35 36 37 |
# File 'lib/ree/core/package.rb', line 35 def preloaded? @preloaded end |
#remove_object(name) ⇒ nil
170 171 172 173 174 175 176 |
# File 'lib/ree/core/package.rb', line 170 def remove_object(name) if @objects_store[name] @objects_store.delete(name) end nil end |
#reset ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/ree/core/package.rb', line 59 def reset @entry_loaded = false @schema_loaded = false @loaded = false @deps_store = {} @env_vars_store = {} @preload = {} end |
#schema_loaded? ⇒ Boolean
92 93 94 |
# File 'lib/ree/core/package.rb', line 92 def schema_loaded? @schema_loaded end |
#set_default_links(&block) ⇒ Object
26 27 28 |
# File 'lib/ree/core/package.rb', line 26 def set_default_links(&block) @default_links = block; self end |
#set_dep(dep) ⇒ Object
121 122 123 124 125 |
# File 'lib/ree/core/package.rb', line 121 def set_dep(dep) old = @deps_store[dep.name] @deps_store[dep.name] = dep old end |
#set_deps(list) ⇒ Object
110 111 112 113 114 |
# File 'lib/ree/core/package.rb', line 110 def set_deps(list) list.each do |item| @deps_store[item.name] = item end end |
#set_entry_loaded ⇒ Object
80 81 82 |
# File 'lib/ree/core/package.rb', line 80 def set_entry_loaded @entry_loaded = true end |
#set_entry_rpath(val) ⇒ Object
45 46 47 |
# File 'lib/ree/core/package.rb', line 45 def set_entry_rpath(val) @entry_rpath = val; self end |
#set_env_var(var) ⇒ Object
144 145 146 147 148 |
# File 'lib/ree/core/package.rb', line 144 def set_env_var(var) old = @env_vars_store[var.name] @env_vars_store[var.name] = var old end |
#set_env_vars(list) ⇒ Object
133 134 135 136 137 |
# File 'lib/ree/core/package.rb', line 133 def set_env_vars(list) list.each do |item| @env_vars_store[item.name] = item end end |
#set_loaded ⇒ Object
76 77 78 |
# File 'lib/ree/core/package.rb', line 76 def set_loaded @loaded = true end |
#set_module(mod) ⇒ Object
105 106 107 |
# File 'lib/ree/core/package.rb', line 105 def set_module(mod) @module = mod; self end |
#set_object(object) ⇒ Nilor[Ree::Object]
Returns Previous object version.
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/ree/core/package.rb', line 157 def set_object(object) if object.package_name != @name raise Ree::Error.new("package should only include objects from the same package") end existing = @objects_store[object.name] return existing if existing @objects_store[object.name] = object end |
#set_preload(val) ⇒ Object
68 69 70 |
# File 'lib/ree/core/package.rb', line 68 def set_preload(val) @preload = val; self end |
#set_preloaded(val) ⇒ Object
31 32 33 |
# File 'lib/ree/core/package.rb', line 31 def set_preloaded(val) @preloaded = val; self end |
#set_schema_loaded ⇒ Object
84 85 86 |
# File 'lib/ree/core/package.rb', line 84 def set_schema_loaded @schema_loaded = true end |
#set_schema_rpath(val) ⇒ Object
55 56 57 |
# File 'lib/ree/core/package.rb', line 55 def set_schema_rpath(val) @schema_rpath = val; self end |
#set_schema_version(val) ⇒ Object
40 41 42 |
# File 'lib/ree/core/package.rb', line 40 def set_schema_version(val) @schema_version = val; self end |
#set_tags(list) ⇒ Object
50 51 52 |
# File 'lib/ree/core/package.rb', line 50 def (list) @tags = (@tags + list).map(&:to_s).uniq; self end |