Class: IIIF::V3::Presentation::Choice
Constant Summary
collapse
- TYPE =
'Choice'.freeze
AbstractResource::CONTENT_RESOURCE_PROPERTIES, AbstractResource::PAGING_PROPERTIES
HashBehaviours::SIMPLE_SELF_RETURNERS
Instance Method Summary
collapse
from_ordered_hash, #hash_only_keys, #int_only_keys, #legal_viewing_direction_values, #numeric_only_keys, parse, #required_keys, #to_json, #to_ordered_hash, #uri_only_keys
#clear, #merge, #merge!, #reject!, #select, #select!
Constructor Details
#initialize(hsh = {}) ⇒ Choice
Returns a new instance of Choice.
33
34
35
36
|
# File 'lib/iiif/v3/presentation/choice.rb', line 33
def initialize(hsh={})
hsh['type'] = TYPE unless hsh.has_key? 'type'
super(hsh)
end
|
Instance Method Details
#any_type_keys ⇒ Object
13
14
15
|
# File 'lib/iiif/v3/presentation/choice.rb', line 13
def any_type_keys
super + %w{ default }
end
|
#array_only_keys ⇒ Object
21
22
23
|
# File 'lib/iiif/v3/presentation/choice.rb', line 21
def array_only_keys;
super + %w{ items };
end
|
#legal_choice_hint_values ⇒ Object
29
30
31
|
# File 'lib/iiif/v3/presentation/choice.rb', line 29
def legal_choice_hint_values
%w{ client user }
end
|
#legal_viewing_hint_values ⇒ Object
25
26
27
|
# File 'lib/iiif/v3/presentation/choice.rb', line 25
def legal_viewing_hint_values
%w{ none }
end
|
#prohibited_keys ⇒ Object
8
9
10
11
|
# File 'lib/iiif/v3/presentation/choice.rb', line 8
def prohibited_keys
super + CONTENT_RESOURCE_PROPERTIES + PAGING_PROPERTIES +
%w{ nav_date viewing_direction start_canvas content_annotations }
end
|
#string_only_keys ⇒ Object
17
18
19
|
# File 'lib/iiif/v3/presentation/choice.rb', line 17
def string_only_keys
super + %w{ choice_hint }
end
|
#validate ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/iiif/v3/presentation/choice.rb', line 38
def validate
super
if self.has_key?('choice_hint')
unless self.legal_choice_hint_values.include?(self['choice_hint'])
m = "choiceHint for #{self.class} must be one of #{self.legal_choice_hint_values}."
raise IIIF::V3::Presentation::IllegalValueError, m
end
end
end
|