Class: IIIF::Presentation::Canvas

Inherits:
AbstractResource show all
Defined in:
lib/iiif/presentation/canvas.rb

Constant Summary collapse

TYPE =

TODO (?) a simple ‘Image Canvas’ constructor.

'sc:Canvas'

Constants included from HashBehaviours

HashBehaviours::SIMPLE_SELF_RETURNERS

Instance Method Summary collapse

Methods inherited from AbstractResource

#abstract_resource_only_keys, #hash_only_keys, #legal_viewing_direction_values, #string_only_keys, #to_ordered_hash

Methods inherited from Service

#abstract_resource_only_keys, from_ordered_hash, #hash_only_keys, parse, #string_only_keys, #to_json, #to_ordered_hash

Methods included from HashBehaviours

#clear, #merge, #merge!, #reject!, #select, #select!

Constructor Details

#initialize(hsh = {}) ⇒ Canvas

Returns a new instance of Canvas.



32
33
34
35
# File 'lib/iiif/presentation/canvas.rb', line 32

def initialize(hsh={})
  hsh['@type'] = TYPE unless hsh.has_key? '@type'
  super(hsh)
end

Instance Method Details

#any_type_keysObject



15
16
17
# File 'lib/iiif/presentation/canvas.rb', line 15

def any_type_keys
  super + %w{  }
end

#array_only_keysObject



19
20
21
# File 'lib/iiif/presentation/canvas.rb', line 19

def array_only_keys
  super + %w{ images other_content }
end

#int_only_keysObject

TODO: test and validate



24
25
26
# File 'lib/iiif/presentation/canvas.rb', line 24

def int_only_keys
  super + %w{ width height }
end


28
29
30
# File 'lib/iiif/presentation/canvas.rb', line 28

def legal_viewing_hint_values
  super + %w{ non-paged }
end

#required_keysObject



11
12
13
# File 'lib/iiif/presentation/canvas.rb', line 11

def required_keys
  super + %w{ @id width height label }
end

#validateObject



37
38
39
40
41
# File 'lib/iiif/presentation/canvas.rb', line 37

def validate
  # all members of images must be an annotation
  # all members of otherContent must be an annotation list
  super
end