Sha256: 98524dc4312fb562b606bfa350e9de335d4c8c8fe165d648573cba73c77734a1
Contents?: true
Size: 973 Bytes
Versions: 5
Compression:
Stored size: 973 Bytes
Contents
require "pathname" module Stitch class Source class << self def from_path(root, path = nil, result = []) path ||= root path = Pathname.new(path) if path.directory? path.children.each do |child| from_path(root, child, result) end else source = self.new(root, path) result << source if source.valid? end result end end attr_reader :root, :path def initialize(root, path) @root = Pathname.new(root) @path = Pathname.new(path) end def name name = path.relative_path_from(root) name = name.dirname + name.basename(".*") name.to_s end def ext path.extname end def compile compiler.compile(path) end def valid? !!compiler end protected def compiler Compiler.for_extension(ext) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
stitch-rb-0.0.5 | lib/stitch/source.rb |
stitch-rb-0.0.4 | lib/stitch/source.rb |
stitch-rb-0.0.3 | lib/stitch/source.rb |
stitch-rb-0.0.2 | lib/stitch/source.rb |
stitch-rb-0.0.1 | lib/stitch/source.rb |