Sha256: d303362f13a4fc7a16f83e4d62c983ae5b6f7389283306dd838422b05a65d386

Contents?: true

Size: 554 Bytes

Versions: 3

Compression:

Stored size: 554 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
      "/iframe/#{asset_name}"
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
konacha-2.0.0.beta3 app/models/konacha/spec.rb
konacha-2.0.0.beta2 app/models/konacha/spec.rb
konacha-2.0.0.beta1 app/models/konacha/spec.rb