Class: WebCrawler::View::Base
- Inherits:
-
Object
- Object
- WebCrawler::View::Base
show all
- Defined in:
- lib/web_crawler/view.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(input, options = { }) ⇒ Base
30
31
32
33
|
# File 'lib/web_crawler/view.rb', line 30
def initialize(input, options = { })
@options = self.class.default_options.merge (options || { })
@input = input
end
|
Class Attribute Details
.default_options ⇒ Object
Returns the value of attribute default_options.
23
24
25
|
# File 'lib/web_crawler/view.rb', line 23
def default_options
@default_options
end
|
Instance Attribute Details
Returns the value of attribute input.
18
19
20
|
# File 'lib/web_crawler/view.rb', line 18
def input
@input
end
|
Instance Method Details
#draw(output = nil) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/web_crawler/view.rb', line 39
def draw(output=nil)
begin
io = present_output(output)
io.puts render
ensure
io.close if io.respond_to? :close
end
end
|
48
49
50
|
# File 'lib/web_crawler/view.rb', line 48
def format(item)
item
end
|
#render ⇒ Object
35
36
37
|
# File 'lib/web_crawler/view.rb', line 35
def render
[*input].map { |i| format(i) }.join
end
|