るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.117秒)

別のキーワード

  1. rss content=
  2. rss content
  3. net/imap content_id
  4. source content
  5. source content=

ライブラリ

モジュール

キーワード

検索結果

Net::HTTPHeader#content_type -> String|nil (54379.0)

"text/html" のような Content-Type を表す 文字列を返します。

"text/html" のような Content-Type を表す
文字列を返します。

Content-Type: ヘッダフィールドが存在しない場合には nil を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
req = Net::HTTP::Post.new(uri.request_uri)
req.content_type # => nil
req.content_type = 'multipart/for...

Net::HTTPHeader#content_type=(type) (18382.0)

type と params から Content-Type: ヘッダフィールドの 値を設定します。

type と params から Content-Type: ヘッダフィールドの
値を設定します。

@param type メディアタイプを文字列で指定します。
@param params パラメータ属性をハッシュで指定します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_type # => ni...

Net::HTTPHeader#set_content_type(type, params = {}) (18382.0)

type と params から Content-Type: ヘッダフィールドの 値を設定します。

type と params から Content-Type: ヘッダフィールドの
値を設定します。

@param type メディアタイプを文字列で指定します。
@param params パラメータ属性をハッシュで指定します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_type # => ni...

OpenURI::OpenRead#read(options = {}) -> String (40.0)

自身が表す内容を読み込んで文字列として返します。 self.open(options={}) {|io| io.read } と同じです。 このメソッドによって返される文字列は OpenURI::Meta によって extend されています。

自身が表す内容を読み込んで文字列として返します。
self.open(options={}) {|io| io.read } と同じです。
このメソッドによって返される文字列は OpenURI::Meta
によって extend されています。

@param options ハッシュを与えます。

require 'open-uri'
uri = URI.parse('http://www.example.com/')
str = uri.read
p str.is_a?(OpenURI::Meta) # => true
p str.content_type