Class: PointmdComments::Aggregators::Main
- Inherits:
-
Object
- Object
- PointmdComments::Aggregators::Main
- Defined in:
- lib/pointmd_comments/aggregators/main.rb
Constant Summary collapse
- CHROME_ARGS =
%w[disable-dev-shm-usage disable-software-rasterizer no-sandbox].freeze
Instance Attribute Summary collapse
-
#all_comments ⇒ Object
readonly
Returns the value of attribute all_comments.
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#comments_aggregator ⇒ Object
readonly
Returns the value of attribute comments_aggregator.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#posts ⇒ Object
readonly
Returns the value of attribute posts.
-
#posts_aggregator ⇒ Object
readonly
Returns the value of attribute posts_aggregator.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ Main
constructor
A new instance of Main.
Constructor Details
#initialize(options) ⇒ Main
Returns a new instance of Main.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 8 def initialize() # Currently 'path' is not supported @path = nil @output = [:output] || default_output_path @source = [:source] || Aggregators::Posts::DEFAULT_SOURCE @posts_aggregator = Aggregators::Posts.new(source: source, path: path) @comments_aggregator = Aggregators::Comments.new client = Selenium::WebDriver::Remote::Http::Default.new # NOTE: #timeout= is deprecated, use #read_timeout= and #open_timeout= instead client.timeout = 600 # instead of the default 60 (seconds) @browser = ::Watir::Browser.new :chrome, http_client: client, headless: true, args: CHROME_ARGS @all_comments = [] end |
Instance Attribute Details
#all_comments ⇒ Object (readonly)
Returns the value of attribute all_comments.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def all_comments @all_comments end |
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def browser @browser end |
#comments_aggregator ⇒ Object (readonly)
Returns the value of attribute comments_aggregator.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def comments_aggregator @comments_aggregator end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def output @output end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def path @path end |
#posts ⇒ Object (readonly)
Returns the value of attribute posts.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def posts @posts end |
#posts_aggregator ⇒ Object (readonly)
Returns the value of attribute posts_aggregator.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def posts_aggregator @posts_aggregator end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 6 def source @source end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/pointmd_comments/aggregators/main.rb', line 24 def call @posts = posts_aggregator.call collect_all_comments write_to_csv end |