Class: IIIF::Image::Region::Percent

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif/image/region/percent.rb

Overview

represents request cooridnates specified as percentage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height) ⇒ Percent

Returns a new instance of Percent.

Parameters:

  • x (Float)
  • y (Float)
  • width (Float)
  • height (Float)


9
10
11
12
13
14
# File 'lib/iiif/image/region/percent.rb', line 9

def initialize(x, y, width, height)
  @x_pct = x
  @y_pct = y
  @width_pct = width
  @height_pct = height
end

Instance Attribute Details

#height_pctObject (readonly)

Returns the value of attribute height_pct.



16
17
18
# File 'lib/iiif/image/region/percent.rb', line 16

def height_pct
  @height_pct
end

#width_pctObject (readonly)

Returns the value of attribute width_pct.



16
17
18
# File 'lib/iiif/image/region/percent.rb', line 16

def width_pct
  @width_pct
end

#x_pctObject (readonly)

Returns the value of attribute x_pct.



16
17
18
# File 'lib/iiif/image/region/percent.rb', line 16

def x_pct
  @x_pct
end

#y_pctObject (readonly)

Returns the value of attribute y_pct.



16
17
18
# File 'lib/iiif/image/region/percent.rb', line 16

def y_pct
  @y_pct
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/iiif/image/region/percent.rb', line 18

def to_s
  "pct:#{x_pct},#{y_pct},#{width_pct},#{height_pct}"
end