Class: Stowaway::TargetContext

Inherits:
Object
  • Object
show all
Defined in:
lib/stowaway/target_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ TargetContext

Returns a new instance of TargetContext.



3
4
5
# File 'lib/stowaway/target_context.rb', line 3

def initialize(root)
  @root = root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



7
8
9
# File 'lib/stowaway/target_context.rb', line 7

def root
  @root
end

Instance Method Details

#path_relative_to_root(file_p) ⇒ Object



9
10
11
12
# File 'lib/stowaway/target_context.rb', line 9

def path_relative_to_root(file_p)
  root = @root.split("/").last
  file_p.sub(/^.+\/(#{root})/, "")
end