Sha256: 5fc4408c8eb779e6f383b7b262bc03d02c5266b8da55d1d3cfce621ae59d2adb

Contents?: true

Size: 547 Bytes

Versions: 7

Compression:

Stored size: 547 Bytes

Contents

module Konacha
  class Spec
    class NotFound < StandardError
    end

    def self.all
      paths = Konacha.spec_paths
      if ENV["SPEC"]
        paths =  ENV["SPEC"].split(",")
      end
      paths.map {|path| new(path)}
    end

    def self.find(path)
      all.select { |s| s.path.starts_with?(path) }.presence or raise NotFound
    end

    attr_accessor :path

    def initialize(path)
      @path = path
    end

    def url
      "/#{asset_name}"
    end

    def asset_name
      path.sub(/(\.js|\.coffee).*/, '')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
konacha-1.5.1 app/models/konacha/spec.rb
konacha-1.5.0 app/models/konacha/spec.rb
konacha-1.4.2 app/models/konacha/spec.rb
konacha-1.4.1 app/models/konacha/spec.rb
konacha-1.4.0 app/models/konacha/spec.rb
konacha-1.3.1 app/models/konacha/spec.rb
konacha-1.3.0 app/models/konacha/spec.rb