Sha256: cdd56a5614a322651ee69107ab07c6931cefcbdd48aa4b3bbeb36d974a6606a8

Contents?: true

Size: 458 Bytes

Versions: 13

Compression:

Stored size: 458 Bytes

Contents

module Konacha
  class Spec
    class NotFound < StandardError
    end

    def self.all
      Konacha.spec_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

13 entries across 13 versions & 1 rubygems

Version Path
konacha-1.2.4 app/models/konacha/spec.rb
konacha-1.2.3 app/models/konacha/spec.rb
konacha-1.2.2 app/models/konacha/spec.rb
konacha-1.2.1 app/models/konacha/spec.rb
konacha-1.2.0 app/models/konacha/spec.rb
konacha-1.1.3 app/models/konacha/spec.rb
konacha-1.1.2 app/models/konacha/spec.rb
konacha-1.1.1 app/models/konacha/spec.rb
konacha-1.1.0 app/models/konacha/spec.rb
konacha-1.0.0 app/models/konacha/spec.rb
konacha-1.0.0.rc1 app/models/konacha/spec.rb
konacha-0.10.0 app/models/konacha/spec.rb
konacha-0.9.1 app/models/konacha/spec.rb