Module: CGI::QueryExtension::Value

Defined in:
lib/cgi.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#[](idx, *args) ⇒ Object



1151
1152
1153
1154
1155
1156
1157
1158
# File 'lib/cgi.rb', line 1151

def [](idx, *args)
  if args.size == 0
    warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
    @params[idx]
  else
    super[idx,*args]
  end
end

#firstObject Also known as: last



1159
1160
1161
1162
# File 'lib/cgi.rb', line 1159

def first
  warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
  self
end

#set_params(params) ⇒ Object



1148
1149
1150
# File 'lib/cgi.rb', line 1148

def set_params(params)
  @params = params
end

#to_aObject Also known as: to_ary



1164
1165
1166
# File 'lib/cgi.rb', line 1164

def to_a
  @params || [self]
end