Class: Image

Inherits:
Object
  • Object
show all
Defined in:
lib/juxtapose/application/lib/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(basedir, img) ⇒ Image

Returns a new instance of Image.



4
5
6
7
# File 'lib/juxtapose/application/lib/image.rb', line 4

def initialize(basedir, img)
  self.basedir = basedir
  self.img = img
end

Instance Attribute Details

#basedirObject

Returns the value of attribute basedir.



2
3
4
# File 'lib/juxtapose/application/lib/image.rb', line 2

def basedir
  @basedir
end

#imgObject

Returns the value of attribute img.



2
3
4
# File 'lib/juxtapose/application/lib/image.rb', line 2

def img
  @img
end

Instance Method Details

#accepted?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/juxtapose/application/lib/image.rb', line 9

def accepted?
  File.basename(img).match /accepted/
end

#as_jsonObject



29
30
31
32
33
34
# File 'lib/juxtapose/application/lib/image.rb', line 29

def as_json
  {
    path: path,
    img: img
  }
end

#current?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/juxtapose/application/lib/image.rb', line 13

def current?
  File.basename(img).match /current/
end

#diff?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/juxtapose/application/lib/image.rb', line 17

def diff?
  File.basename(img).match /diff/
end

#pathObject



21
22
23
# File 'lib/juxtapose/application/lib/image.rb', line 21

def path
  File.join("/images", img)
end

#to_json(options = {}) ⇒ Object



25
26
27
# File 'lib/juxtapose/application/lib/image.rb', line 25

def to_json(options={})
  as_json.to_json
end