Sha256: 53c0662e5a06662575f95b7fa4349b24cf5192796f366450a943485334805a0f
Contents?: true
Size: 945 Bytes
Versions: 5
Compression:
Stored size: 945 Bytes
Contents
require 'forwardable' module Take class Project class File extend Forwardable def self.normalize(file, path) expanded = ::File.expand_path(file, path) raise ArgumentError, "The given file cannot be placed in " \ "the project: #{file.inspect}" \ unless expanded.start_with?(path.to_s) name = Pathname.new(expanded) name.relative_path_from(path) end def_delegators :@name, :to_path, :to_s, :extname def initialize(name) @name = name end def type @_type ||= begin case @name.extname when ".ta" :library when ".to", ".o" :object when ".c" :source when "" :executable else :unknown end end end def sub_ext(ext) File.new(@name.sub_ext(ext)) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
take-0.0.15 | lib/take/project/file.rb |
take-0.0.14 | lib/take/project/file.rb |
take-0.0.13 | lib/take/project/file.rb |
take-0.0.12 | lib/take/project/file.rb |
take-0.0.11 | lib/take/project/file.rb |