class Take::Project::File
Public Class Methods
new(name)
click to toggle source
# File lib/take/project/file.rb, line 20 def initialize(name) @name = name end
normalize(file, path)
click to toggle source
# File lib/take/project/file.rb, line 9 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
Public Instance Methods
sub_ext(ext)
click to toggle source
# File lib/take/project/file.rb, line 42 def sub_ext(ext) File.new(@name.sub_ext(ext)) end
type()
click to toggle source
# File lib/take/project/file.rb, line 24 def type @_type ||= begin case @name.extname when ".ta" :library when ".to", ".o" :object when ".c" :source when "" :executable else :unknown end end end