-
Notifications
You must be signed in to change notification settings - Fork 43
2371-3 #290
base: master
Are you sure you want to change the base?
2371-3 #290
Conversation
class OnlinerApiHandler | ||
def handle_data(data) | ||
JSON(data)['comments'].each_with_index.map do |value, index| | ||
{ id: index + 1, text: value['text'], author: value['author']['name'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: OnlinerApiHandler#handle_data refers to 'value' more than self (maybe move it to another class?). More info.
attribute :text | ||
attribute :author | ||
attribute :rating | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
@@ -0,0 +1,6 @@ | |||
require "ohm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
attribute :link | ||
attribute :rating | ||
set :comments, :Comment | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
@@ -0,0 +1,6 @@ | |||
require "ohm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
comment.id == score['id'].to_i | ||
end.rating = score['score'] | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
|
||
def add_comments_score(scores) | ||
scores.each do |score| | ||
comments.detect do |comment| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NestedIterators: ArticleHelper#add_comments_score contains iterators nested 2 deep. More info.
def add_comments_score(scores) | ||
scores.each do |score| | ||
comments.detect do |comment| | ||
comment.id == score['id'].to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: ArticleHelper#add_comments_score refers to 'score' more than self (maybe move it to another class?). More info.
@@ -0,0 +1,30 @@ | |||
require_relative 'helper' | |||
class ArticleHelper < Helper | |||
attr_accessor :id, :link, :comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
end | ||
|
||
# puts ApplicationHelper.new("https://tech.onliner.by/2018/07/24/magic").search_article_comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
class OnlinerApiHandler | ||
def handle_data(data) | ||
JSON(data)['comments'].each_with_index.map do |value, index| | ||
{ id: index + 1, text: value['text'], author: value['author']['name'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: OnlinerApiHandler#handle_data refers to 'value' more than self (maybe move it to another class?). More info.
attribute :text | ||
attribute :author | ||
attribute :rating | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
@@ -0,0 +1,6 @@ | |||
require "ohm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
attribute :link | ||
attribute :rating | ||
set :comments, :Comment | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
@@ -0,0 +1,6 @@ | |||
require "ohm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
comment.id == score['id'].to_i | ||
end.rating = score['score'] | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
|
||
def add_comments_score(scores) | ||
scores.each do |score| | ||
comments.detect do |comment| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NestedIterators: ArticleHelper#add_comments_score contains iterators nested 2 deep. More info.
def add_comments_score(scores) | ||
scores.each do |score| | ||
comments.detect do |comment| | ||
comment.id == score['id'].to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: ArticleHelper#add_comments_score refers to 'score' more than self (maybe move it to another class?). More info.
@@ -0,0 +1,30 @@ | |||
require_relative 'helper' | |||
class ArticleHelper < Helper | |||
attr_accessor :id, :link, :comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
end | ||
|
||
# puts ApplicationHelper.new("https://tech.onliner.by/2018/07/24/magic").search_article_comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
Номер
2371
Номер задания
3
Комментарии
Task 3: parsing comments from onliner link