Class: Spec
- Inherits:
-
Object
- Object
- Spec
- Defined in:
- lib/juxtapose/application/lib/spec.rb
Instance Attribute Summary collapse
-
#basedir ⇒ Object
Returns the value of attribute basedir.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #accepted ⇒ Object
- #as_json ⇒ Object
- #current ⇒ Object
- #diff ⇒ Object
- #images ⇒ Object
-
#initialize(basedir, path) ⇒ Spec
constructor
A new instance of Spec.
- #name ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(basedir, path) ⇒ Spec
Returns a new instance of Spec.
4 5 6 7 |
# File 'lib/juxtapose/application/lib/spec.rb', line 4 def initialize(basedir, path) self.basedir = basedir self.path = path end |
Instance Attribute Details
#basedir ⇒ Object
Returns the value of attribute basedir.
2 3 4 |
# File 'lib/juxtapose/application/lib/spec.rb', line 2 def basedir @basedir end |
#path ⇒ Object
Returns the value of attribute path.
2 3 4 |
# File 'lib/juxtapose/application/lib/spec.rb', line 2 def path @path end |
Instance Method Details
#accepted ⇒ Object
23 24 25 |
# File 'lib/juxtapose/application/lib/spec.rb', line 23 def accepted images.select(&:accepted?).first end |
#as_json ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/juxtapose/application/lib/spec.rb', line 35 def as_json { directory: path, accepted: accepted, current: current, diff: diff } end |
#current ⇒ Object
27 28 29 |
# File 'lib/juxtapose/application/lib/spec.rb', line 27 def current images.select(&:current?).first end |
#diff ⇒ Object
31 32 33 |
# File 'lib/juxtapose/application/lib/spec.rb', line 31 def diff images.select(&:diff?).first end |
#images ⇒ Object
9 10 11 12 13 |
# File 'lib/juxtapose/application/lib/spec.rb', line 9 def images Dir.glob(File.join(path, '*.png')).map do |img| Image.new(basedir, img) end end |
#name ⇒ Object
15 16 17 |
# File 'lib/juxtapose/application/lib/spec.rb', line 15 def name path.gsub(basedir, '') end |
#to_json ⇒ Object
19 20 21 |
# File 'lib/juxtapose/application/lib/spec.rb', line 19 def to_json as_json.to_json end |