Class: Valise::Stack::Decorator

Inherits:
Valise::Stack show all
Defined in:
lib/valise/stack/decorator.rb

Direct Known Subclasses

ExtensionsDecorator, PrefixesDecorator

Instance Attribute Summary

Attributes inherited from Valise::Stack

#segments

Instance Method Summary collapse

Methods inherited from Valise::Stack

#below, #depth_of, #dump_load, #exts, #find, #inspect, #item_for, #merge_diff, #not_above, #pfxs, #raw_find, #reget, #reverse

Methods included from ItemEnum

#absent, #present, #writable

Methods included from Unpath

#clean_pathname, #containing_workspace, #current_directory, #file_from_backtrace, #from_here, #make_pathname, #starting_directory, #up_to, #up_until

Constructor Details

#initialize(stack) ⇒ Decorator

Returns a new instance of Decorator.



6
7
8
9
10
11
# File 'lib/valise/stack/decorator.rb', line 6

def initialize(stack)
  @stack = stack
  @stacks = Hash.new do |h,segments|
    h[segments] = @stack.valise.get(segments)
  end
end

Instance Method Details

#diffed(item, value) ⇒ Object



21
22
23
# File 'lib/valise/stack/decorator.rb', line 21

def diffed(item, value)
  item.stack.diffed(item, value)
end

#eachObject



29
30
31
32
33
34
# File 'lib/valise/stack/decorator.rb', line 29

def each
  return enum_for(:each) unless block_given?
  @stack.each do |item|
    decorate_item(item){|decorated| yield(decorated)}
  end
end

#merged(item) ⇒ Object



17
18
19
# File 'lib/valise/stack/decorator.rb', line 17

def merged(item)
  item.stack.merged(item)
end

#rel_pathObject



25
26
27
# File 'lib/valise/stack/decorator.rb', line 25

def rel_path
  @stack.rel_path
end

#valiseObject



13
14
15
# File 'lib/valise/stack/decorator.rb', line 13

def valise
  @stack.valise
end