Sha256: bcff5ac14a8a9966ab2f486d7070d8b153dacfc9bc8c5feb2beb7a8a1d0d622a
Contents?: true
Size: 677 Bytes
Versions: 6
Compression:
Stored size: 677 Bytes
Contents
autoload :Pathname, 'pathname' class Object class << self def attr_block(*syms) syms.flatten.each do |sym| class_eval "def #{sym}(&block);block.call(@#{sym}) if block_given?;@#{sym};end" end end end end class String def relative_path_from(dir) Pathname.new(File.expand_path(self)).relative_path_from(Pathname.new(File.expand_path(dir))).to_s end def relative_path relative_path_from(Dir.pwd) end end def _pp(cmd, src, tgt=nil, options={}) return if Rake.verbose width = 5 template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s" puts template % [cmd, src, tgt ? "-> #{tgt}" : nil] end
Version data entries
6 entries across 6 versions & 1 rubygems