module Praxis::Types::MediaTypeCommon::ClassMethods

Public Instance Methods

describe(shallow = false, **opts) click to toggle source
Calls superclass method
# File lib/praxis/types/media_type_common.rb, line 9
def describe(shallow = false, **opts)
  hash = super
  unless shallow
    hash.merge!(identifier: @identifier.to_s, description: @description, display_name: self.display_name)
  end
  hash
end
description(text=nil) click to toggle source
# File lib/praxis/types/media_type_common.rb, line 17
def description(text=nil)
  @description = text if text
  @description
end
display_name( string=nil ) click to toggle source
# File lib/praxis/types/media_type_common.rb, line 22
def display_name( string=nil )
  unless string
    return  @display_name ||= self.name.split("::").last  # Best guess at a display name?
  end
  @display_name = string
end
identifier(identifier=nil) click to toggle source

Get or set the identifier of this media type.

@deprecated this method is not deprecated, but its return type will change to MediaTypeIdentifier in Praxis 1.0

@return [String] the string-representation of this type's identifier

# File lib/praxis/types/media_type_common.rb, line 34
def identifier(identifier=nil)
  return @identifier.to_s unless identifier
  (@identifier = MediaTypeIdentifier.load(identifier)).to_s
end