Class: Valise::Stack::Decorator

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

Instance Method Summary collapse

Methods inherited from Valise::Stack

#below, #depth_of, #diffed, #dump_load, #exts, #find, #inspect, #item_for, #merge_diff, #merged, #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
# File 'lib/valise/stack/decorator.rb', line 6

def initialize(stack)
  @stack = stack
  @stacks = {}
end

Instance Method Details

#eachObject



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

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

#rel_pathObject



23
24
25
# File 'lib/valise/stack/decorator.rb', line 23

def rel_path
  @stack.rel_path
end

#segmentsObject



15
16
17
# File 'lib/valise/stack/decorator.rb', line 15

def segments
  @stack.segments
end

#sub_stack(segments) ⇒ Object



11
12
13
# File 'lib/valise/stack/decorator.rb', line 11

def sub_stack(segments)
  @stacks[segments] ||= @stack.valise.get(segments)
end

#valiseObject



19
20
21
# File 'lib/valise/stack/decorator.rb', line 19

def valise
  @stack.valise
end