Class: Valise::Stack::SingleExtensionDecorator

Inherits:
Decorator show all
Defined in:
lib/valise/stack/extensions-decorator.rb

Instance Attribute Summary

Attributes inherited from Valise::Stack

#valise

Instance Method Summary collapse

Methods inherited from Decorator

#each, #rel_path, #sub_stack, #valise

Methods inherited from Valise::Stack

#below, #depth_of, #diffed, #dump_load, #each, #exts, #find, #item_for, #merge_diff, #merged, #not_above, #pfxs, #raw_find, #rel_path, #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, lead_decco, ext) ⇒ SingleExtensionDecorator

Returns a new instance of SingleExtensionDecorator.



35
36
37
38
39
40
41
42
# File 'lib/valise/stack/extensions-decorator.rb', line 35

def initialize(stack, lead_decco, ext)
  super(stack)
  @leader = lead_decco
  @ext = ext

  dir, file = *(stack.segments.split.map(&:to_s))
  @segments = make_pathname([dir, (file.to_s + ext)])
end

Instance Method Details

#inspectObject



44
45
46
# File 'lib/valise/stack/extensions-decorator.rb', line 44

def inspect
  @stack.inspect + @ext
end

#reget(root) ⇒ Object



52
53
54
# File 'lib/valise/stack/extensions-decorator.rb', line 52

def reget(root)
  @leader.reget(root)
end

#segmentsObject



48
49
50
# File 'lib/valise/stack/extensions-decorator.rb', line 48

def segments
  @segments
end