class Spec

Attributes

basedir[RW]
path[RW]

Public Class Methods

new(basedir, path) click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 4
def initialize(basedir, path)
  self.basedir = basedir
  self.path = path
end

Public Instance Methods

accepted() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 23
def accepted
  images.select(&:accepted?).first
end
as_json() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 35
def as_json
  {
    directory: path,
    accepted: accepted,
    current: current,
    diff: diff
  }
end
current() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 27
def current
  images.select(&:current?).first
end
diff() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 31
def diff
  images.select(&:diff?).first
end
images() click to toggle source
# 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() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 15
def name
  path.gsub(basedir, '')
end
to_json() click to toggle source
# File lib/juxtapose/application/lib/spec.rb, line 19
def to_json
  as_json.to_json
end