ruby-superparser 0.1.1 → 0.1.2

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: 562838c888b03c5ee50200cfcdc414964b48357fa808987d1b621b5f414db8e0
4
- data.tar.gz: 9174a3c5e4598135047ba2ea1e6e2f9e5054e11c2502f88eb6056db9a4565774
3
+ metadata.gz: 27e79dbede1bacc8d5e082dd9e2eb06ce21d8f898d74e73a051e5cc507d3cfb4
4
+ data.tar.gz: 7acc5017d71d14d3112db73a19948a34e87871ccb78b2e577581b74601ebb829
5
5
  SHA512:
6
- metadata.gz: 4fba72973fc4195072b59d59e1d490a228dab41234d4e42e50f1a37d6baa2503645c65d67d944e66e9f141cb2811407ef8023880a0b0ddd24afb14983a9e23c2
7
- data.tar.gz: 8c74c7357eec6a85672d6adfcfca0f0c611630cbe0d9246c392dcb1a87e7581323190033dc829d3e0776f904621f4407bda2f72ce92c255bd96823cf632b719a
6
+ metadata.gz: 12d019e44100ef67b924fc176ca3a644b126c536e52be08ddee240b49d665f6e7591abd63ccc5e58c12290760c1051a5750310a521e20fd37881e7fc89223dcc
7
+ data.tar.gz: 10ee3ccdb9b5990fe046c854430da080bf408f0756ca424118250e6306998dd4620102b6d868799daada7a17b6b82a717d4f3f32ccfbf4b1a22d8a418475949d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-superparser (0.1.1)
4
+ ruby-superparser (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,4 +1,9 @@
1
1
  # lib/generators/ruby_superparser/templates/initializer.rb
2
2
 
3
- api_key = ENV['SUPERPARSER_API_KEY']
4
- SUPERPARSER_CLIENT = RubySuperparser::Client.new(api_key)
3
+ RubySuperparser.init do |config|
4
+ config.api_key = ENV['SUPERPARSER_API_KEY']
5
+
6
+ config.async = lambda { |document_id|
7
+ SuperparserJob.perform_later(document_id)
8
+ }
9
+ end
@@ -0,0 +1,10 @@
1
+ # lib/generators/ruby_superparser/templates/superparser_job.rb
2
+
3
+ class SuperparserJob < ApplicationJob
4
+ queue_as :default
5
+
6
+ def perform(document_id)
7
+ document = ExternalDocument.find(document_id)
8
+ RubySuperparser.config.async.call(document)
9
+ end
10
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Ruby
4
- module Superparser
5
- VERSION = "0.1.1"
6
- end
7
- end
3
+ module RubySuperparser
4
+ VERSION = '0.1.2'
5
+ end
@@ -0,0 +1,10 @@
1
+ module RubySuperparser
2
+ class Configuration
3
+ attr_accessor :api_key, :async
4
+
5
+ def initialize
6
+ @api_key = nil
7
+ @async = nil
8
+ end
9
+ end
10
+ end
@@ -10,7 +10,7 @@ module RubySuperparser
10
10
 
11
11
  define_method :process_document_with_superparser do
12
12
  if options[:async]
13
- RubySuperparser::DocumentProcessorWorker.perform_async(id)
13
+ RubySuperparser.config.async.call(id)
14
14
  else
15
15
  superparser_client.parse_resume(send(attached_attribute))
16
16
  end
@@ -21,8 +21,9 @@ module RubySuperparser
21
21
  private
22
22
 
23
23
  def superparser_client
24
- api_key = ENV['SUPERPARSER_API_KEY']
25
- @superparser_client ||= RubySuperparser::Client.new(api_key)
24
+ @superparser_client ||= RubySuperparser::Client.new(RubySuperparser.config)
26
25
  end
26
+
27
27
  end
28
28
  end
29
+
@@ -1,8 +1,16 @@
1
1
  # lib/ruby_superparser.rb
2
2
 
3
- require "ruby_superparser/version"
4
- require "ruby_superparser/client"
5
- require "ruby_superparser/superparser_integration"
3
+ require_relative 'ruby/superparser/version'
4
+ require_relative 'ruby_superparser/client'
5
+ require_relative 'ruby_superparser/configuration'
6
+ require_relative 'ruby_superparser/superparser_integration'
6
7
 
7
8
  module RubySuperparser
8
- end
9
+ def self.config
10
+ @config ||= Configuration.new
11
+ end
12
+
13
+ def self.init
14
+ yield config if block_given?
15
+ end
16
+ end
@@ -4,7 +4,7 @@ require_relative "lib/ruby/superparser/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "ruby-superparser"
7
- spec.version = Ruby::Superparser::VERSION
7
+ spec.version = RubySuperparser::VERSION
8
8
  spec.authors = ["JP Silvashy"]
9
9
  spec.email = ["jpsilvashy@gmail.com"]
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-superparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Silvashy
@@ -43,9 +43,11 @@ files:
43
43
  - bin/setup
44
44
  - lib/generators/ruby_superparser/install_generator.rb
45
45
  - lib/generators/ruby_superparser/templates/initializer.rb
46
- - lib/ruby/superparser.rb
46
+ - lib/generators/ruby_superparser/templates/superparser_job.rb
47
47
  - lib/ruby/superparser/version.rb
48
48
  - lib/ruby_superparser.rb
49
+ - lib/ruby_superparser/client.rb
50
+ - lib/ruby_superparser/configuration.rb
49
51
  - lib/ruby_superparser/superparser_integration.rb
50
52
  - ruby-superparser.gemspec
51
53
  - sig/ruby/superparser.rbs