Class: Lyrics::FetchPageData

Inherits:
Object
  • Object
show all
Defined in:
lib/lyrics/lyrics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, post_data = nil, headers_data = nil) ⇒ FetchPageData

Returns a new instance of FetchPageData.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/lyrics/lyrics.rb', line 171

def initialize( url, post_data=nil, headers_data=nil )
	@url = url.freeze()
	if post_data && post_data.size > 0
		@post_data = post_data.clone().freeze()
		@post_data.each() do |key|
			@post_data[key] = @post_data[key].clone().freeze() if @post_data[key]
		end
	else
		@post_data = nil
	end
	if headers_data && headers_data.size > 0
		@headers_data = headers_data.clone().freeze()
		@headers_data.each() do |key|
			@headers_data[key] = @headers_data[key].clone().freeze() if @headers_data[key]
		end
	else
		@headers_data = nil
	end
end

Instance Attribute Details

#headers_dataObject (readonly)

Returns the value of attribute headers_data.



169
170
171
# File 'lib/lyrics/lyrics.rb', line 169

def headers_data
  @headers_data
end

#post_dataObject (readonly)

Returns the value of attribute post_data.



169
170
171
# File 'lib/lyrics/lyrics.rb', line 169

def post_data
  @post_data
end

#urlObject (readonly)

Returns the value of attribute url.



169
170
171
# File 'lib/lyrics/lyrics.rb', line 169

def url
  @url
end

Instance Method Details

#to_sObject



191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/lyrics/lyrics.rb', line 191

def to_s()
	ret = " - fetch url: #{@url}"
	if @post_data
		ret << "\n - fetch post data:"
		@post_data.each { |key, val| ret << "\n    - #{key}: #{val}" }
	end
	if @headers_data
		ret << "\n - fetch headers data:"
		@headers_data.each { |key, val| ret << "\n    - #{key}: #{val}" }
	end
	return ret
end