commento 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3088eb93d7f0b937169a65a8c95efc36eecb202be76a6cd7c98ec5adc5b945e
4
- data.tar.gz: d1ce5f3eaad3ccc2fead78cecde406a20067f4304364948f09027d66ff26b789
3
+ metadata.gz: 9a65354f12eb0a8c66c0bc901f87bb35f1ddf2d9d18f2b399c8e13758bc779e7
4
+ data.tar.gz: b0d88b4c72e2b6e6404b762b2113a6c61779c2d7a3cc4a7732c09452599d895c
5
5
  SHA512:
6
- metadata.gz: 47cd00bf0babcd8ab1c10db8d3edcd4be3330e99c5233b4241fe9552f5a65df96d6494349cc60530781f6d41cead7e05b74c76e7fccff191c9e02de4d78a2031
7
- data.tar.gz: 3d7dbf40b8b2783a32dd86208b32e452d142b3d13b3e4ce5e9325472d5e04343d4f594b707aa8454eca2adf014b7e59fbb3f8dc9a72a42d557377f3c2d0d4783
6
+ metadata.gz: def8375883745c14c5fa4b032bec57a3e4030299fc79c4a0a214e46f177d4e962c93d99a2f899d51e8db450cb4e14ca26d5805430f678b5489b85f14893a72f1
7
+ data.tar.gz: b7fe5588c90a2c072efb614a43201220c443410ed149b3965ea5baf65e93276506e85fe61c4d859e2a15556e4d8232b379e6425f9b288013f48918594689c168
@@ -4,12 +4,12 @@ module Commento
4
4
  class Report
5
5
  COMMENTO_FOLDER_NAME = 'commento'
6
6
 
7
- def initialize(data_collect_service: Commento::Services::DataCollect)
8
- @data_collect_service = data_collect_service.new
7
+ def initialize(data_scraper: Commento::Scrapers::Ruby.new)
8
+ @data_scraper = data_scraper
9
9
  end
10
10
 
11
11
  def create_report
12
- @commento_data = @data_collect_service.call
12
+ @commento_data = @data_scraper.call
13
13
  FileUtils.mkdir_p(COMMENTO_FOLDER_NAME)
14
14
  File.write(
15
15
  "#{COMMENTO_FOLDER_NAME}/#{file_name}",
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commento
4
- module Services
5
- class DataCollect
4
+ module Scrapers
5
+ class Ruby
6
6
  COMMENTO_MATCH_REGEXP = /^[ \t]*# commento:.+$/.freeze
7
7
 
8
8
  # @data contains data with next format
@@ -32,13 +32,17 @@ module Commento
32
32
  end
33
33
  end
34
34
 
35
+ # commento line looks like
36
+ # commento: fantasy_sports.points, fantasy_sports.statistics
35
37
  def iterate_filelines(lines, filename)
36
38
  lines.each.with_index(1) do |line, index|
37
39
  next unless COMMENTO_MATCH_REGEXP.match?(line)
38
40
 
39
- field = line.strip.split('# commento: ')[-1]
40
- @data[field] ||= []
41
- @data[field] << "#{filename}:#{index}"
41
+ fields = line.strip.split('# commento: ')[-1].split(',').map(&:strip)
42
+ fields.each do |field|
43
+ @data[field] ||= []
44
+ @data[field] << "#{filename}:#{index}"
45
+ end
42
46
  end
43
47
  end
44
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commento
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
data/lib/commento.rb CHANGED
@@ -8,7 +8,7 @@ require 'commento/dsl'
8
8
  require 'commento/helpers'
9
9
  require 'commento/report'
10
10
  require 'commento/reports/html'
11
- require 'commento/services/data_collect'
11
+ require 'commento/scrapers/ruby'
12
12
 
13
13
  module Commento
14
14
  extend self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commento
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdanov Anton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -82,7 +82,7 @@ files:
82
82
  - lib/commento/helpers.rb
83
83
  - lib/commento/report.rb
84
84
  - lib/commento/reports/html.rb
85
- - lib/commento/services/data_collect.rb
85
+ - lib/commento/scrapers/ruby.rb
86
86
  - lib/commento/version.rb
87
87
  homepage: https://github.com/kortirso/commento
88
88
  licenses: