Class: Matcha::Spec

Inherits:
Object
  • Object
show all
Defined in:
app/models/matcha/spec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Spec

Returns a new instance of Spec.



13
14
15
# File 'app/models/matcha/spec.rb', line 13

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



11
12
13
# File 'app/models/matcha/spec.rb', line 11

def path
  @path
end

Class Method Details

.allObject



3
4
5
# File 'app/models/matcha/spec.rb', line 3

def self.all
  Matcha.spec_paths.map { |path| new(path) }
end

.find(basename) ⇒ Object



7
8
9
# File 'app/models/matcha/spec.rb', line 7

def self.find(basename)
  all.find { |spec| spec.basename == basename }
end

Instance Method Details

#basenameObject



21
22
23
# File 'app/models/matcha/spec.rb', line 21

def basename
  path[/.*(?=\.js.*$)/]
end

#urlObject



17
18
19
# File 'app/models/matcha/spec.rb', line 17

def url
  "/#{basename}"
end