Class: Buildr::ArtifactNamespace::Registry
- Inherits:
-
Hash
show all
- Includes:
- DClone
- Defined in:
- lib/buildr/packaging/artifact_namespace.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from DClone
#dclone
Methods inherited from Hash
#except, from_java_properties, #only, #to_java_properties
Instance Attribute Details
Returns the value of attribute parent.
313
314
315
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 313
def parent
@parent
end
|
Instance Method Details
#[]=(key, value) ⇒ Object
335
336
337
338
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 335
def []=(key, value)
return unless key
super(key.to_sym, value)
end
|
#alias(new_name, old_name) ⇒ Object
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 314
def alias(new_name, old_name)
new_name = new_name.to_sym
old_name = old_name.to_sym
if obj = get(old_name, true)
self[new_name] = obj
@aliases ||= []
group = @aliases.find { |a| a.include?(new_name) }
group.delete(new_name) if group
group = @aliases.find { |a| a.include?(old_name) }
@aliases << (group = [old_name]) unless group
group << new_name unless group.include?(new_name)
end
obj
end
|
#aliases(name) ⇒ Object
329
330
331
332
333
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 329
def aliases(name)
return [] unless name
name = name.to_sym
((@aliases ||= []).find { |a| a.include?(name) } || [name]).dup
end
|
#delete(key, include_parent = nil) ⇒ Object
358
359
360
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 358
def delete(key, include_parent = nil)
aliases(key).map {|n| super(n) } && include_parent && parent && parent.delete(key, include_parent)
end
|
#get(key, include_parent = nil) ⇒ Object
340
341
342
343
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 340
def get(key, include_parent = nil)
[].tap { |a| aliases(key).select { |n| a[0] = self[n] } }.first ||
(include_parent && parent && parent.get(key, include_parent))
end
|
#key?(key, include_parent = nil) ⇒ Boolean
353
354
355
356
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 353
def key?(key, include_parent = nil)
return false unless key
super(key.to_sym) || (include_parent && parent && parent.key?(key, include_parent))
end
|
#keys(include_parent = nil) ⇒ Object
345
346
347
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 345
def keys(include_parent = nil)
(super() | (include_parent && parent && parent.keys(include_parent) || [])).uniq
end
|
#values(include_parent = nil) ⇒ Object
349
350
351
|
# File 'lib/buildr/packaging/artifact_namespace.rb', line 349
def values(include_parent = nil)
(super() | (include_parent && parent && parent.values(include_parent) || [])).uniq
end
|