Skip to content

Commit

Permalink
zold-io#72: substract the prefix from full path if its equal
Browse files Browse the repository at this point in the history
  • Loading branch information
sandiks committed Jun 15, 2018
1 parent 065792a commit 8e7d62f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/zold/wallets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'pathname'
require_relative 'id'
require_relative 'wallet'

Expand All @@ -36,7 +36,9 @@ def initialize(dir)
# the full path let's substract the prefix from it if it's equal
# to the current directory in Dir.pwd.
def to_s
path
curr_path = Pathname.new(path)
dir_path = Pathname.new(Dir.pwd)
curr_path.relative_path_from(dir_path).to_s
end

def path
Expand Down

0 comments on commit 8e7d62f

Please sign in to comment.