Module: Meta::JsonSchema::Presenters

Defined in:
lib/meta/json_schema/support/presenters.rb

Class Method Summary collapse

Class Method Details

.present(presenter, value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/meta/json_schema/support/presenters.rb', line 17

def present(presenter, value)
  @presenter_handlers.each do |presenter_handler|
    next unless presenter_handler.handle?(presenter)

    return presenter_handler.present(presenter, value)
  end
end

.register(presenter_handler) ⇒ Object



9
10
11
# File 'lib/meta/json_schema/support/presenters.rb', line 9

def register(presenter_handler)
  @presenter_handlers << presenter_handler
end

.to_schema_doc(presenter, other_options) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/meta/json_schema/support/presenters.rb', line 25

def to_schema_doc(presenter, other_options)
  @presenter_handlers.each do |presenter_handler|
    next unless presenter_handler.handle?(presenter)

    return presenter_handler.to_schema_doc(presenter, other_options)
  end
end

.unregister(presenter_handler) ⇒ Object



13
14
15
# File 'lib/meta/json_schema/support/presenters.rb', line 13

def unregister(presenter_handler)
  @presenter_handlers.delete(presenter_handler)
end