Module: Praxis::Types::MediaTypeCommon::ClassMethods

Defined in:
lib/praxis/types/media_type_common.rb

Instance Method Summary collapse

Instance Method Details

#describe(shallow = false) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/praxis/types/media_type_common.rb', line 9

def describe(shallow = false)
  hash = super
  unless shallow
    hash.merge!(identifier: @identifier.to_s, description: @description)
  end
  hash
end

#description(text = nil) ⇒ Object



17
18
19
20
# File 'lib/praxis/types/media_type_common.rb', line 17

def description(text=nil)
  @description = text if text
  @description
end

#identifier(identifier = nil) ⇒ String

Deprecated.

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

Get or set the identifier of this media type.

Returns:

  • (String)

    the string-representation of this type’s identifier



27
28
29
30
# File 'lib/praxis/types/media_type_common.rb', line 27

def identifier(identifier=nil)
  return @identifier.to_s unless identifier
  (@identifier = MediaTypeIdentifier.load(identifier)).to_s
end