Movatterモバイル変換


[0]ホーム

URL:


Libraries »piotrmurach/github(master) »Index (M) »Github »MimeType

Module: Github::MimeType

Included in:
API,ParamsHash
Defined in:
lib/github_api/mime_type.rb

Constant Summarycollapse

MEDIA_LOOKUP =
{'json'=>'json','blob'=>'raw','raw'=>'raw+json','text'=>'text+json','html'=>'html+json','full'=>'full+json'}

Instance Method Summarycollapse

Instance Method Details

#lookup_media(name) ⇒Object

2627282930
# File 'lib/github_api/mime_type.rb', line 26deflookup_media(name)MEDIA_LOOKUP.fetch(name)doraiseArgumentError,"Provided Media Type #{name} is not valid"endend

#parse(media) ⇒Object

Parse media type param

1718192021222324
# File 'lib/github_api/mime_type.rb', line 17defparse(media)version='v3'media.sub!(/^[.]*|[.]*$/,"")media=media.include?('+')?media.split('+')[0]:mediaversion,media=media.split('.')ifmedia.include?('.')media_type=lookup_media(media)"application/vnd.github.#{version}.#{media_type}"end
Generated on Sun Nov 30 19:05:48 2025 byyard 0.9.37 (ruby-3.4.3).

[8]ページ先頭

©2009-2025 Movatter.jp