Class: Valise::Stack::ExtensionsDecorator
Instance Attribute Summary collapse
#segments
Instance Method Summary
collapse
#below, #depth_of, #dump_load, #exts, #find, #item_for, #merge_diff, #not_above, #reverse
Methods included from ItemEnum
#absent, #present, #writable
Methods included from Unpath
#collapse, #file_from_backtrace, #from_here, from_here, #repath, #string_to_segments, #unpath, #up_to, up_to
Constructor Details
Returns a new instance of ExtensionsDecorator.
6
7
8
9
10
|
# File 'lib/valise/stack/extensions-decorator.rb', line 6
def initialize(stack)
@stack = stack
@extensions = []
@stacks = Hash.new{|h,segments| h[segments] = @stack.valise.get(segments) }
end
|
Instance Attribute Details
#extensions ⇒ Object
Returns the value of attribute extensions.
12
13
14
|
# File 'lib/valise/stack/extensions-decorator.rb', line 12
def extensions
@extensions
end
|
Instance Method Details
#diffed(item, value) ⇒ Object
32
33
34
|
# File 'lib/valise/stack/extensions-decorator.rb', line 32
def diffed(item, value)
item.stack.diffed(item, value)
end
|
#each ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/valise/stack/extensions-decorator.rb', line 40
def each
return enum_for(:each) unless block_given?
@stack.each do |item|
@extensions.each do |ext|
dir = item.segments.dup
file = dir.pop
ext_stack = @stacks[dir + [file + ext]]
yield(ext_stack.item_for(item.root))
end
end
end
|
#inspect ⇒ Object
14
15
16
|
# File 'lib/valise/stack/extensions-decorator.rb', line 14
def inspect
@stack.inspect + "x#{extensions.inspect}"
end
|
#merged(item) ⇒ Object
28
29
30
|
# File 'lib/valise/stack/extensions-decorator.rb', line 28
def merged(item)
item.stack.merged(item)
end
|
#reget(root) ⇒ Object
22
23
24
25
26
|
# File 'lib/valise/stack/extensions-decorator.rb', line 22
def reget(root)
decorated = self.new(super)
decorated.extensions = self.extensions
decorated
end
|
#rel_path ⇒ Object
36
37
38
|
# File 'lib/valise/stack/extensions-decorator.rb', line 36
def rel_path
@stack.rel_path
end
|
#valise ⇒ Object
18
19
20
|
# File 'lib/valise/stack/extensions-decorator.rb', line 18
def valise
@stack.valise
end
|