Class: Matcha::Spec
- Inherits:
-
Object
- Object
- Matcha::Spec
- Defined in:
- app/models/matcha/spec.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #basename ⇒ Object
-
#initialize(path) ⇒ Spec
constructor
A new instance of Spec.
- #url ⇒ Object
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
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'app/models/matcha/spec.rb', line 11 def path @path end |
Class Method Details
.all ⇒ Object
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
#basename ⇒ Object
21 22 23 |
# File 'app/models/matcha/spec.rb', line 21 def basename path[/.*(?=\.js.*$)/] end |
#url ⇒ Object
17 18 19 |
# File 'app/models/matcha/spec.rb', line 17 def url "/#{basename}" end |