Module: Praxis::Types::MediaTypeCommon::ClassMethods
- Defined in:
- lib/praxis/types/media_type_common.rb
Instance Method Summary collapse
- #as_json_schema(**args) ⇒ Object
- #description(text = nil) ⇒ Object
- #display_name(string = nil) ⇒ Object
-
#identifier(identifier = nil) ⇒ MediaTypeIdentifier
Get or set the identifier of this media type.
- #json_schema_type ⇒ Object
Instance Method Details
#as_json_schema(**args) ⇒ Object
10 11 12 13 |
# File 'lib/praxis/types/media_type_common.rb', line 10 def as_json_schema(**args) the_type = @attribute&.type || member_type the_type.as_json_schema(args) end |
#description(text = nil) ⇒ Object
20 21 22 23 |
# File 'lib/praxis/types/media_type_common.rb', line 20 def description(text = nil) @description = text if text @description end |
#display_name(string = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/praxis/types/media_type_common.rb', line 25 def display_name(string = nil) unless string return @display_name ||= name.split('::').last # Best guess at a display name? end @display_name = string end |
#identifier(identifier = nil) ⇒ MediaTypeIdentifier
Get or set the identifier of this media type.
36 37 38 39 40 |
# File 'lib/praxis/types/media_type_common.rb', line 36 def identifier(identifier = nil) return @identifier unless identifier @identifier = MediaTypeIdentifier.load(identifier) end |
#json_schema_type ⇒ Object
15 16 17 18 |
# File 'lib/praxis/types/media_type_common.rb', line 15 def json_schema_type the_type = @attribute&.type || member_type the_type.json_schema_type end |